/* Shared general utility routines for GDB, the GNU debugger.
- Copyright (C) 1986, 1988-2012 Free Software Foundation, Inc.
+ Copyright (C) 1986-2015 Free Software Foundation, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#ifdef GDBSERVER
-#include "server.h"
-#else
-#include "defs.h"
-#endif
-
-#include "gdb_assert.h"
-
-#include <stdlib.h>
-#include <stdio.h>
+#include "common-defs.h"
/* The xmalloc() (libiberty.h) family of memory management routines.
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, ...)
{
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;
+}