From baea0daecf9393f9f21bce1b2575133ae9264a1c Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 14 Feb 2013 17:11:41 +0000 Subject: 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 * 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 * tracepoint.c (save_string): Delete. (add_tracepoint_action): Use savestring instead of save_string. --- gdb/utils.c | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'gdb/utils.c') diff --git a/gdb/utils.c b/gdb/utils.c index 408c6ce0888..eb99f4b161e 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -89,9 +89,6 @@ extern PTR realloc (); /* ARI: PTR */ extern void free (); #endif -/* readline defines this. */ -#undef savestring - void (*deprecated_error_begin_hook) (void); /* Prototypes for local functions */ @@ -1186,20 +1183,6 @@ myread (int desc, char *addr, int len) return orglen; } -/* Make a copy of the string at PTR with LEN characters - (and add a null character at the end in the copy). - Uses malloc to get the space. Returns the address of the copy. */ - -char * -savestring (const char *ptr, size_t len) -{ - char *p = (char *) xmalloc (len + 1); - - memcpy (p, ptr, len); - p[len] = 0; - return p; -} - void print_spaces (int n, struct ui_file *file) { -- cgit v1.2.1