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);
}
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)
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;
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,
{
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 */
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;
}
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. */