Commit c2e3db92 by Kaveh R. Ghazi Committed by Kaveh Ghazi

gjavah.c (get_field_name, [...]): Use xmalloc, not malloc.

	* 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.

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