OSDN Git Service

* cp-abi.c (set_cp_abi_as_auto_default): Use xasprintf instead of
authorkettenis <kettenis>
Sun, 13 Mar 2005 19:55:37 +0000 (19:55 +0000)
committerkettenis <kettenis>
Sun, 13 Mar 2005 19:55:37 +0000 (19:55 +0000)
a combination of xmalloc and sprintf.

gdb/ChangeLog
gdb/cp-abi.c

index 9ef6f89..eef6995 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-13  Mark Kettenis  <kettenis@gnu.org>
+
+       * cp-abi.c (set_cp_abi_as_auto_default): Use xasprintf instead of
+       a combination of xmalloc and sprintf.
+
 2005-03-13  Jim Blandy  <jimb@redhat.com>
 
        * configure.ac: Use '=', not '=='; the latter is a GNU extension.
index 2b39300..f507785 100644 (file)
@@ -145,14 +145,11 @@ set_cp_abi_as_auto_default (const char *short_name)
   auto_cp_abi = *abi;
 
   auto_cp_abi.shortname = "auto";
-  new_longname = xmalloc (strlen ("currently ") + 1 + strlen (abi->shortname)
-                         + 1 + 1);
-  sprintf (new_longname, "currently \"%s\"", abi->shortname);
+  xasprintf (&new_longname, "currently \"%s\"", abi->shortname);
   auto_cp_abi.longname = new_longname;
 
-  new_doc = xmalloc (strlen ("Automatically selected; currently ")
-                    + 1 + strlen (abi->shortname) + 1 + 1);
-  sprintf (new_doc, "Automatically selected; currently \"%s\"", abi->shortname);
+  xasprintf (&new_doc, "Automatically selected; currently \"%s\"",
+            abi->shortname);
   auto_cp_abi.doc = new_doc;
 
   /* Since we copy the current ABI into current_cp_abi instead of