Skip to content

Commit

Permalink
Used NULL constant instead of plain integer for NULL pointer.
Browse files Browse the repository at this point in the history
The sparse static checker warns about using plain integer 0 as NULL
pointers in the generated lexer code. Fix this by using NULL
consistently for pointers.
  • Loading branch information
tklauser authored and westes committed Jan 30, 2016
1 parent a7ff1b2 commit 1cc6c87
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/flex.skl
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
/* Stack of input buffers. */
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
%endif
%ok-for-header
%endif
Expand Down Expand Up @@ -652,7 +652,7 @@ static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
yy_size_t yyleng;

/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static char *yy_c_buf_p = NULL;
static int yy_init = 0; /* whether we need to initialize */
static int yy_start = 0; /* start state number */

Expand Down Expand Up @@ -1554,7 +1554,7 @@ void yyFlexLexer::ctor_common()
yy_start_stack_ptr = yy_start_stack_depth = 0;
yy_start_stack = NULL;

yy_buffer_stack = 0;
yy_buffer_stack = NULL;
yy_buffer_stack_top = 0;
yy_buffer_stack_max = 0;

Expand Down Expand Up @@ -1736,7 +1736,7 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
b->yy_ch_buf = NULL;

if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
Expand Down Expand Up @@ -2391,7 +2391,7 @@ YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
return NULL;

b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
if ( ! b )
Expand All @@ -2400,7 +2400,7 @@ YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_input_file = NULL;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
Expand Down Expand Up @@ -2936,10 +2936,10 @@ m4_ifdef( [[M4_YY_USE_LINENO]],
yylineno = 1;
]])
]])
YY_G(yy_buffer_stack) = 0;
YY_G(yy_buffer_stack) = NULL;
YY_G(yy_buffer_stack_top) = 0;
YY_G(yy_buffer_stack_max) = 0;
YY_G(yy_c_buf_p) = (char *) 0;
YY_G(yy_c_buf_p) = NULL;
YY_G(yy_init) = 0;
YY_G(yy_start) = 0;

Expand Down Expand Up @@ -2970,8 +2970,8 @@ m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
yyin = stdin;
yyout = stdout;
#else
yyin = (FILE *) 0;
yyout = (FILE *) 0;
yyin = NULL;
yyout = NULL;
#endif
/* For future reference: Set errno on error, since we are called by
Expand Down

0 comments on commit 1cc6c87

Please sign in to comment.