diff options
author | Jens Schweikhardt <schweikh@FreeBSD.org> | 2012-04-10 15:29:28 +0000 |
---|---|---|
committer | Jens Schweikhardt <schweikh@FreeBSD.org> | 2012-04-10 15:29:28 +0000 |
commit | da4b9d29719879e21142b5a0d9e64779cc2406d7 (patch) | |
tree | 77278524ab6021255a94413ba568213462551744 /usr.bin/lex | |
parent | efbebba22a0d477b142863fd7a40162c4e41eb9f (diff) | |
download | src-da4b9d29719879e21142b5a0d9e64779cc2406d7.tar.gz src-da4b9d29719879e21142b5a0d9e64779cc2406d7.zip |
Parenthesize args in yyless() and unput() replacement text
so they are safer when used with expressions.
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=234101
Diffstat (limited to 'usr.bin/lex')
-rw-r--r-- | usr.bin/lex/flex.skl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/lex/flex.skl b/usr.bin/lex/flex.skl index ac8eac2d9c37..ef5ee14354cf 100644 --- a/usr.bin/lex/flex.skl +++ b/usr.bin/lex/flex.skl @@ -122,7 +122,7 @@ extern FILE *yyin, *yyout; #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This + * into a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) @@ -143,12 +143,12 @@ extern FILE *yyin, *yyout; /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + yy_c_buf_p = yy_cp = yy_bp + (n) - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) +#define unput(c) yyunput( (c), yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want |