forked from Imagelibrary/binutils-gdb
Move savestring to common/common-utils.c, make gdbserver use it.
This makes gdbserver share gdb's savestring, instead of baking its own. Tested on x86_64 Fedora 17. gdb/ 2013-02-14 Pedro Alves <palves@redhat.com> * utils.c (savestring): Don't #undef it. Move function to common/common-utils.c. * common/common-utils.c: Include gdb_string.h. (savestring): Move here from utils.c. * common/common-utils.h (savestring): Declare. gdb/gdbserver/ 2013-02-14 Pedro Alves <palves@redhat.com> * tracepoint.c (save_string): Delete. (add_tracepoint_action): Use savestring instead of save_string.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user