]> granicus.if.org Git - flex/commitdiff
Used NULL constant instead of plain integer for NULL pointer.
authorTobias Klauser <tklauser@distanz.ch>
Fri, 29 Jan 2016 13:31:54 +0000 (14:31 +0100)
committerWill Estes <westes575@gmail.com>
Sat, 30 Jan 2016 02:19:48 +0000 (21:19 -0500)
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.

src/flex.skl

index bb9685e6667a1d4afc0816f61e2422af2fbe96e7..8d9df7e5b141fb5ec2446adbe7d807f49bcf41f2 100644 (file)
@@ -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
@@ -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 */
 
@@ -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;
 
@@ -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(
@@ -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 )
@@ -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;
@@ -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;
 
@@ -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