diff options
Diffstat (limited to 'gdb/common/common-utils.c')
-rw-r--r-- | gdb/common/common-utils.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/common/common-utils.c b/gdb/common/common-utils.c index 60093a4..4204abf 100644 --- a/gdb/common/common-utils.c +++ b/gdb/common/common-utils.c @@ -24,6 +24,7 @@ #endif #include "gdb_assert.h" +#include "gdb_string.h" #include <stdlib.h> #include <stdio.h> @@ -150,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; +} |