Index: gdb/common/common-utils.c |
diff --git a/gdb/common/common-utils.c b/gdb/common/common-utils.c |
index ad01ed658d89ba50a1fd2fa4cae5338b34024655..4f2b78a6afc3dc7e372829e55b46faaaa57f0318 100644 |
--- a/gdb/common/common-utils.c |
+++ b/gdb/common/common-utils.c |
@@ -1,6 +1,6 @@ |
/* Shared general utility routines for GDB, the GNU debugger. |
- Copyright (C) 1986, 1988-2012 Free Software Foundation, Inc. |
+ Copyright (C) 1986-2013 Free Software Foundation, Inc. |
This file is part of GDB. |
@@ -24,6 +24,7 @@ |
#endif |
#include "gdb_assert.h" |
+#include <string.h> |
#include <stdlib.h> |
#include <stdio.h> |
@@ -137,22 +138,6 @@ xstrvprintf (const char *format, va_list ap) |
return ret; |
} |
-void |
-xasprintf (char **ret, const char *format, ...) |
-{ |
- va_list args; |
- |
- va_start (args, format); |
- (*ret) = xstrvprintf (format, args); |
- va_end (args); |
-} |
- |
-void |
-xvasprintf (char **ret, const char *format, va_list ap) |
-{ |
- (*ret) = xstrvprintf (format, ap); |
-} |
- |
int |
xsnprintf (char *str, size_t size, const char *format, ...) |
{ |
@@ -166,3 +151,13 @@ xsnprintf (char *str, size_t size, const char *format, ...) |
return ret; |
} |
+ |
+char * |
+savestring (const char *ptr, size_t len) |
+{ |
+ char *p = (char *) xmalloc (len + 1); |
+ |
+ memcpy (p, ptr, len); |
+ p[len] = 0; |
+ return p; |
+} |