* symfile.c (obsavestring): Remove.
* ada-exp.y: Use obstack_copy0, not obsavestring.
* ada-lang.c: Use obstack_copy0, not obsavestring.
* coffread.c: Use obstack_copy0, not obsavestring.
* cp-namespace.c: Use obstack_copy0, not obsavestring.
* dbxread.c: Use obstack_copy0, not obsavestring.
* dwarf2read.c: Use obstack_copy0, not obsavestring.
* jit.c: Use obstack_copy0, not obsavestring.
* mdebugread.c: Use obstack_copy0, not obsavestring.
* psymtab.c: Use obstack_copy0, not obsavestring.
* stabsread.c: Use obstack_copy0, not obsavestring.
* xcoffread.c: Use obstack_copy0, not obsavestring.
+2013-01-21 Tom Tromey <tromey@redhat.com>
+
+ * symfile.h (obsavestring): Don't declare.
+ * symfile.c (obsavestring): Remove.
+ * ada-exp.y: Use obstack_copy0, not obsavestring.
+ * ada-lang.c: Use obstack_copy0, not obsavestring.
+ * coffread.c: Use obstack_copy0, not obsavestring.
+ * cp-namespace.c: Use obstack_copy0, not obsavestring.
+ * dbxread.c: Use obstack_copy0, not obsavestring.
+ * dwarf2read.c: Use obstack_copy0, not obsavestring.
+ * jit.c: Use obstack_copy0, not obsavestring.
+ * mdebugread.c: Use obstack_copy0, not obsavestring.
+ * psymtab.c: Use obstack_copy0, not obsavestring.
+ * stabsread.c: Use obstack_copy0, not obsavestring.
+ * xcoffread.c: Use obstack_copy0, not obsavestring.
+
2013-01-21 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (fixup_go_packaging): Save package name
if (orig_left_context == NULL)
orig_left_context = get_selected_block (NULL);
- name = obsavestring (renamed_entity, renamed_entity_len, &temp_parse_space);
+ name = obstack_copy0 (&temp_parse_space, renamed_entity, renamed_entity_len);
ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info);
if (sym_info.sym == NULL)
error (_("Could not find renamed variable: %s"), ada_decode (name));
end = renaming_expr + strlen (renaming_expr);
index_name =
- obsavestring (renaming_expr, end - renaming_expr,
- &temp_parse_space);
+ obstack_copy0 (&temp_parse_space, renaming_expr,
+ end - renaming_expr);
renaming_expr = end;
ada_lookup_encoded_symbol (index_name, NULL, VAR_DOMAIN,
obstack_alloc (&temp_parse_space, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
- SYMBOL_LINKAGE_NAME (sym) = obsavestring (name, len, &temp_parse_space);
+ SYMBOL_LINKAGE_NAME (sym) = obstack_copy0 (&temp_parse_space, name, len);
SYMBOL_LANGUAGE (sym) = language_ada;
write_exp_elt_opcode (OP_VAR_VALUE);
encoded_name = ada_encode (name0.ptr);
name_len = strlen (encoded_name);
- encoded_name = obsavestring (encoded_name, name_len, &temp_parse_space);
+ encoded_name = obstack_copy0 (&temp_parse_space, encoded_name, name_len);
for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1)
{
int tail_index;
{
struct objfile *objf = gsymbol->obj_section->objfile;
- *resultp = obsavestring (decoded, strlen (decoded),
- &objf->objfile_obstack);
+ *resultp = obstack_copy0 (&objf->objfile_obstack,
+ decoded, strlen (decoded));
}
/* Sometimes, we can't find a corresponding objfile, in which
case, we put the result on the heap. Since we only decode
list = new;
/* Save the data. */
- list->field.name = obsavestring (name, strlen (name),
- &objfile->objfile_obstack);
+ list->field.name = obstack_copy0 (&objfile->objfile_obstack,
+ name, strlen (name));
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
&sub_aux, objfile);
SET_FIELD_BITPOS (list->field, 8 * ms->c_value);
list = new;
/* Save the data. */
- list->field.name = obsavestring (name, strlen (name),
- &objfile->objfile_obstack);
+ list->field.name = obstack_copy0 (&objfile->objfile_obstack,
+ name, strlen (name));
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
&sub_aux, objfile);
SET_FIELD_BITPOS (list->field, ms->c_value);
memset (sym, 0, sizeof (struct symbol));
SYMBOL_SET_LINKAGE_NAME (sym,
- obsavestring (name, strlen (name),
- &objfile->objfile_obstack));
+ obstack_copy0 (&objfile->objfile_obstack,
+ name, strlen (name)));
SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE (sym) = ms->c_value;
* sizeof (*new->excludes))));
memset (new, 0, sizeof (*new));
- new->import_src = obsavestring (src, strlen (src), obstack);
- new->import_dest = obsavestring (dest, strlen (dest), obstack);
+ new->import_src = obstack_copy0 (obstack, src, strlen (src));
+ new->import_dest = obstack_copy0 (obstack, dest, strlen (dest));
if (alias != NULL)
- new->alias = obsavestring (alias, strlen (alias), obstack);
+ new->alias = obstack_copy0 (obstack, alias, strlen (alias));
if (declaration != NULL)
- new->declaration = obsavestring (declaration, strlen (declaration),
- obstack);
+ new->declaration = obstack_copy0 (obstack,
+ declaration, strlen (declaration));
memcpy (new->excludes, VEC_address (const_char_ptr, excludes),
VEC_length (const_char_ptr, excludes) * sizeof (*new->excludes));
if (processing_has_namespace_info)
{
block_set_scope
- (block, obsavestring (processing_current_prefix,
- strlen (processing_current_prefix),
- obstack),
+ (block, obstack_copy0 (obstack, processing_current_prefix,
+ strlen (processing_current_prefix)),
obstack);
}
else if (SYMBOL_DEMANGLED_NAME (symbol) != NULL)
unsigned int prefix_len = cp_entire_prefix_len (name);
block_set_scope (block,
- obsavestring (name, prefix_len, obstack),
+ obstack_copy0 (obstack, name, prefix_len),
obstack);
}
}
if (new_name != NULL)
{
sym_len = strlen (new_name);
- sym_name = obsavestring (new_name, sym_len,
- &objfile->objfile_obstack);
+ sym_name = obstack_copy0 (&objfile->objfile_obstack,
+ new_name, sym_len);
xfree (new_name);
}
xfree (name);
if (package_name != NULL)
{
struct objfile *objfile = cu->objfile;
- const char *saved_package_name = obsavestring (package_name,
- strlen (package_name),
- &objfile->objfile_obstack);
+ const char *saved_package_name = obstack_copy0 (&objfile->objfile_obstack,
+ package_name,
+ strlen (package_name));
struct type *type = init_type (TYPE_CODE_MODULE, 0, 0,
saved_package_name, objfile);
struct symbol *sym;
retval = canon;
if (need_copy)
- retval = obsavestring (retval, strlen (retval),
- &objfile->objfile_obstack);
+ retval = obstack_copy0 (&objfile->objfile_obstack, retval, strlen (retval));
do_cleanups (back_to);
return retval;
if (actual_class_name != NULL)
{
struct_pdi->name
- = obsavestring (actual_class_name,
- strlen (actual_class_name),
- &cu->objfile->objfile_obstack);
+ = obstack_copy0 (&cu->objfile->objfile_obstack,
+ actual_class_name,
+ strlen (actual_class_name));
xfree (actual_class_name);
}
break;
else
base = demangled;
- part_die->name = obsavestring (base, strlen (base),
- &cu->objfile->objfile_obstack);
+ part_die->name = obstack_copy0 (&cu->objfile->objfile_obstack,
+ base, strlen (base));
xfree (demangled);
}
}
&& actual_name[actual_name_len
- die_name_len - 1] == ':')
name =
- obsavestring (actual_name,
- actual_name_len - die_name_len - 2,
- &cu->objfile->objfile_obstack);
+ obstack_copy0 (&cu->objfile->objfile_obstack,
+ actual_name,
+ actual_name_len - die_name_len - 2);
}
}
xfree (actual_name);
if (base == NULL || base == DW_STRING (attr) || base[-1] != ':')
return "";
- return obsavestring (DW_STRING (attr), &base[-1] - DW_STRING (attr),
- &cu->objfile->objfile_obstack);
+ return obstack_copy0 (&cu->objfile->objfile_obstack,
+ DW_STRING (attr), &base[-1] - DW_STRING (attr));
}
/* Return the name of the namespace/class that DIE is defined within,
if (canon_name != NULL)
{
if (strcmp (canon_name, name) != 0)
- name = obsavestring (canon_name, strlen (canon_name),
- obstack);
+ name = obstack_copy0 (obstack, canon_name, strlen (canon_name));
xfree (canon_name);
}
}
char *base;
/* FIXME: we already did this for the partial symbol... */
- DW_STRING (attr) = obsavestring (demangled, strlen (demangled),
- &cu->objfile->objfile_obstack);
+ DW_STRING (attr) = obstack_copy0 (&cu->objfile->objfile_obstack,
+ demangled, strlen (demangled));
DW_STRING_IS_CANONICAL (attr) = 1;
xfree (demangled);
SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
SYMBOL_BLOCK_VALUE (block_name) = new_block;
- block_name->ginfo.name = obsavestring (gdb_block_iter->name,
- strlen (gdb_block_iter->name),
- &objfile->objfile_obstack);
+ block_name->ginfo.name = obstack_copy0 (&objfile->objfile_obstack,
+ gdb_block_iter->name,
+ strlen (gdb_block_iter->name));
BLOCK_FUNCTION (new_block) = block_name;
sizeof (struct symbol)));
memset (enum_sym, 0, sizeof (struct symbol));
SYMBOL_SET_LINKAGE_NAME
- (enum_sym, obsavestring (f->name, strlen (f->name),
- &mdebugread_objfile->objfile_obstack));
+ (enum_sym,
+ obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+ f->name, strlen (f->name)));
SYMBOL_CLASS (enum_sym) = LOC_CONST;
SYMBOL_TYPE (enum_sym) = t;
SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN;
else if (TYPE_TAG_NAME (tp) == NULL
|| strcmp (TYPE_TAG_NAME (tp), name) != 0)
TYPE_TAG_NAME (tp)
- = obsavestring (name, strlen (name),
- &mdebugread_objfile->objfile_obstack);
+ = obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+ name, strlen (name));
}
}
}
if (TYPE_NAME (tp) == NULL
|| strcmp (TYPE_NAME (tp), name) != 0)
- TYPE_NAME (tp) = obsavestring (name, strlen (name),
- &mdebugread_objfile->objfile_obstack);
+ TYPE_NAME (tp)
+ = obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+ name, strlen (name));
}
}
if (t->bt == btTypedef)
sizeof (struct partial_symtab));
memset (psymtab, 0, sizeof (struct partial_symtab));
- psymtab->filename = obsavestring (filename, strlen (filename),
- &objfile->objfile_obstack);
+ psymtab->filename = obstack_copy0 (&objfile->objfile_obstack,
+ filename, strlen (filename));
psymtab->symtab = NULL;
/* Prepend it to the psymtab list for the objfile it belongs to.
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
SYMBOL_SET_LINKAGE_NAME
- (sym, obsavestring (name, pp - name,
- &objfile->objfile_obstack));
+ (sym, obstack_copy0 (&objfile->objfile_obstack,
+ name, pp - name));
pp += 2;
if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
{
new_name = cp_canonicalize_string (name);
if (new_name != NULL)
{
- type_name = obsavestring (new_name, strlen (new_name),
- &objfile->objfile_obstack);
+ type_name = obstack_copy0 (&objfile->objfile_obstack,
+ new_name, strlen (new_name));
xfree (new_name);
}
}
dem_opname, 0);
if (ret)
new_fnlist->fn_fieldlist.name
- = obsavestring (dem_opname, strlen (dem_opname),
- &objfile->objfile_obstack);
+ = obstack_copy0 (&objfile->objfile_obstack,
+ dem_opname, strlen (dem_opname));
xfree (main_fn_name);
}
struct gdbarch *gdbarch = get_objfile_arch (objfile);
fip->list->field.name =
- obsavestring (*pp, p - *pp, &objfile->objfile_obstack);
+ obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
*pp = p + 1;
/* This means we have a visibility for a field coming. */
p = *pp;
while (*p != ':')
p++;
- name = obsavestring (*pp, p - *pp, &objfile->objfile_obstack);
+ name = obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
*pp = p + 1;
n = read_huge_number (pp, ',', &nbits, 0);
if (nbits != 0)
}
common_block = local_symbols;
common_block_i = local_symbols ? local_symbols->nsyms : 0;
- common_block_name = obsavestring (name, strlen (name),
- &objfile->objfile_obstack);
+ common_block_name = obstack_copy0 (&objfile->objfile_obstack,
+ name, strlen (name));
}
/* Process a N_ECOMM symbol. */
int auto_solib_add = 1;
\f
-/* Make a null terminated copy of the string at PTR with SIZE characters in
- the obstack pointed to by OBSTACKP . Returns the address of the copy.
- Note that the string at PTR does not have to be null terminated, I.e. it
- may be part of a larger string and we are only saving a substring. */
-
-char *
-obsavestring (const char *ptr, int size, struct obstack *obstackp)
-{
- char *p = (char *) obstack_alloc (obstackp, size + 1);
- /* Open-coded memcpy--saves function call time. These strings are usually
- short. FIXME: Is this really still true with a compiler that can
- inline memcpy? */
- {
- const char *p1 = ptr;
- char *p2 = p;
- const char *end = ptr + size;
-
- while (p1 != end)
- *p2++ = *p1++;
- }
- p[size] = 0;
- return p;
-}
-
/* 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 *)
extern void free_section_addr_info (struct section_addr_info *);
-/* Make a copy of the string at PTR with SIZE characters in the symbol
- obstack (and add a null character at the end in the copy). Returns
- the address of the copy. */
-
-extern char *obsavestring (const char *, int, struct obstack *);
-
/* 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 *)
#define SYMNAME_ALLOC(NAME, ALLOCED) \
- ((ALLOCED) ? (NAME) : obsavestring ((NAME), strlen (NAME), \
- &objfile->objfile_obstack))
+ ((ALLOCED) ? (NAME) : obstack_copy0 (&objfile->objfile_obstack, \
+ (NAME), strlen (NAME)))
/* process one xcoff symbol. */