diff options
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 2 | ||||
-rw-r--r-- | gdb/mdebugread.c | 4 | ||||
-rw-r--r-- | gdb/stabsread.c | 36 | ||||
-rw-r--r-- | gdb/symfile.c | 32 | ||||
-rw-r--r-- | gdb/symfile.h | 8 |
6 files changed, 57 insertions, 36 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 32e9cd8..64211b6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2010-05-08 Jan Kratochvil <jan.kratochvil@redhat.com> + + * dwarf2read.c (typename_concat): Use (char *) NULL terminated stdarg + list for the obconcat call. + * mdebugread.c (parse_symbol): Likewise. + * stabsread.c (define_symbol, read_member_functions, read_cpp_abbrev): + Likewise. + * symfile.c (obconcat): Replace the s1, s2 and s3 parameters by `...'. + New variable ap. Remove variables len and val. + * symfile.h (obconcat): Likewise for the prototype. + 2010-05-07 Michael Snyder <msnyder@vmware.com> * python/python.c (execute_gdb_command): Remove unused variables. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index fbd8f76..0d4f61a 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -9200,7 +9200,7 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix, else { /* We have an obstack. */ - return obconcat (obs, prefix, sep, suffix); + return obconcat (obs, prefix, sep, suffix, (char *) NULL); } } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 20bf3a3..5fb9c49 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -998,8 +998,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (sh->iss == 0 || name[0] == '.' || name[0] == '\0') TYPE_TAG_NAME (t) = NULL; else - TYPE_TAG_NAME (t) = obconcat (¤t_objfile->objfile_obstack, - "", "", name); + TYPE_TAG_NAME (t) = obconcat (¤t_objfile->objfile_obstack, name, + (char *) NULL); TYPE_CODE (t) = type_code; TYPE_LENGTH (t) = sh->value; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 541e7d0..e1d4f38 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1279,9 +1279,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_VALUE (struct_sym) = valu; SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN; if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) - TYPE_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->objfile_obstack, "", "", - SYMBOL_LINKAGE_NAME (sym)); + TYPE_NAME (SYMBOL_TYPE (sym)) = obconcat (&objfile->objfile_obstack, + SYMBOL_LINKAGE_NAME (sym), + (char *) NULL); add_symbol_to_list (struct_sym, &file_symbols); } @@ -1306,9 +1306,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0) - TYPE_TAG_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->objfile_obstack, "", "", - SYMBOL_LINKAGE_NAME (sym)); + TYPE_TAG_NAME (SYMBOL_TYPE (sym)) = obconcat (&objfile->objfile_obstack, + SYMBOL_LINKAGE_NAME (sym), + (char *) NULL); add_symbol_to_list (sym, &file_symbols); if (synonym) @@ -1321,9 +1321,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_VALUE (typedef_sym) = valu; SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) - TYPE_NAME (SYMBOL_TYPE (sym)) - = obconcat (&objfile->objfile_obstack, "", "", - SYMBOL_LINKAGE_NAME (sym)); + TYPE_NAME (SYMBOL_TYPE (sym)) = obconcat (&objfile->objfile_obstack, + SYMBOL_LINKAGE_NAME (sym), + (char *) NULL); add_symbol_to_list (typedef_sym, &file_symbols); } break; @@ -2609,8 +2609,8 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, make_cleanup (xfree, destr_fnlist); memset (destr_fnlist, 0, sizeof (struct next_fnfieldlist)); destr_fnlist->fn_fieldlist.name - = obconcat (&objfile->objfile_obstack, "", "~", - new_fnlist->fn_fieldlist.name); + = obconcat (&objfile->objfile_obstack, "~", + new_fnlist->fn_fieldlist.name, (char *) NULL); destr_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) obstack_alloc (&objfile->objfile_obstack, @@ -2747,8 +2747,8 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, { name = ""; } - fip->list->field.name = - obconcat (&objfile->objfile_obstack, vptr_name, name, ""); + fip->list->field.name = obconcat (&objfile->objfile_obstack, + vptr_name, name, (char *) NULL); break; case 'b': /* $vb -- a virtual bsomethingorother */ @@ -2760,15 +2760,15 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, symnum); name = "FOO"; } - fip->list->field.name = - obconcat (&objfile->objfile_obstack, vb_name, name, ""); + fip->list->field.name = obconcat (&objfile->objfile_obstack, vb_name, + name, (char *) NULL); break; default: invalid_cpp_abbrev_complaint (*pp); - fip->list->field.name = - obconcat (&objfile->objfile_obstack, - "INVALID_CPLUSPLUS_ABBREV", "", ""); + fip->list->field.name = obconcat (&objfile->objfile_obstack, + "INVALID_CPLUSPLUS_ABBREV", + (char *) NULL); break; } diff --git a/gdb/symfile.c b/gdb/symfile.c index 31109ab..883c669 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -212,19 +212,29 @@ obsavestring (const char *ptr, int size, struct obstack *obstackp) return p; } -/* Concatenate strings S1, S2 and S3; return the new string. Space is found - in the obstack pointed to by OBSTACKP. */ +/* Concatenate NULL terminated variable argument list of `const char *' strings; + return the new string. Space is found in the OBSTACKP. Argument list must + be terminated by a sentinel expression `(char *) NULL'. */ char * -obconcat (struct obstack *obstackp, const char *s1, const char *s2, - const char *s3) -{ - int len = strlen (s1) + strlen (s2) + strlen (s3) + 1; - char *val = (char *) obstack_alloc (obstackp, len); - strcpy (val, s1); - strcat (val, s2); - strcat (val, s3); - return val; +obconcat (struct obstack *obstackp, ...) +{ + va_list ap; + + va_start (ap, obstackp); + for (;;) + { + const char *s = va_arg (ap, const char *); + + if (s == NULL) + break; + + obstack_grow_str (obstackp, s); + } + va_end (ap); + obstack_1grow (obstackp, 0); + + return obstack_finish (obstackp); } /* True if we are reading a symbol table. */ diff --git a/gdb/symfile.h b/gdb/symfile.h index a8effda..d53c465 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -458,11 +458,11 @@ extern struct partial_symtab *start_psymtab_common (struct objfile *, extern char *obsavestring (const char *, int, struct obstack *); -/* Concatenate strings S1, S2 and S3; return the new string. Space is - found in the OBSTACKP */ +/* Concatenate NULL terminated variable argument list of `const char *' strings; + return the new string. Space is found in the OBSTACKP. Argument list must + be terminated by a sentinel expression `(char *) NULL'. */ -extern char *obconcat (struct obstack *obstackp, const char *, const char *, - const char *); +extern char *obconcat (struct obstack *obstackp, ...) ATTRIBUTE_SENTINEL; /* Variables */ |