summaryrefslogtreecommitdiff
path: root/src/misc.c
Commit message (Collapse)AuthorAge
* scanner: prevent overflow in add_action()Explorer092017-12-06
|
* {re,}allocate_array code cleanupExplorer092017-09-02
|
* scanner: Ignore comment lines in skeleton files.jannick02017-07-15
| | | | | | | | | In skeleton files comments are indicated by leading `%#` and when directly read in using `flex -S <skeleton.skl>` they should be ignored. Example: `flex.skl`. Amending commit 2f21edac99b5efc432417233e6e53326d630e08f which removed this conditional branch.
* scanner: Use reallocarr() when available.Thomas Klausner2017-05-19
| | | | | | | | | NetBSD had a crash during build. Since the provided substitute for reallocarray() wasn't working, use NetBSD's reallocarr(). Let configure choose that function whenever it is available. Use reallocarray if available. Still fallback if neither is available. Fixes #219
* build: Delete comments from skeleton file.Demi Obenour2017-05-03
| | | | | | Since the comments in flex.skl are, by hypothesis, not needed in skel.c, we remove them. THis reduces the size of the resulting executable somewhat.
* Fix myesc() 'sptr' conditionalsExplorer092017-05-02
| | | | | | | | | | * Don't call isascii() here. It's deprecated in POSIX and not needed for myesc's case. * The check of the character class and range here should match what's defined as {ESCSEQ} in scan.l, so for [[:xdigit:]] we use isxdigit(); for [0-7] we check '0' <= c <= '7' (not isdigit(c) because isdigit is locale-dependant in standard's sense) * Add missing length limit for "\x<hex>" (<hex> is at most 2 digits)
* Obsolete htoui() and otoui(); use strtoul().Explorer092017-05-02
| | | | | No sense to keep these two function when libc's strtoul() can do the same job, but better.
* build: detect overflow for [re]allocate_array.Explorer092017-01-24
| | | | | | | | | | | Use reallocarray() when we have it (i.e. in OpenBSD system). When we don't, use equivalent overflow detection for our allocate_array and reallocate_array functions. Remove lib/reallocarray.c from our LIBOBJS as we no longer need it. Provide a fallback SIZE_MAX macro definition in flexint.h (not preprocessor friendly, but enough for our reallocate_array use case).
* scanner: Use array instead of pointerChristos Zoulas2017-01-23
|
* scanner: Include stdarg.h for va_listChristos Zoulas2017-01-23
|
* Fix M4 quoting of section 3.Demi Obenour2016-10-05
| | | | | | | | | | This fixes M4 quoting of section 3 of the input file, including escape sequences and character constants. Tests were added to verify the behavior in section 3 with respect to quoting. Both escaping of quotes and quoting of potential macro-start characters are tested. Existing tests were also fixed to account for the new -- and now correct -- behavior. Many tests relied on the old behavior of expanding M4 macros in section 3. They needed to be updated for the new behavior.
* Delete action_m4_define from misc.cDemetri Obenour2016-05-23
| | | This function was not used and always triggered a fatal error when run.
* cast to get rid of warningsrlar2016-03-08
|
* change return type and rename int htoi()/otoi() --> unsigned int htoui()/otoui()rlar2016-03-08
|
* add (size_t) casts to malloc invocations to prevent warningsrlar2016-03-01
|
* add (int) casts to some strlen() invocations to prevent warningsrlar2016-02-29
|
* Converted K&R style function definitions to ANSI C styleTobias Klauser2016-02-16
| | | | | Consistently make use of the ANSI C function definition style instead of the K&R style.
* Cleaned up __STDC__ #ifdefs.Michael Reed2015-12-27
| | | | | | Assuming a compiler conforming to the ISO C standard is used, i.e., __STDC__ is defined to 1, YY_USE_CONST is always defined and can be eliminated.
* Replace zero_out() with stdlib's memset.Michael McConville2015-12-09
|
* Removed flex_realloc().Michael McConville2015-12-09
| | | | | As with flex_alloc(), replace calls to flex_realloc(), which was just a wrapper around realloc().
* Removed flex_alloc; cleaned up style.Michael McConville2015-12-09
| | | | | | | | | | | The function flex_alloc() was just a wrapper around malloc(). Since this only added unclarity, and the flex_alloc() function is likely a legacy of olden times, remove it in favor of calls to malloc() directly. Style elements cleaned up: * superfluous spacing around parentheses * non-constant initialization in variable declarations * needless casts * almost all uses of assignments as subexpressions
* Replace copy_unsigned_string() with xstrdup().Michael McConville2015-12-05
| | | | | | Like copy_string(), copy_unsigned_string() is just a clone of the stlib's strdup(). We only use it twice. I'm pretty confident that char signedness is irrelevant in this case.
* Made string copying more standard.Michael McConville2015-12-02
| | | | | copy_string() was a clone of the stdlib's strdup(). For safety, simplicity, and speed, we should use that instead. We introduce xstrdup() which wraps strdup() in a failure upon memory allocation errors.
* Replaced CHAR macro with unsigned char type.Mightyjo2015-11-29
| | | | | | | | Thanks to Michael McConville for pointing out that the old Char macro causes problems with static analysis. The macro has been removed and replaced with 'unsigned char' throughout the flex sources. The macro is not needed at best and was confusing at worst. It was not used in any of the example files nor was it mentioned in the manual at all.
* Switch function definitions from mixed K&R to consistent ANSI C.Stefan Reinauer2015-11-19
| | | | | | | | flex was using K&R function definitions for some functions and ANSI C style in others, sometimes even in the same file. Change the code to consistently use ANSI C. Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
* Fix -Wdocumentation warningsAlexis La Goutte2014-11-21
|
* NetBSD downstream patches.Christos Zoulas2014-11-11
| | | | | | | | | | | | | | | | const fixes. -Wconversion fixes for the skeleton files. param namespace protection (add _ to inline function parameters). unused variable/code removal. rename warn to lwarn to avoid conflict with <err.h>. ctype.h function argument correction. merged the error functions lerrif and lerrsf -> lerr.
* Allow error reporting routines to accept varying number of arguments in ↵Mariusz Pluciński2014-07-25
| | | | modern style
* Removed deprecated 'register' storage class specifier.Yuri2014-07-25
| | | | clang-3.5.0 now complains about them: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
* Change output formats from octal to hexadecimalMariusz Pluciński2014-06-26
|
* move flex program sources into src/ directoryWill Estes2014-02-16
The *.[chly] sources are now in the src directory. This implies a bunch of changes in Makefile.am and friends to account for the new location. The .gitignore files are now more local to places where various object files and generated source files occur.