use XNEW and related macros more
[deliverable/binutils-gdb.git] / gas / config / tc-aarch64.c
index 8a6ebc8787c0dcd006ae7e91518baf353343d0ff..415663b5504bb2a6622f90107bb9f4d30a9baa50 100644 (file)
@@ -573,7 +573,7 @@ my_get_expression (expressionS * ep, char **str, int prefix_mode,
    of LITTLENUMS emitted is stored in *SIZEP.  An error message is
    returned, or NULL on OK.  */
 
-char *
+const char *
 md_atof (int type, char *litP, int *sizeP)
 {
   return ieee_md_atof (type, litP, sizeP, target_big_endian);
@@ -1187,7 +1187,7 @@ insert_reg_alias (char *str, int number, aarch64_reg_type type)
     }
 
   name = xstrdup (str);
-  new = xmalloc (sizeof (reg_entry));
+  new = XNEW (reg_entry);
 
   new->name = name;
   new->number = number;
@@ -1241,9 +1241,7 @@ create_register_alias (char *newname, char *p)
   nlen = strlen (newname);
 #endif
 
-  nbuf = xmalloc (nlen + 1);
-  memcpy (nbuf, newname, nlen);
-  nbuf[nlen] = '\0';
+  nbuf = xmemdup0 (newname, nlen);
 
   /* Create aliases under the new name as stated; an all-lowercase
      version of the new name; and an all-uppercase version of the new
@@ -1577,7 +1575,7 @@ find_or_make_literal_pool (int size)
   if (pool == NULL)
     {
       /* Create a new pool.  */
-      pool = xmalloc (sizeof (*pool));
+      pool = XNEW (literal_pool);
       if (!pool)
        return NULL;
 
@@ -1654,7 +1652,8 @@ add_to_lit_pool (expressionS *exp, int size)
        {
          /* PR 16688: Bignums are held in a single global array.  We must
             copy and preserve that value now, before it is overwritten.  */
-         pool->literals[entry].bignum = xmalloc (CHARS_PER_LITTLENUM * exp->X_add_number);
+         pool->literals[entry].bignum = XNEWVEC (LITTLENUM_TYPE,
+                                                 exp->X_add_number);
          memcpy (pool->literals[entry].bignum, generic_bignum,
                  CHARS_PER_LITTLENUM * exp->X_add_number);
        }
@@ -4051,9 +4050,7 @@ add_operand_error_record (const operand_error_record* new_record)
       /* Get one empty record.  */
       if (free_opnd_error_record_nodes == NULL)
        {
-         record = xmalloc (sizeof (operand_error_record));
-         if (record == NULL)
-           abort ();
+         record = XNEW (operand_error_record);
        }
       else
        {
@@ -6102,8 +6099,7 @@ md_assemble (char *str)
                 store the instruction information for the future fix-up.  */
              struct aarch64_inst *copy;
              gas_assert (inst.reloc.type != BFD_RELOC_UNUSED);
-             if ((copy = xmalloc (sizeof (struct aarch64_inst))) == NULL)
-               abort ();
+             copy = XNEW (struct aarch64_inst);
              memcpy (copy, &inst.base, sizeof (struct aarch64_inst));
              output_inst (copy);
            }
@@ -6322,7 +6318,7 @@ aarch64_handle_align (fragS * fragP)
 {
   /* NOP = d503201f */
   /* AArch64 instructions are always little-endian.  */
-  static char const aarch64_noop[4] = { 0x1f, 0x20, 0x03, 0xd5 };
+  static unsigned char const aarch64_noop[4] = { 0x1f, 0x20, 0x03, 0xd5 };
 
   int bytes, fix, noop_size;
   char *p;
@@ -7198,9 +7194,9 @@ tc_gen_reloc (asection * section, fixS * fixp)
   arelent *reloc;
   bfd_reloc_code_real_type code;
 
-  reloc = xmalloc (sizeof (arelent));
+  reloc = XNEW (arelent);
 
-  reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+  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;
 
@@ -7510,7 +7506,7 @@ fill_instruction_hash_table (void)
       templates *templ, *new_templ;
       templ = hash_find (aarch64_ops_hsh, opcode->name);
 
-      new_templ = (templates *) xmalloc (sizeof (templates));
+      new_templ = XNEW (templates);
       new_templ->opcode = opcode;
       new_templ->next = NULL;
 
@@ -7541,8 +7537,7 @@ get_upper_str (const char *str)
 {
   char *ret;
   size_t len = strlen (str);
-  if ((ret = xmalloc (len + 1)) == NULL)
-    abort ();
+  ret = XNEWVEC (char, len + 1);
   convert_to_upper (ret, str, len);
   return ret;
 }
@@ -7813,6 +7808,7 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = {
   {"simd",             AARCH64_FEATURE (AARCH64_FEATURE_SIMD, 0)},
   {"pan",              AARCH64_FEATURE (AARCH64_FEATURE_PAN, 0)},
   {"lor",              AARCH64_FEATURE (AARCH64_FEATURE_LOR, 0)},
+  {"ras",              AARCH64_FEATURE (AARCH64_FEATURE_RAS, 0)},
   {"rdma",             AARCH64_FEATURE (AARCH64_FEATURE_SIMD
                                         | AARCH64_FEATURE_RDMA, 0)},
   {"fp16",             AARCH64_FEATURE (AARCH64_FEATURE_F16
@@ -7838,7 +7834,7 @@ aarch64_parse_features (const char *str, const aarch64_feature_set **opt_p,
      adding an extension (1) or removing it (0) and only allowing it to
      change in the order -1 -> 1 -> 0.  */
   int adding_value = -1;
-  aarch64_feature_set *ext_set = xmalloc (sizeof (aarch64_feature_set));
+  aarch64_feature_set *ext_set = XNEW (aarch64_feature_set);
 
   /* Copy the feature set, so that we can modify it.  */
   *ext_set = **opt_p;
This page took 0.028258 seconds and 4 git commands to generate.