else
name = dollar;
- sname = concat (base_name, name, NULL);
+ sname = notes_concat (base_name, name, NULL);
return sname;
}
{
struct seh_seg_list *r;
- r = (struct seh_seg_list *)
- xmalloc (sizeof (struct seh_seg_list) + strlen (name));
+ r = notes_alloc (sizeof (struct seh_seg_list) + strlen (name));
r->seg = seg;
r->subseg = subseg;
r->seg_name = name;
seh_hash_insert (item->seg_name, item);
}
else
- free (name);
+ notes_free (name);
return item;
}
{
size_t len = strlen (buffer);
- info = (struct alpha_reloc_tag *)
- xcalloc (sizeof (struct alpha_reloc_tag) + len, 1);
+ info = notes_calloc (sizeof (struct alpha_reloc_tag) + len, 1);
info->segment = now_seg;
info->sequence = sequence;
if ((slash = strchr (name, '/')) != NULL)
{
- char *p = XNEWVEC (char, strlen (name));
+ size_t len = strlen (name);
+ char *p = notes_alloc (len);
+ size_t len1 = slash - name;
- memcpy (p, name, slash - name);
- strcpy (p + (slash - name), slash + 1);
+ memcpy (p, name, len1);
+ memcpy (p + len1, slash + 1, len - len1);
(void) str_hash_insert (alpha_opcode_hash, p, &alpha_opcodes[i], 0);
/* Ignore failures -- the opcode table does duplicate some
unsigned int nopcodes;
struct h8_opcode *p, *p1;
struct h8_instruction *pi;
- char prev_buffer[100];
int idx = 0;
if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, default_mach))
as_warn (_("could not set architecture and machine"));
opcode_hash_control = str_htab_create ();
- prev_buffer[0] = 0;
nopcodes = sizeof (h8_opcodes) / sizeof (struct h8_opcode);
break;
/* Strip off any . part when inserting the opcode and only enter
unique codes into the hash table. */
- dst = buffer = XNEWVEC (char, strlen (src) + 1);
+ dst = buffer = notes_alloc (strlen (src) + 1);
while (*src)
{
if (*src == '.')
if (cmplen == 0)
cmplen = len;
str_hash_insert (opcode_hash_control, buffer, pi, 0);
- strcpy (prev_buffer, buffer);
idx++;
for (p = p1; p->name; p++)
}
if (!*drpp)
- {
- *drpp = XOBNEW (¬es, struct dynreg);
- memset (*drpp, 0, sizeof (*dr));
- }
+ *drpp = notes_calloc (1, sizeof (**drpp));
- name = XOBNEWVEC (¬es, char, len + 1);
- memcpy (name, start, len);
- name[len] = '\0';
+ name = notes_memdup (start, len, len + 1);
dr = *drpp;
dr->name = name;
if (str_hash_insert (md.dynreg_hash, name, dr, 0) != NULL)
{
as_bad (_("Attempt to redefine register set `%s'"), name);
- obstack_free (¬es, name);
goto err;
}
type = 'c';
else if (strcmp (form, "imply") == 0)
type = 'i';
- obstack_free (¬es, form);
+ notes_free (form);
}
else if (*input_line_pointer == '@')
{
}
/* Make a copy of name string. */
- len = strlen (name) + 1;
- obstack_grow (¬es, name, len);
- name = obstack_finish (¬es);
+ name = notes_strdup (name);
if (section)
{
if (strcmp (h->name, name))
as_bad (_("`%s' is already the alias of %s `%s'"),
alias, kind, h->name);
- obstack_free (¬es, name);
- obstack_free (¬es, alias);
+ notes_free (alias);
goto out;
}
{
if (strcmp (a, alias))
as_bad (_("%s `%s' already has an alias `%s'"), kind, name, a);
- obstack_free (¬es, name);
- obstack_free (¬es, alias);
+ notes_free (alias);
goto out;
}
- h = XNEW (struct alias);
+ h = notes_alloc (sizeof (*h));
h->file = as_where (&h->line);
h->name = name;
relocs = str_hash_find (nds32_hint_hash, name);
if (relocs == NULL)
{
- relocs = XNEW (struct nds32_relocs_pattern);
- memset (relocs, 0, sizeof (struct nds32_relocs_pattern));
+ relocs = notes_calloc (1, sizeof (*relocs));
str_hash_insert (nds32_hint_hash, name, relocs, 0);
}
else
{
while (relocs->next)
- relocs=relocs->next;
- relocs->next = XNEW (struct nds32_relocs_pattern);
+ relocs = relocs->next;
+ relocs->next = notes_calloc (1, sizeof (*relocs));
relocs = relocs->next;
- memset (relocs, 0, sizeof (struct nds32_relocs_pattern));
}
- relocs->next = NULL;
*input_line_pointer = saved_char;
ignore_rest_of_line ();
if (!need_enrty)
return;
- entry = XNEW (struct riscv_csr_extra);
+ entry = notes_alloc (sizeof (*entry));
entry->csr_class = class;
entry->address = address;
entry->define_version = define_version;
static void
s3_insert_reg (const struct s3_reg_entry *r, htab_t htab)
{
- int i = 0;
- int len = strlen (r->name) + 2;
- char *buf = XNEWVEC (char, len);
- char *buf2 = XNEWVEC (char, len);
+ char *buf = notes_strdup (r->name);
+ char *p;
- strcpy (buf + i, r->name);
- for (i = 0; buf[i]; i++)
- {
- buf2[i] = TOUPPER (buf[i]);
- }
- buf2[i] = '\0';
+ for (p = buf; *p; p++)
+ *p = TOUPPER (*p);
+ str_hash_insert (htab, r->name, r, 0);
str_hash_insert (htab, buf, r, 0);
- str_hash_insert (htab, buf2, r, 0);
}
static void
s3_build_score_ops_hsh (void)
{
unsigned int i;
- static struct obstack insn_obstack;
- obstack_begin (&insn_obstack, 4000);
for (i = 0; i < sizeof (s3_score_insns) / sizeof (struct s3_asm_opcode); i++)
{
const struct s3_asm_opcode *insn = s3_score_insns + i;
- size_t len = strlen (insn->template_name);
+ size_t len = strlen (insn->template_name) + 1;
struct s3_asm_opcode *new_opcode;
char *template_name;
- new_opcode = (struct s3_asm_opcode *)
- obstack_alloc (&insn_obstack, sizeof (struct s3_asm_opcode));
- template_name = (char *) obstack_alloc (& insn_obstack, len + 1);
- strcpy (template_name, insn->template_name);
+ new_opcode = notes_alloc (sizeof (*new_opcode));
+ template_name = notes_memdup (insn->template_name, len, len);
+
new_opcode->template_name = template_name;
new_opcode->parms = insn->parms;
new_opcode->value = insn->value;
s3_build_dependency_insn_hsh (void)
{
unsigned int i;
- static struct obstack dependency_obstack;
- obstack_begin (&dependency_obstack, 4000);
for (i = 0; i < sizeof (s3_insn_to_dependency_table) / sizeof (s3_insn_to_dependency_table[0]); i++)
{
const struct s3_insn_to_dependency *tmp = s3_insn_to_dependency_table + i;
- size_t len = strlen (tmp->insn_name);
+ size_t len = strlen (tmp->insn_name) + 1;
struct s3_insn_to_dependency *new_i2n;
char *buf;
- new_i2n = (struct s3_insn_to_dependency *)
- obstack_alloc (&dependency_obstack,
- sizeof (struct s3_insn_to_dependency));
- buf = (char *) obstack_alloc (&dependency_obstack, len + 1);
+ new_i2n = notes_alloc (sizeof (*new_i2n));
+ buf = notes_memdup (tmp->insn_name, len, len);
- strcpy (buf, tmp->insn_name);
new_i2n->insn_name = buf;
new_i2n->type = tmp->type;
str_hash_insert (s3_dependency_insn_hsh, new_i2n->insn_name, new_i2n, 0);
s7_build_score_ops_hsh (void)
{
unsigned int i;
- static struct obstack insn_obstack;
- obstack_begin (&insn_obstack, 4000);
for (i = 0; i < sizeof (s7_score_insns) / sizeof (struct s7_asm_opcode); i++)
{
const struct s7_asm_opcode *insn = s7_score_insns + i;
- size_t len = strlen (insn->template_name);
+ size_t len = strlen (insn->template_name) + 1;
struct s7_asm_opcode *new_opcode;
char *template_name;
- new_opcode = (struct s7_asm_opcode *)
- obstack_alloc (&insn_obstack, sizeof (struct s7_asm_opcode));
- template_name = (char *) obstack_alloc (&insn_obstack, len + 1);
- strcpy (template_name, insn->template_name);
+ new_opcode = notes_alloc (sizeof (*new_opcode));
+ template_name = notes_memdup (insn->template_name, len, len);
+
new_opcode->template_name = template_name;
new_opcode->parms = insn->parms;
new_opcode->value = insn->value;
s7_build_dependency_insn_hsh (void)
{
unsigned int i;
- static struct obstack dependency_obstack;
- obstack_begin (&dependency_obstack, 4000);
for (i = 0; i < ARRAY_SIZE (s7_insn_to_dependency_table); i++)
{
const struct s7_insn_to_dependency *tmp = s7_insn_to_dependency_table + i;
- size_t len = strlen (tmp->insn_name);
+ size_t len = strlen (tmp->insn_name) + 1;
struct s7_insn_to_dependency *new_i2d;
char *insn_name;
- new_i2d = (struct s7_insn_to_dependency *)
- obstack_alloc (&dependency_obstack,
- sizeof (struct s7_insn_to_dependency));
- insn_name = (char *) obstack_alloc (&dependency_obstack, len + 1);
+ new_i2d = notes_alloc (sizeof (*new_i2d));
+ insn_name = notes_memdup (tmp->insn_name, len, len);
- strcpy (insn_name, tmp->insn_name);
new_i2d->insn_name = insn_name;
new_i2d->type = tmp->type;
str_hash_insert (s7_dependency_insn_hsh, new_i2d->insn_name, new_i2d, 0);
char c;
char *name;
char *str;
+ size_t len;
SKIP_WHITESPACE ();
str = input_line_pointer;
as_bad (_("Comma expected\n"));
return;
}
- *input_line_pointer++ = '\0';
+ len = input_line_pointer - str;
+ str = notes_memdup (str, len, len + 1);
+ input_line_pointer++;
c = get_symbol_name (&name); /* Get terminator. */
- str = xstrdup (str);
- name = xstrdup (name);
+ name = notes_strdup (name);
str_hash_insert (tic4x_asg_hash, name, str, 1);
(void) restore_line_pointer (c);
demand_empty_rest_of_line ();