diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 1999-09-16 15:45:15 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 1999-09-16 15:45:15 +0000 |
commit | c2e3db9254f058830d2ef7106d74d20a7fa56c75 (patch) | |
tree | 16053d5d21a42fd79947636788b0a774368e0381 /gcc/java/parse-scan.y | |
parent | 7ca3e7133c3d125d31155affbddfb40ea29a0b9d (diff) | |
download | gcc-c2e3db9254f058830d2ef7106d74d20a7fa56c75.zip gcc-c2e3db9254f058830d2ef7106d74d20a7fa56c75.tar.gz gcc-c2e3db9254f058830d2ef7106d74d20a7fa56c75.tar.bz2 |
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
Diffstat (limited to 'gcc/java/parse-scan.y')
-rw-r--r-- | gcc/java/parse-scan.y | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/gcc/java/parse-scan.y b/gcc/java/parse-scan.y index 61ab8d1..dee5dc2d 100644 --- a/gcc/java/parse-scan.y +++ b/gcc/java/parse-scan.y @@ -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; -} |