diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-05-08 04:58:45 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-05-08 04:58:45 +0000 |
commit | 48cb83fdd097716c0f21511e0e5b475bb1f2aa41 (patch) | |
tree | 4c4ba04451d6ee4b092fede123544b4d0238fa45 /gdb/symfile.c | |
parent | 8ef4892fb60c863e960a860b4adc40ad79215294 (diff) | |
download | gdb-48cb83fdd097716c0f21511e0e5b475bb1f2aa41.zip gdb-48cb83fdd097716c0f21511e0e5b475bb1f2aa41.tar.gz gdb-48cb83fdd097716c0f21511e0e5b475bb1f2aa41.tar.bz2 |
gdb/
* 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.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 32 |
1 files changed, 21 insertions, 11 deletions
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. */ |