summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2005-03-13 19:55:38 +0000
committerMark Kettenis <kettenis@gnu.org>2005-03-13 19:55:38 +0000
commit8cb68fbb05cccb6faea70910cde1228b661f2474 (patch)
tree0064fa1cf2934f9801afc51194dcc6f846bffafa /gdb
parent57ee1c295e0346d37c36f540e072f1536151fdeb (diff)
downloadgdb-8cb68fbb05cccb6faea70910cde1228b661f2474.tar.gz
* cp-abi.c (set_cp_abi_as_auto_default): Use xasprintf instead of
a combination of xmalloc and sprintf.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/cp-abi.c9
2 files changed, 8 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9ef6f89e4cf..eef69955610 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 2b39300e4d2..f5077856569 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -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