use XNEW and related macros more
[deliverable/binutils-gdb.git] / gas / config / tc-arc.c
index 169b05c348f5f1a00bdc84bdcbaaed5de7c9a1eb..28f135b2c783ed1eb737488f37b6ffbebb3759bd 100644 (file)
@@ -337,7 +337,9 @@ static const attributes_t suffixclass[] =
 static const attributes_t syntaxclass[] =
 {
   { "SYNTAX_3OP", 10, ARC_SYNTAX_3OP },
-  { "SYNTAX_2OP", 10, ARC_SYNTAX_2OP }
+  { "SYNTAX_2OP", 10, ARC_SYNTAX_2OP },
+  { "SYNTAX_1OP", 10, ARC_SYNTAX_1OP },
+  { "SYNTAX_NOP", 10, ARC_SYNTAX_NOP }
 };
 
 /* Extension instruction syntax classes modifiers.  */
@@ -698,7 +700,7 @@ arc_insert_opcode (const struct arc_opcode *opcode)
   entry = hash_find (arc_opcode_hash, name);
   if (entry == NULL)
     {
-      entry = xmalloc (sizeof (*entry));
+      entry = XNEW (struct arc_opcode_hash_entry);
       entry->count = 0;
       entry->opcode = NULL;
 
@@ -708,9 +710,8 @@ arc_insert_opcode (const struct arc_opcode *opcode)
                  name, retval);
     }
 
-  entry->opcode = xrealloc (entry->opcode,
-                           sizeof (const struct arc_opcode *)
-                           * (entry->count + 1));
+  entry->opcode = XRESIZEVEC (const struct arc_opcode *, entry->opcode,
+                             entry->count + 1);
 
   if (entry->opcode == NULL)
     as_fatal (_("Virtual memory exhausted"));
@@ -2260,9 +2261,7 @@ md_assemble (char *str)
 
   /* Split off the opcode.  */
   opnamelen = strspn (str, "abcdefghijklmnopqrstuvwxyz_0123468");
-  opname = xmalloc (opnamelen + 1);
-  memcpy (opname, str, opnamelen);
-  opname[opnamelen] = '\0';
+  opname = xmemdup0 (str, opnamelen);
 
   /* Signalize we are assmbling the instructions.  */
   assembling_insn = TRUE;
@@ -2937,8 +2936,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
   arelent *reloc;
   bfd_reloc_code_real_type code;
 
-  reloc = (arelent *) xmalloc (sizeof (* reloc));
-  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  reloc = XNEW (arelent);
+  reloc->sym_ptr_ptr = XNEW (asymbol *);
   *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
   reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
 
@@ -4233,13 +4232,15 @@ arc_extinsn (int ignore ATTRIBUTE_UNUSED)
       && (einsn.major != 5) && (einsn.major != 9))
     as_fatal (_("minor opcode not in range [0x00 - 0x3f]"));
 
-  switch (einsn.syntax & (ARC_SYNTAX_3OP | ARC_SYNTAX_2OP))
+  switch (einsn.syntax & ARC_SYNTAX_MASK)
     {
     case ARC_SYNTAX_3OP:
       if (einsn.modsyn & ARC_OP1_IMM_IMPLIED)
        as_fatal (_("Improper use of OP1_IMM_IMPLIED"));
       break;
     case ARC_SYNTAX_2OP:
+    case ARC_SYNTAX_1OP:
+    case ARC_SYNTAX_NOP:
       if (einsn.modsyn & ARC_OP1_MUST_BE_IMM)
        as_fatal (_("Improper use of OP1_MUST_BE_IMM"));
       break;
@@ -4469,7 +4470,7 @@ arc_extcorereg (int opertype)
       break;
     case EXT_AUX_REGISTER:
       /* Auxiliary register.  */
-      auxr = xmalloc (sizeof (struct arc_aux_reg));
+      auxr = XNEW (struct arc_aux_reg);
       auxr->name = ereg.name;
       auxr->cpu = arc_target;
       auxr->subclass = NONE;
@@ -4486,8 +4487,8 @@ arc_extcorereg (int opertype)
                ereg.number);
       ext_condcode.size ++;
       ext_condcode.arc_ext_condcode =
-       xrealloc (ext_condcode.arc_ext_condcode,
-                 (ext_condcode.size + 1) * sizeof (struct arc_flag_operand));
+       XRESIZEVEC (struct arc_flag_operand, ext_condcode.arc_ext_condcode,
+                   ext_condcode.size + 1);
       if (ext_condcode.arc_ext_condcode == NULL)
        as_fatal (_("Virtual memory exhausted"));
 
This page took 0.026787 seconds and 4 git commands to generate.