yacc: Use NULL instead of 0 for pointers

Note araujo tried to fix it in r298241 but he only touched generated
files for bootstrap.  This commit properly fixes the problem.
This commit is contained in:
Jung-uk Kim 2021-02-11 18:40:00 -05:00
parent 34e67bb597
commit 80f3143274
4 changed files with 14 additions and 14 deletions

View file

@ -326,14 +326,14 @@ const char *const body_1[] =
"",
" i = (int) (data->s_mark - data->s_base);",
" newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));",
" if (newss == 0)",
" if (newss == NULL)",
" return YYENOMEM;",
"",
" 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 YYENOMEM;",
"",
" data->l_base = newvs;",
@ -341,7 +341,7 @@ const char *const body_1[] =
"",
"#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
" newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));",
" if (newps == 0)",
" if (newps == NULL)",
" return YYENOMEM;",
"",
" data->p_base = newps;",
@ -446,7 +446,7 @@ const char *const body_2[] =
"#if YYDEBUG",
" const char *yys;",
"",
" if ((yys = getenv(\"YYDEBUG\")) != 0)",
" if ((yys = getenv(\"YYDEBUG\")) != NULL)",
" {",
" yyn = *yys;",
" if (yyn >= '0' && yyn <= '9')",

View file

@ -271,14 +271,14 @@ static int yygrowstack(YYSTACKDATA *data)
i = (int) (data->s_mark - data->s_base);
newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
if (newss == NULL)
return YYENOMEM;
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 YYENOMEM;
data->l_base = newvs;
@ -286,7 +286,7 @@ static int yygrowstack(YYSTACKDATA *data)
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
if (newps == 0)
if (newps == NULL)
return YYENOMEM;
data->p_base = newps;
@ -381,7 +381,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')

View file

@ -160,14 +160,14 @@ const char *const body_1[] =
"",
" i = (int) (data->s_mark - data->s_base);",
" newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));",
" if (newss == 0)",
" if (newss == NULL)",
" return YYENOMEM;",
"",
" 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 YYENOMEM;",
"",
" data->l_base = newvs;",
@ -206,7 +206,7 @@ const char *const body_2[] =
"#if YYDEBUG",
" const char *yys;",
"",
" if ((yys = getenv(\"YYDEBUG\")) != 0)",
" if ((yys = getenv(\"YYDEBUG\")) != NULL)",
" {",
" yyn = *yys;",
" if (yyn >= '0' && yyn <= '9')",

View file

@ -119,14 +119,14 @@ static int yygrowstack(YYSTACKDATA *data)
i = (int) (data->s_mark - data->s_base);
newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
if (newss == NULL)
return YYENOMEM;
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 YYENOMEM;
data->l_base = newvs;
@ -161,7 +161,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')