svn commit: r298241 - head/usr.bin/lex

Marcelo Araujo araujo at FreeBSD.org
Tue Apr 19 02:05:33 UTC 2016


Author: araujo
Date: Tue Apr 19 02:05:32 2016
New Revision: 298241
URL: https://svnweb.freebsd.org/changeset/base/298241

Log:
  Use NULL instead of 0 for pointers.
  
  realloc will return NULL in case it cannot allocate memory.
  
  MFC after:	2 weeks.

Modified:
  head/usr.bin/lex/initparse.c
  head/usr.bin/lex/initscan.c

Modified: head/usr.bin/lex/initparse.c
==============================================================================
--- head/usr.bin/lex/initparse.c	Tue Apr 19 02:00:48 2016	(r298240)
+++ head/usr.bin/lex/initparse.c	Tue Apr 19 02:05:32 2016	(r298241)
@@ -680,14 +680,14 @@ static int yygrowstack(YYSTACKDATA *data
 
     i = data->s_mark - data->s_base;
     newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
-    if (newss == 0)
+    if (newss == NULL)
         return -1;
 
     data->s_base = newss;
     data->s_mark = newss + i;
 
     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
-    if (newvs == 0)
+    if (newvs == NULL)
         return -1;
 
     data->l_base = newvs;
@@ -721,7 +721,7 @@ YYPARSE_DECL()
 #if YYDEBUG
     const char *yys;
 
-    if ((yys = getenv("YYDEBUG")) != 0)
+    if ((yys = getenv("YYDEBUG")) != NULL)
     {
         yyn = *yys;
         if (yyn >= '0' && yyn <= '9')

Modified: head/usr.bin/lex/initscan.c
==============================================================================
--- head/usr.bin/lex/initscan.c	Tue Apr 19 02:00:48 2016	(r298240)
+++ head/usr.bin/lex/initscan.c	Tue Apr 19 02:05:32 2016	(r298241)
@@ -3455,7 +3455,7 @@ YY_RULE_SETUP
  			 }
 nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
 
-			if ( (nmdefptr = ndlookup( nmstr )) == 0 )
+			if ( (nmdefptr = ndlookup( nmstr )) == NULL )
 				format_synerr(
 					_( "undefined definition {%s}" ),
 						nmstr );


More information about the svn-src-head mailing list