OSDN Git Service

* gjavah.c (get_field_name, print_method_info, print_include,
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Sep 1999 15:45:15 +0000 (15:45 +0000)
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Sep 1999 15:45:15 +0000 (15:45 +0000)
add_namelet): Use xmalloc, not malloc.

* jcf-depend.c (add_entry): Likewise.  Use xstrdup, not strdup.
(munge): Use xrealloc, not realloc, trust xrealloc to handle a
NULL pointer.

* jcf-io.c (open_in_zip, find_class): Use xstrdup, not strdup.

* jcf-parse.c (jcf_out_of_synch, yyparse): Likewise.

* jcf-path.c (add_entry): Likewise.

* jcf.h (ALLOC, REALLOC): Use xmalloc/xrealloc, not malloc/realloc.

* jv-scan.c (xmalloc): Remove definition.

* jvgenmain.c (xmalloc): Likewise.

* jvspec.c (lang_specific_driver): Use xcalloc, not xmalloc/bzero.

* lex.c (java_store_unicode): Use xrealloc, not realloc.

* parse-scan.y: Use concat, not of xmalloc/assign/strcpy.  Use
concat, not xmalloc/sprintf.
(java_push_parser_context): Use xcalloc, not xmalloc/bzero.
(xstrdup): Remove definition.

* parse.y (duplicate_declaration_error_p,
constructor_circularity_msg, verify_constructor_circularity,
check_abstract_method_definitions, java_check_regular_methods,
java_check_abstract_methods, patch_method_invocation,
check_for_static_method_reference, patch_assignment, patch_binop,
patch_cast, array_constructor_check_entry, patch_return,
patch_conditional_expr): Use xstrdup, not strdup.

* zextract.c (ALLOC): Use xmalloc, not malloc.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29457 138bc75d-0d04-0410-961f-82ee72b054a4

16 files changed:
gcc/java/ChangeLog
gcc/java/gjavah.c
gcc/java/jcf-depend.c
gcc/java/jcf-io.c
gcc/java/jcf-parse.c
gcc/java/jcf-path.c
gcc/java/jcf.h
gcc/java/jv-scan.c
gcc/java/jvgenmain.c
gcc/java/jvspec.c
gcc/java/lex.c
gcc/java/parse-scan.c
gcc/java/parse-scan.y
gcc/java/parse.c
gcc/java/parse.y
gcc/java/zextract.c

index 8fd784f..debc540 100644 (file)
@@ -1,3 +1,43 @@
+1999-09-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * gjavah.c (get_field_name, print_method_info, print_include,
+       add_namelet): Use xmalloc, not malloc.
+
+       * jcf-depend.c (add_entry): Likewise.  Use xstrdup, not strdup.
+       (munge): Use xrealloc, not realloc, trust xrealloc to handle a
+       NULL pointer.
+
+       * jcf-io.c (open_in_zip, find_class): Use xstrdup, not strdup.
+
+       * jcf-parse.c (jcf_out_of_synch, yyparse): Likewise.
+       
+       * jcf-path.c (add_entry): Likewise.
+
+       * jcf.h (ALLOC, REALLOC): Use xmalloc/xrealloc, not malloc/realloc.
+
+       * jv-scan.c (xmalloc): Remove definition.
+
+       * jvgenmain.c (xmalloc): Likewise.
+
+       * jvspec.c (lang_specific_driver): Use xcalloc, not xmalloc/bzero.
+
+       * lex.c (java_store_unicode): Use xrealloc, not realloc.
+
+       * parse-scan.y: Use concat, not of xmalloc/assign/strcpy.  Use
+       concat, not xmalloc/sprintf.
+       (java_push_parser_context): Use xcalloc, not xmalloc/bzero.
+       (xstrdup): Remove definition.
+
+       * parse.y (duplicate_declaration_error_p,
+       constructor_circularity_msg, verify_constructor_circularity,
+       check_abstract_method_definitions, java_check_regular_methods,
+       java_check_abstract_methods, patch_method_invocation,
+       check_for_static_method_reference, patch_assignment, patch_binop,
+       patch_cast, array_constructor_check_entry, patch_return,
+       patch_conditional_expr): Use xstrdup, not strdup.
+
+       * zextract.c (ALLOC): Use xmalloc, not malloc.
+
 Sun Sep 12 23:30:09 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Make-lang.in (jvspec.o): Depend on system.h and gcc.h.
index 3ea5d0e..a29cb62 100644 (file)
@@ -385,7 +385,7 @@ get_field_name (jcf, name_index, flags)
          return NULL;
        }
 
-      override = (char *) malloc (length + 3);
+      override = xmalloc (length + 3);
       memcpy (override, name, length);
       strcpy (override + length, "__");
     }
@@ -568,8 +568,8 @@ DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags),
     {
       struct method_name *nn;
 
-      nn = (struct method_name *) malloc (sizeof (struct method_name));
-      nn->name = (char *) malloc (length);
+      nn = (struct method_name *) xmalloc (sizeof (struct method_name));
+      nn->name = (char *) xmalloc (length);
       memcpy (nn->name, str, length);
       nn->length = length;
       nn->next = method_name_list;
@@ -1072,8 +1072,8 @@ print_include (out, utf8, len)
        return;
     }
 
-  incl = (struct include *) malloc (sizeof (struct include));
-  incl->name = malloc (len + 1);
+  incl = (struct include *) xmalloc (sizeof (struct include));
+  incl->name = xmalloc (len + 1);
   strncpy (incl->name, utf8, len);
   incl->name[len] = '\0';
   incl->next = all_includes;
