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>
* Make-lang.in (jvspec.o): Depend on system.h and gcc.h.
......
......@@ -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 == '$');
......
......@@ -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;
......
......@@ -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
}
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
}
......@@ -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;
}
......@@ -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++)
{
......
......@@ -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;
......
......@@ -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;
}
......@@ -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,
......
......@@ -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,
......
......@@ -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)
......
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