use xstrdup, xmemdup0 and concat more
[deliverable/binutils-gdb.git] / gas / config / obj-evax.c
index e36859209113637703b6e29d7435ed132334fa41..445828697a3a3a6e156d75d3a1eda08cb4546cf2 100644 (file)
@@ -273,9 +273,7 @@ evax_shorten_name (char *id)
     }
 
   /* We only need worry about krunching the base symbol.  */
-  base_id = xmalloc (suffix_dotdot - prefix_dotdot + 1);
-  strncpy (base_id, &id[prefix_dotdot], suffix_dotdot - prefix_dotdot);
-  base_id [suffix_dotdot - prefix_dotdot] = 0;
+  base_id = xmemdup0 (&id[prefix_dotdot], suffix_dotdot - prefix_dotdot);
 
   if (strlen (base_id) > MAX_LABEL_LENGTH)
     {
@@ -299,8 +297,7 @@ evax_shorten_name (char *id)
        strcat (new_id, suffix);
 
       /* Save it on the heap and return.  */
-      return_id = xmalloc (strlen (new_id) + 1);
-      strcpy (return_id, new_id);
+      return_id = xstrdup (new_id);
 
       return return_id;
     }
This page took 0.02453 seconds and 4 git commands to generate.