@@ -1157,8 +1157,8 @@ add_namelet (name, name_limit, parent)
 
   if (n == NULL)
     {
-      n = (struct namelet *) malloc (sizeof (struct namelet));
-      n->name = malloc (p - name + 1);
+      n = (struct namelet *) xmalloc (sizeof (struct namelet));
+      n->name = xmalloc (p - name + 1);
       strncpy (n->name, name, p - name);
       n->name[p - name] = '\0';
       n->is_class = (p == name_limit || *p == '$');
index 87b474c..ca0b246 100644 (file)
@@ -90,8 +90,8 @@ add_entry (entp, name)
     if (! strcmp (ent->file, name))
       return;
 
-  ent = (struct entry *) malloc (sizeof (struct entry));
-  ent->file = strdup (name);
+  ent = (struct entry *) xmalloc (sizeof (struct entry));
+  ent->file = xstrdup (name);
   ent->next = *entp;
   *entp = ent;
 }
@@ -177,10 +177,7 @@ munge (filename)
   if (buflen < len)
     {
       buflen = len;
-      if (buffer == NULL)
-       buffer = malloc (buflen);
-      else
-       buffer = realloc (buffer, buflen);
+      buffer = xrealloc (buffer, buflen);
     }
 
   dst = buffer;
index 765f150..2d43a51 100644 (file)
@@ -169,8 +169,8 @@ DEFUN(open_in_zip, (jcf, zipfile, zipmember, is_system),
          jcf->read_ptr = jcf->buffer;
          jcf->read_end = jcf->buffer_end;
          jcf->filbuf = jcf_unexpected_eof;
-         jcf->filename = strdup (zipfile);
-         jcf->classname = strdup (zipmember);
+         jcf->filename = xstrdup (zipfile);
+         jcf->classname = xstrdup (zipmember);
          jcf->zipd = (void *)zipd;
          if (lseek (zipf->fd, zipd->filestart, 0) < 0
              || read (zipf->fd, jcf->buffer, zipd->size) != zipd->size)
@@ -414,14 +414,14 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
     {
       JCF_ZERO (jcf);          /* JCF_FINISH relies on this */
       jcf->java_source = 1;
-      jcf->filename = (char *) strdup (buffer);
+      jcf->filename = xstrdup (buffer);
       close (fd);              /* We use STDIO for source file */
     }
   else
     buffer = open_class (buffer, jcf, fd, dep_file);
   jcf->classname = (char *) ALLOC (classname_length + 1);
   strncpy (jcf->classname, classname, classname_length + 1);
-  jcf->classname = (char *) strdup (classname);
+  jcf->classname = xstrdup (classname);
   return buffer;
 #endif
 }
index 0a5f5c3..f32072c 100644 (file)
@@ -449,7 +449,7 @@ void
 DEFUN(jcf_out_of_synch, (jcf),
       JCF *jcf)
 {
-  char *source = strdup (jcf->filename);
+  char *source = xstrdup (jcf->filename);
   int i = strlen (source);
 
   while (source[i] != '.')
@@ -778,7 +778,7 @@ int
 yyparse ()
 {
   int several_files = 0;
-  char *list = strdup (input_filename), *next;
+  char *list = xstrdup (input_filename), *next;
   tree node, current_file_list = NULL_TREE;
 
   do 
index c92cf14..056be31 100644 (file)
@@ -167,11 +167,11 @@ add_entry (entp, filename, is_system)
       strcpy (f2, filename);
       f2[len] = DIR_SEPARATOR;
       f2[len + 1] = '\0';
-      n->name = strdup (f2);
+      n->name = xstrdup (f2);
       ++len;
     }
   else
-    n->name = strdup (filename);
+    n->name = xstrdup (filename);
 
   if (len > longest_path)
     longest_path = len;
index bcf69b7..e19c80d 100644 (file)
@@ -53,8 +53,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #define JCF_u2 unsigned short
 #endif
 
-#define ALLOC (void*)malloc
-#define REALLOC (void*)realloc
+#define ALLOC xmalloc
+#define REALLOC xrealloc
 #ifndef FREE
 #define FREE(PTR) free(PTR)
 #endif
index d24b74c..21970d7 100644 (file)
@@ -200,14 +200,3 @@ gcc_obstack_init (obstack)
                  (void *(*) (long)) OBSTACK_CHUNK_ALLOC,
                  (void (*) (void *)) OBSTACK_CHUNK_FREE);
 }
-
-PTR
-xmalloc (size)
-  size_t size;
-{
-  register PTR val = (PTR) malloc (size);
-  if (val == 0)
-    fatal ("virtual memory exhausted");
-  return val;
-}
index 2631062..0704484 100644 (file)
@@ -127,17 +127,3 @@ main (int argc, const char **argv)
     }
   return 0;
 }
-
-PTR
-xmalloc (size)
-  size_t size;
-{
-  register PTR val = (PTR) malloc (size);
-  if (val == 0)
-    {
-      fprintf(stderr, "jvgenmain: virtual memory exhausted");
-      exit(FATAL_EXIT_CODE);
-    }
-  return val;
-}
index e3b3a23..7aa143c 100644 (file)
@@ -192,8 +192,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
   argv = *in_argv;
   added_libraries = *in_added_libraries;
 
