]> git.saurik.com Git - bison.git/blobdiff - data/push.c
Use YYFPRINTF instead of fprintf where appropriate. Reported by
[bison.git] / data / push.c
index 739ac2a7a689aee8494f844eb49434ab5ba0235f..ee9aa671432318e15ffedda98fbf5ce642845360 100644 (file)
@@ -160,7 +160,7 @@ b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],dnl '
    USER NAME SPACE" below.  */
 
 ]b4_identification
-b4_get_percent_code([[top]])[]dnl
+b4_percent_code_get([[top]])[]dnl
 m4_if(b4_prefix, [yy], [],
 [[/* Substitute the variable and function names.  */
 ]b4_pull_if([[#define yyparse         ]b4_prefix[parse
@@ -198,7 +198,7 @@ m4_if(b4_prefix, [yy], [],
 # define YYTOKEN_TABLE ]b4_token_table[
 #endif
 
-]b4_get_percent_code([[requires]])[]dnl
+]b4_percent_code_get([[requires]])[]dnl
 
 b4_token_enums_defines(b4_tokens)[
 
@@ -250,11 +250,11 @@ b4_c_function_decl([[yypstate_delete]], [[void]],
                    [[[yypstate *yyps]], [[yyps]]])[
 #endif
 ]])
-b4_get_percent_code([[provides]])[]dnl
+b4_percent_code_get([[provides]])[]dnl
 
 [/* Copy the second part of user declarations.  */
 ]b4_user_post_prologue
-b4_get_percent_code[]dnl
+b4_percent_code_get[]dnl
 
 [#ifdef short
 # undef short
@@ -750,12 +750,12 @@ do {                                                              \
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
                       &]b4_rhs_value(yynrhs, yyi + 1)[
                       ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
                       b4_user_args[);
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 
@@ -1091,7 +1091,14 @@ b4_push_if(
 ]b4_locations_if([[  YYLTYPE yylloc;
 ]])])[
   if (yyps == 0)
-    yyps_local = yypstate_new ();
+    {
+      yyps_local = yypstate_new ();
+      if (!yyps_local)
+        {
+          yyerror (]b4_yyerror_args[YY_("memory exhausted"));
+          return 2;
+        }
+    }
   else
     yyps_local = yyps;
   do {
@@ -1108,6 +1115,8 @@ b4_push_if(
 ]b4_c_function_def([[yypstate_new]], [[yypstate *]])[
 {
   yypstate *yyps = (yypstate *) malloc (sizeof *yyps);
+  if (!yyps)
+    return 0;
   yyps->yynew = 1;
   return yyps;
 }
@@ -1656,7 +1665,7 @@ b4_defines_if(
 b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],dnl '
   [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])
 
-b4_get_percent_code([[requires]])[]dnl
+b4_percent_code_get([[requires]])[]dnl
 
 b4_token_enums_defines(b4_tokens)
 
@@ -1714,6 +1723,6 @@ b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
                    [[b4_prefix[pstate *yyps]], [[yyps]]])[
 #endif
 ]])
-b4_get_percent_code([[provides]])[]dnl
+b4_percent_code_get([[provides]])[]dnl
 ])dnl b4_defines_if
 m4_divert_pop(0)