-  args = (int *) xmalloc (argc * sizeof (int));
-  bzero ((char *) args, argc * sizeof (int));
+  args = (int *) xcalloc (argc, sizeof (int));
 
   for (i = 1; i < argc; i++)
     {
index ebb1f0b..814c896 100644 (file)
@@ -252,9 +252,9 @@ java_store_unicode (l, c, unicode_escape_p)
   if (l->size == l->max)
     {
       l->max += JAVA_LINE_MAX;
-      l->line = (unicode_t *)realloc (l->line, sizeof (unicode_t)*l->max);
-      l->unicode_escape_p = (char *)realloc (l->unicode_escape_p, 
-                                            sizeof (char)*l->max);
+      l->line = (unicode_t *) xrealloc (l->line, sizeof (unicode_t)*l->max);
+      l->unicode_escape_p = (char *) xrealloc (l->unicode_escape_p, 
+                                              sizeof (char)*l->max);
     }
   l->line [l->size] = c;
   l->unicode_escape_p [l->size++] = unicode_escape_p;
index 7090771..5c9721a 100644 (file)
@@ -405,40 +405,40 @@ static const short yyrhs[] = {   123,
 #if YYDEBUG != 0
 static const short yyrline[] = { 0,
    175,   180,   182,   183,   184,   185,   186,   190,   192,   195,
-   201,   206,   213,   215,   218,   222,   226,   230,   232,   239,
-   249,   251,   254,   258,   267,   272,   273,   274,   275,   276,
-   277,   278,   279,   282,   284,   287,   289,   292,   297,   299,
-   302,   306,   310,   312,   313,   319,   328,   339,   346,   346,
-   349,   351,   352,   355,   356,   359,   362,   366,   368,   371,
-   373,   376,   378,   379,   380,   383,   385,   386,   387,   391,
-   394,   398,   401,   404,   406,   409,   412,   416,   418,   422,
-   426,   429,   430,   432,   439,   446,   452,   455,   457,   465,
-   481,   497,   498,   501,   504,   508,   510,   511,   515,   517,
-   520,   530,   532,   535,   537,   543,   546,   550,   552,   553,
-   554,   558,   560,   563,   565,   569,   571,   576,   579,   581,
-   583,   587,   589,   592,   594,   597,   599,   602,   604,   605,
-   606,   609,   613,   618,   620,   621,   622,   625,   627,   631,
-   633,   636,   638,   641,   643,   644,   647,   651,   654,   658,
-   660,   661,   662,   663,   664,   667,   669,   670,   671,   672,
-   675,   677,   678,   679,   680,   681,   682,   683,   684,   685,
-   686,   689,   693,   698,   702,   708,   712,   714,   715,   716,
-   717,   718,   719,   722,   726,   730,   734,   738,   740,   741,
-   742,   745,   747,   750,   755,   757,   760,   762,   765,   769,
-   773,   777,   781,   785,   787,   790,   792,   795,   799,   802,
-   803,   804,   807,   808,   811,   813,   816,   818,   821,   823,
-   826,   828,   831,   835,   837,   840,   845,   847,   848,   851,
-   853,   856,   860,   865,   867,   870,   872,   873,   874,   875,
-   876,   877,   881,   883,   885,   889,   893,   895,   899,   900,
-   904,   905,   906,   907,   910,   913,   916,   918,   919,   922,
-   924,   925,   926,   929,   930,   933,   935,   938,   942,   944,
-   947,   949,   952,   955,   957,   958,   959,   960,   963,   966,
-   969,   971,   973,   974,   977,   981,   985,   987,   988,   989,
-   990,   993,   997,  1001,  1003,  1004,  1005,  1008,  1010,  1011,
-  1012,  1015,  1017,  1018,  1019,  1022,  1024,  1025,  1028,  1030,
-  1031,  1032,  1035,  1037,  1038,  1039,  1040,  1041,  1044,  1046,
-  1047,  1050,  1052,  1055,  1057,  1060,  1062,  1065,  1067,  1070,
-  1072,  1075,  1077,  1080,  1082,  1085,  1089,  1092,  1093,  1096,
-  1098,  1101,  1105
+   201,   206,   213,   215,   218,   222,   226,   230,   232,   236,
+   243,   245,   248,   252,   259,   264,   265,   266,   267,   268,
+   269,   270,   271,   274,   276,   279,   281,   284,   289,   291,
+   294,   298,   302,   304,   305,   311,   320,   331,   338,   338,
+   341,   343,   344,   347,   348,   351,   354,   358,   360,   363,
+   365,   368,   370,   371,   372,   375,   377,   378,   379,   383,
+   386,   390,   393,   396,   398,   401,   404,   408,   410,   414,
+   418,   421,   422,   424,   431,   438,   444,   447,   449,   455,
+   471,   487,   488,   491,   494,   498,   500,   501,   505,   507,
+   510,   520,   522,   525,   527,   533,   536,   540,   542,   543,
+   544,   548,   550,   553,   555,   559,   561,   566,   569,   571,
+   573,   577,   579,   582,   584,   587,   589,   592,   594,   595,
+   596,   599,   603,   608,   610,   611,   612,   615,   617,   621,
+   623,   626,   628,   631,   633,   634,   637,   641,   644,   648,
+   650,   651,   652,   653,   654,   657,   659,   660,   661,   662,
+   665,   667,   668,   669,   670,   671,   672,   673,   674,   675,
+   676,   679,   683,   688,   692,   698,   702,   704,   705,   706,
+   707,   708,   709,   712,   716,   720,   724,   728,   730,   731,
+   732,   735,   737,   740,   745,   747,   750,   752,   755,   759,
+   763,   767,   771,   775,   777,   780,   782,   785,   789,   792,
+   793,   794,   797,   798,   801,   803,   806,   808,   811,   813,
+   816,   818,   821,   825,   827,   830,   835,   837,   838,   841,
+   843,   846,   850,   855,   857,   860,   862,   863,   864,   865,
+   866,   867,   871,   873,   875,   879,   883,   885,   889,   890,
+   894,   895,   896,   897,   900,   903,   906,   908,   909,   912,
+   914,   915,   916,   919,   920,   923,   925,   928,   932,   934,
+   937,   939,   942,   945,   947,   948,   949,   950,   953,   956,
+   959,   961,   963,   964,   967,   971,   975,   977,   978,   979,
+   980,   983,   987,   991,   993,   994,   995,   998,  1000,  1001,
+  1002,  1005,  1007,  1008,  1009,  1012,  1014,  1015,  1018,  1020,
+  1021,  1022,  1025,  1027,  1028,  1029,  1030,  1031,  1034,  1036,
+  1037,  1040,  1042,  1045,  1047,  1050,  1052,  1055,  1057,  1060,
+  1062,  1065,  1067,  1070,  1072,  1075,  1079,  1082,  1083,  1086,
+  1088,  1091,  1095
 };
 #endif
 
@@ -1378,7 +1378,7 @@ static const short yycheck[] = {     3,
 #define YYPURE 1
 
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/cygnus/TBD-TBD/share/bison.simple"
+#line 3 "/usr/local/gnu/share/bison.simple"
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -1571,7 +1571,7 @@ __yy_memcpy (char *to, char *from, int count)
 #endif
 #endif
 \f
-#line 196 "/usr/cygnus/TBD-TBD/share/bison.simple"
+#line 196 "/usr/local/gnu/share/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -1899,35 +1899,27 @@ case 12:
 case 19:
 #line 233 "./parse-scan.y"
 {
-                 char *n = xmalloc (strlen (yyvsp[-2].node)+2);
-                 n [0] = '[';
-                 strcpy (n+1, yyvsp[-2].node);
-                 yyval.node = n;
+                 yyval.node = concat ("[", yyvsp[-2].node, NULL);
                ;
     break;}
 case 20:
-#line 240 "./parse-scan.y"
+#line 237 "./parse-scan.y"
 {      
-                 char *n = xmalloc (strlen (yyvsp[-2].node)+2);
-                 n [0] = '[';
-                 strcpy (n+1, yyvsp[-2].node);
-                 yyval.node = n;
+                 yyval.node = concat ("[", yyvsp[-2].node, NULL);
                ;
     break;}
 case 24:
-#line 260 "./parse-scan.y"
+#line 254 "./parse-scan.y"
 { 
-                 char *n = xmalloc (strlen (yyvsp[-2].node)+strlen (yyvsp[0].node)+2);
-                 sprintf (n, "%s.%s", yyvsp[-2].node, yyvsp[0].node);
-                 yyval.node = n;
+                 yyval.node = concat (yyvsp[-2].node, ".", yyvsp[0].node, NULL);
                ;
     break;}
 case 38:
-#line 294 "./parse-scan.y"
+#line 286 "./parse-scan.y"
 { package_name = yyvsp[-1].node; ;
     break;}
 case 46:
-#line 321 "./parse-scan.y"
+#line 313 "./parse-scan.y"
 { 
                  if (yyvsp[0].value == PUBLIC_TK)
                    modifier_value++;
@@ -1937,7 +1929,7 @@ case 46:
                ;
     break;}
 case 47:
-#line 329 "./parse-scan.y"
+#line 321 "./parse-scan.y"
 { 
                  if (yyvsp[0].value == PUBLIC_TK)
                    modifier_value++;
@@ -1947,57 +1939,57 @@ case 47:
                ;
     break;}
 case 48:
-#line 341 "./parse-scan.y"
+#line 333 "./parse-scan.y"
 { 
                  report_class_declaration(yyvsp[-2].node);
                  modifier_value = 0;
                 ;
     break;}
 case 50:
-#line 347 "./parse-scan.y"
+#line 339 "./parse-scan.y"
 { report_class_declaration(yyvsp[-2].node); ;
     break;}
 case 56:
-#line 361 "./parse-scan.y"
+#line 353 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 57:
-#line 363 "./parse-scan.y"
+#line 355 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 70:
-#line 393 "./parse-scan.y"
+#line 385 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 71:
-#line 395 "./parse-scan.y"
+#line 387 "./parse-scan.y"
 { modifier_value = 0; ;
     break;}
 case 76:
-#line 411 "./parse-scan.y"
+#line 403 "./parse-scan.y"
 { bracket_count = 0; USE_ABSORBER; ;
     break;}
 case 77:
-#line 413 "./parse-scan.y"
+#line 405 "./parse-scan.y"
 { ++bracket_count; ;
     break;}
 case 81:
-#line 428 "./parse-scan.y"
+#line 420 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 83:
-#line 431 "./parse-scan.y"
+#line 423 "./parse-scan.y"
 { modifier_value = 0; ;
     break;}
 case 84:
-#line 433 "./parse-scan.y"
+#line 425 "./parse-scan.y"
 { 
                   report_main_declaration (yyvsp[-1].declarator);
                  modifier_value = 0;
                ;
     break;}
 case 85:
-#line 441 "./parse-scan.y"
+#line 433 "./parse-scan.y"
 { 
                  struct method_declarator *d;
                  NEW_METHOD_DECLARATOR (d, yyvsp[-2].node, NULL);
@@ -2005,7 +1997,7 @@ case 85:
                ;
     break;}
 case 86:
-#line 447 "./parse-scan.y"
+#line 439 "./parse-scan.y"
 { 
                  struct method_declarator *d;
                  NEW_METHOD_DECLARATOR (d, yyvsp[-3].node, yyvsp[-1].node);
@@ -2013,15 +2005,13 @@ case 86:
                ;
     break;}
 case 89:
-#line 458 "./parse-scan.y"
+#line 450 "./parse-scan.y"
 {
-                 char *n = xmalloc (strlen (yyvsp[-2].node)+strlen(yyvsp[0].node)+2);
-                 sprintf (n, "%s,%s", yyvsp[-2].node, yyvsp[0].node);
-                 yyval.node = n;
+                 yyval.node = concat (yyvsp[-2].node, ",", yyvsp[0].node, NULL);
                ;
     break;}
 case 90:
-#line 467 "./parse-scan.y"
+#line 457 "./parse-scan.y"
 { 
                  USE_ABSORBER;
                  if (bracket_count)
@@ -2038,7 +2028,7 @@ case 90:
                ;
     break;}
 case 91:
-#line 482 "./parse-scan.y"
+#line 472 "./parse-scan.y"
 {
                  if (bracket_count)
                    {
@@ -2054,112 +2044,112 @@ case 91:
                ;
     break;}
 case 94:
-#line 503 "./parse-scan.y"
+#line 493 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 95:
-#line 505 "./parse-scan.y"
+#line 495 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 101:
-#line 522 "./parse-scan.y"
+#line 512 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 103:
-#line 533 "./parse-scan.y"
+#line 523 "./parse-scan.y"
 { modifier_value = 0; ;
     break;}
 case 105:
-#line 538 "./parse-scan.y"
+#line 528 "./parse-scan.y"
 { modifier_value = 0; ;
     break;}
 case 106:
-#line 545 "./parse-scan.y"
+#line 535 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 107:
-#line 547 "./parse-scan.y"
+#line 537 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 114:
-#line 564 "./parse-scan.y"
+#line 554 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 115:
-#line 566 "./parse-scan.y"
+#line 556 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 118:
-#line 578 "./parse-scan.y"
+#line 568 "./parse-scan.y"
 { report_class_declaration (yyvsp[-1].node); modifier_value = 0; ;
     break;}
 case 119:
-#line 580 "./parse-scan.y"
+#line 570 "./parse-scan.y"
 { report_class_declaration (yyvsp[-1].node); modifier_value = 0; ;
     break;}
 case 120:
-#line 582 "./parse-scan.y"
+#line 572 "./parse-scan.y"
 { report_class_declaration (yyvsp[-2].node); modifier_value = 0; ;
     break;}
 case 121:
-#line 584 "./parse-scan.y"
+#line 574 "./parse-scan.y"
 { report_class_declaration (yyvsp[-2].node); modifier_value = 0; ;
     break;}
 case 148:
-#line 653 "./parse-scan.y"
+#line 643 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 149:
-#line 655 "./parse-scan.y"
+#line 645 "./parse-scan.y"
 { modifier_value = 0; ;
     break;}
 case 173:
-#line 695 "./parse-scan.y"
+#line 685 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 226:
-#line 842 "./parse-scan.y"
+#line 832 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 243:
-#line 882 "./parse-scan.y"
+#line 872 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 244:
-#line 884 "./parse-scan.y"
+#line 874 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 246:
-#line 890 "./parse-scan.y"
+#line 880 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 255:
-#line 912 "./parse-scan.y"
+#line 902 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 273:
-#line 954 "./parse-scan.y"
+#line 944 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 274:
-#line 956 "./parse-scan.y"
+#line 946 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 279:
-#line 965 "./parse-scan.y"
+#line 955 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 282:
-#line 972 "./parse-scan.y"
+#line 962 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 case 337:
-#line 1091 "./parse-scan.y"
+#line 1081 "./parse-scan.y"
 { USE_ABSORBER; ;
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/cygnus/TBD-TBD/share/bison.simple"
+#line 498 "/usr/local/gnu/share/bison.simple"
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -2355,7 +2345,7 @@ yyerrhandle:
   yystate = yyn;
   goto yynewstate;
 }
-#line 1109 "./parse-scan.y"
+#line 1099 "./parse-scan.y"
 
 \f
 /* Create a new parser context */
@@ -2364,9 +2354,8 @@ void
 java_push_parser_context ()
 {
   struct parser_ctxt *new = 
-    (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
+    (struct parser_ctxt *) xcalloc (1, sizeof (struct parser_ctxt));
 
-  bzero ((PTR) new, sizeof (struct parser_ctxt));
   new->next = ctxp;
   ctxp = new;
 }  
@@ -2436,14 +2425,3 @@ yyerror (msg)
      const char *msg ATTRIBUTE_UNUSED;
 {
 }
-
-char *
-xstrdup (s)
-     const char *s;
-{
-  char *ret;
-
-  ret = xmalloc (strlen (s) + 1);
-  strcpy (ret, s);
-  return ret;
-}
index 61ab8d1..dee5dc2 100644 (file)
@@ -231,17 +231,11 @@ array_type:
        primitive_type OSB_TK CSB_TK
 |      name OSB_TK CSB_TK
                {
-                 char *n = xmalloc (strlen ($1)+2);
-                 n [0] = '[';
-                 strcpy (n+1, $1);
-                 $$ = n;
+                 $$ = concat ("[", $1, NULL);
                }
 |      array_type OSB_TK CSB_TK
                {       
-                 char *n = xmalloc (strlen ($1)+2);
-                 n [0] = '[';
-                 strcpy (n+1, $1);
-                 $$ = n;
+                 $$ = concat ("[", $1, NULL);
                }
 ;
 
@@ -258,9 +252,7 @@ simple_name:
 qualified_name:
        name DOT_TK identifier
                { 
-                 char *n = xmalloc (strlen ($1)+strlen ($3)+2);
-                 sprintf (n, "%s.%s", $1, $3);
-                 $$ = n;
+                 $$ = concat ($1, ".", $3, NULL);
                }
 ;
 
@@ -456,9 +448,7 @@ formal_parameter_list:
        formal_parameter
 |      formal_parameter_list C_TK formal_parameter
                {
-                 char *n = xmalloc (strlen ($1)+strlen($3)+2);
-                 sprintf (n, "%s,%s", $1, $3);
-                 $$ = n;
+                 $$ = concat ($1, ",", $3, NULL);
                }
 ;
 
@@ -1114,9 +1104,8 @@ void
 java_push_parser_context ()
 {
   struct parser_ctxt *new = 
-    (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
+    (struct parser_ctxt *) xcalloc (1, sizeof (struct parser_ctxt));
 
-  bzero ((PTR) new, sizeof (struct parser_ctxt));
   new->next = ctxp;
   ctxp = new;
 }  
@@ -1186,14 +1175,3 @@ yyerror (msg)
      const char *msg ATTRIBUTE_UNUSED;
 {
 }
-
-char *
-xstrdup (s)
-     const char *s;
-{
-  char *ret;
-
-  ret = xmalloc (strlen (s) + 1);
-  strcpy (ret, s);
-  return ret;
-}
index ed1efec..7d8571e 100644 (file)
@@ -5710,14 +5710,14 @@ duplicate_declaration_error_p (new_field_name, new_type, cl)
                          new_field_name);
   if (decl)
     {
-      char *t1 = strdup (purify_type_name
+      char *t1 = xstrdup (purify_type_name
                         ((TREE_CODE (new_type) == POINTER_TYPE 
                           && TREE_TYPE (new_type) == NULL_TREE) ?
                          IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
                          lang_printable_name (new_type, 1)));
       /* The type may not have been completed by the time we report
         the error */
-      char *t2 = strdup (purify_type_name
+      char *t2 = xstrdup (purify_type_name
                         ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE 
                           && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
                          IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
@@ -6191,7 +6191,7 @@ constructor_circularity_msg (from, to)
      tree from, to;
 {
   static char string [4096];
-  char *t = strdup (lang_printable_name (from, 0));
+  char *t = xstrdup (lang_printable_name (from, 0));
   sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
   free (t);
   return string;
@@ -6224,7 +6224,7 @@ verify_constructor_circularity (meth, current)
                  java_error_count--;
                }
            }
-         t = strdup (lang_printable_name (meth, 0));
+         t = xstrdup (lang_printable_name (meth, 0));
          parse_error_context (TREE_PURPOSE (c), 
                               "%s: recursive invocation of constructor `%s'",
                               constructor_circularity_msg (current, meth), t);
@@ -7227,7 +7227,7 @@ check_abstract_method_definitions (do_interface, class_decl, type)
         that CLASS can use. */
       if (!found)
        {
-         char *t = strdup (lang_printable_name 
+         char *t = xstrdup (lang_printable_name 
                            (TREE_TYPE (TREE_TYPE (method)), 0));
          tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
          tree saved_wfl = NULL_TREE;
@@ -7377,7 +7377,7 @@ java_check_regular_methods (class_decl)
         types. */
       if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
        {
-         char *t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)),
+         char *t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)),
                                                 0));
          parse_error_context 
            (method_wfl,
@@ -7568,7 +7568,7 @@ java_check_abstract_methods (interface_decl)
          char *t;
          tree saved_found_wfl = DECL_NAME (found);
          reset_method_name (found);
-         t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
+         t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
          parse_error_context 
            (method_wfl,
             "Method `%s' was defined with return type `%s' in class `%s'",
@@ -9758,7 +9758,7 @@ patch_method_invocation (patch, primary, where, is_static, ret_decl)
          list = lookup_method_invoke (0, wfl, type, identifier, args);
          if (list && !METHOD_STATIC (list))
            {
-             char *fct_name = strdup (lang_printable_name (list, 0));
+             char *fct_name = xstrdup (lang_printable_name (list, 0));
              parse_error_context 
                (identifier_wfl,
                 "Can't make static reference to method `%s %s' in class `%s'",
@@ -9904,7 +9904,7 @@ patch_method_invocation (patch, primary, where, is_static, ret_decl)
      return the call */
   if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0))
     {
-      char *fct_name = strdup (lang_printable_name (list, 0));
+      char *fct_name = xstrdup (lang_printable_name (list, 0));
       parse_error_context 
        (wfl, "Can't access %s method `%s %s.%s' from `%s'",
         java_accstring_lookup (get_access_flags_from_decl (list)),
@@ -9969,7 +9969,7 @@ check_for_static_method_reference (wfl, node, method, where, primary)
   if (METHOD_STATIC (current_function_decl) 
       && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
     {
-      char *fct_name = strdup (lang_printable_name (method, 0));
+      char *fct_name = xstrdup (lang_printable_name (method, 0));
       parse_error_context 
        (wfl, "Can't make static reference to method `%s %s' in class `%s'", 
         lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
@@ -11689,8 +11689,8 @@ patch_assignment (node, wfl_op1, wfl_op2)
   /* Explicit cast required. This is an error */
   if (!new_rhs)
     {
-      char *t1 = strdup (lang_printable_name (TREE_TYPE (rhs), 0));
-      char *t2 = strdup (lang_printable_name (lhs_type, 0));
+      char *t1 = xstrdup (lang_printable_name (TREE_TYPE (rhs), 0));
+      char *t2 = xstrdup (lang_printable_name (lhs_type, 0));
       tree wfl;
       char operation [32];     /* Max size known */
 
@@ -12425,7 +12425,7 @@ patch_binop (node, wfl_op1, wfl_op2)
         the type operand. This is a compile time error. */
       else
        {
-         char *t1 = strdup (lang_printable_name (op1_type, 0));
+         char *t1 = xstrdup (lang_printable_name (op1_type, 0));
          SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
          parse_error_context 
            (wfl_operator, "Impossible for `%s' to be instance of `%s'",
@@ -12534,7 +12534,7 @@ patch_binop (node, wfl_op1, wfl_op2)
       else
        {
          char *t1;
-         t1 = strdup (lang_printable_name (op1_type, 0));
+         t1 = xstrdup (lang_printable_name (op1_type, 0));
          parse_error_context 
            (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' "
             "to `%s'", operator_string (node), t1, 
@@ -13129,7 +13129,7 @@ patch_cast (node, wfl_operator)
     }
 
   /* Any other casts are proven incorrect at compile time */
-  t1 = strdup (lang_printable_name (op_type, 0));
+  t1 = xstrdup (lang_printable_name (op_type, 0));
   parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
                       t1, lang_printable_name (cast_type, 0));
   free (t1);
@@ -13470,7 +13470,7 @@ array_constructor_check_entry (type, entry)
       const char *msg = (!valid_cast_to_p (type_value, type) ?
                   "Can't" : "Explicit cast needed to");
       if (!array_type_string)
-       array_type_string = strdup (lang_printable_name (type, 1));
+       array_type_string = xstrdup (lang_printable_name (type, 1));
       parse_error_context 
        (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
         msg, lang_printable_name (type_value, 1), array_type_string);
@@ -13549,7 +13549,7 @@ patch_return (node)
 
       else if (!DECL_CONSTRUCTOR_P (meth))
        {
-         char *t = strdup (lang_printable_name (mtype, 0));
+         char *t = xstrdup (lang_printable_name (mtype, 0));
          parse_error_context (wfl_operator, 
                               "`return' with%s value from `%s %s'",
                               (error_found == 1 ? "" : "out"), 
@@ -14525,7 +14525,7 @@ patch_conditional_expr (node, wfl_cond, wfl_op1)
   /* If we don't have any resulting type, we're in trouble */
   if (!resulting_type)
     {
-      char *t = strdup (lang_printable_name (t1, 0));
+      char *t = xstrdup (lang_printable_name (t1, 0));
       SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
       parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
                           "convert `%s' to `%s'", t,
index a853534..59b2144 100644 (file)
@@ -3123,14 +3123,14 @@ duplicate_declaration_error_p (new_field_name, new_type, cl)
                          new_field_name);
   if (decl)
     {
-      char *t1 = strdup (purify_type_name
+      char *t1 = xstrdup (purify_type_name
                         ((TREE_CODE (new_type) == POINTER_TYPE 
                           && TREE_TYPE (new_type) == NULL_TREE) ?
                          IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
                          lang_printable_name (new_type, 1)));
       /* The type may not have been completed by the time we report
         the error */
-      char *t2 = strdup (purify_type_name
+      char *t2 = xstrdup (purify_type_name
                         ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE 
                           && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
                          IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
@@ -3604,7 +3604,7 @@ constructor_circularity_msg (from, to)
      tree from, to;
 {
   static char string [4096];
-  char *t = strdup (lang_printable_name (from, 0));
+  char *t = xstrdup (lang_printable_name (from, 0));
   sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
   free (t);
   return string;
@@ -3637,7 +3637,7 @@ verify_constructor_circularity (meth, current)
                  java_error_count--;
                }
            }
-         t = strdup (lang_printable_name (meth, 0));
+         t = xstrdup (lang_printable_name (meth, 0));
          parse_error_context (TREE_PURPOSE (c), 
                               "%s: recursive invocation of constructor `%s'",
                               constructor_circularity_msg (current, meth), t);
@@ -4640,7 +4640,7 @@ check_abstract_method_definitions (do_interface, class_decl, type)
         that CLASS can use. */
       if (!found)
        {
-         char *t = strdup (lang_printable_name 
+         char *t = xstrdup (lang_printable_name 
                            (TREE_TYPE (TREE_TYPE (method)), 0));
          tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
          tree saved_wfl = NULL_TREE;
@@ -4790,7 +4790,7 @@ java_check_regular_methods (class_decl)
         types. */
       if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
        {
-         char *t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)),
+         char *t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)),
                                                 0));
          parse_error_context 
            (method_wfl,
@@ -4981,7 +4981,7 @@ java_check_abstract_methods (interface_decl)
          char *t;
          tree saved_found_wfl = DECL_NAME (found);
          reset_method_name (found);
-         t = strdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
+         t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
          parse_error_context 
            (method_wfl,
             "Method `%s' was defined with return type `%s' in class `%s'",
@@ -7171,7 +7171,7 @@ patch_method_invocation (patch, primary, where, is_static, ret_decl)
          list = lookup_method_invoke (0, wfl, type, identifier, args);
          if (list && !METHOD_STATIC (list))
            {
-             char *fct_name = strdup (lang_printable_name (list, 0));
+             char *fct_name = xstrdup (lang_printable_name (list, 0));
              parse_error_context 
                (identifier_wfl,
                 "Can't make static reference to method `%s %s' in class `%s'",
@@ -7317,7 +7317,7 @@ patch_method_invocation (patch, primary, where, is_static, ret_decl)
      return the call */
   if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0))
     {
-      char *fct_name = strdup (lang_printable_name (list, 0));
+      char *fct_name = xstrdup (lang_printable_name (list, 0));
       parse_error_context 
        (wfl, "Can't access %s method `%s %s.%s' from `%s'",
         java_accstring_lookup (get_access_flags_from_decl (list)),
@@ -7382,7 +7382,7 @@ check_for_static_method_reference (wfl, node, method, where, primary)
   if (METHOD_STATIC (current_function_decl) 
       && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
     {
-      char *fct_name = strdup (lang_printable_name (method, 0));
+      char *fct_name = xstrdup (lang_printable_name (method, 0));
       parse_error_context 
        (wfl, "Can't make static reference to method `%s %s' in class `%s'", 
         lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
@@ -9102,8 +9102,8 @@ patch_assignment (node, wfl_op1, wfl_op2)
   /* Explicit cast required. This is an error */
   if (!new_rhs)
     {
-      char *t1 = strdup (lang_printable_name (TREE_TYPE (rhs), 0));
-      char *t2 = strdup (lang_printable_name (lhs_type, 0));
+      char *t1 = xstrdup (lang_printable_name (TREE_TYPE (rhs), 0));
+      char *t2 = xstrdup (lang_printable_name (lhs_type, 0));
       tree wfl;
       char operation [32];     /* Max size known */
 
@@ -9838,7 +9838,7 @@ patch_binop (node, wfl_op1, wfl_op2)
         the type operand. This is a compile time error. */
       else
        {
-         char *t1 = strdup (lang_printable_name (op1_type, 0));
+         char *t1 = xstrdup (lang_printable_name (op1_type, 0));
          SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
          parse_error_context 
            (wfl_operator, "Impossible for `%s' to be instance of `%s'",
@@ -9947,7 +9947,7 @@ patch_binop (node, wfl_op1, wfl_op2)
       else
        {
          char *t1;
-         t1 = strdup (lang_printable_name (op1_type, 0));
+         t1 = xstrdup (lang_printable_name (op1_type, 0));
          parse_error_context 
            (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' "
             "to `%s'", operator_string (node), t1, 
@@ -10542,7 +10542,7 @@ patch_cast (node, wfl_operator)
     }
 
   /* Any other casts are proven incorrect at compile time */
-  t1 = strdup (lang_printable_name (op_type, 0));
+  t1 = xstrdup (lang_printable_name (op_type, 0));
   parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
                       t1, lang_printable_name (cast_type, 0));
   free (t1);
@@ -10883,7 +10883,7 @@ array_constructor_check_entry (type, entry)
       const char *msg = (!valid_cast_to_p (type_value, type) ?
                   "Can't" : "Explicit cast needed to");
       if (!array_type_string)
-       array_type_string = strdup (lang_printable_name (type, 1));
+       array_type_string = xstrdup (lang_printable_name (type, 1));
       parse_error_context 
        (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
         msg, lang_printable_name (type_value, 1), array_type_string);
@@ -10962,7 +10962,7 @@ patch_return (node)
 
       else if (!DECL_CONSTRUCTOR_P (meth))
        {
-         char *t = strdup (lang_printable_name (mtype, 0));
+         char *t = xstrdup (lang_printable_name (mtype, 0));
          parse_error_context (wfl_operator, 
                               "`return' with%s value from `%s %s'",
                               (error_found == 1 ? "" : "out"), 
@@ -11938,7 +11938,7 @@ patch_conditional_expr (node, wfl_cond, wfl_op1)
   /* If we don't have any resulting type, we're in trouble */
   if (!resulting_type)
     {
-      char *t = strdup (lang_printable_name (t1, 0));
+      char *t = xstrdup (lang_printable_name (t1, 0));
       SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
       parse_error_context (wfl_operator, "Incompatible type for `?:'. Can't "
                           "convert `%s' to `%s'", t,
index 59fe486..d959c3b 100644 (file)
@@ -262,7 +262,7 @@ read_zip_archive (zipf)
     return -2;
   zipf->count = makeword(&buffer[TOTAL_ENTRIES_CENTRAL_DIR]);
   zipf->dir_size = makelong(&buffer[SIZE_CENTRAL_DIRECTORY]);
-#define ALLOC malloc
+#define ALLOC xmalloc
   /* Allocate 1 more to allow appending '\0' to last filename. */
   zipf->central_directory = ALLOC (zipf->dir_size+1);
   if (lseek (zipf->fd, -(zipf->dir_size+ECREC_SIZE+4), SEEK_CUR) < 0)