diff options
author | Tom Tromey <tom@tromey.com> | 2017-05-03 17:26:47 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-09-29 21:12:12 -0600 |
commit | 2d6960b4568869baaa3cb40f75caed4021938e1c (patch) | |
tree | 79b3e0b7d8941661ab76757be74adf5d8b68953b /gdb/varobj.c | |
parent | 784c453a4f1aeee237203dd6257a6ed24bee28c3 (diff) | |
download | gdb-2d6960b4568869baaa3cb40f75caed4021938e1c.zip gdb-2d6960b4568869baaa3cb40f75caed4021938e1c.tar.gz gdb-2d6960b4568869baaa3cb40f75caed4021938e1c.tar.bz2 |
Remove cleanups from mi-cmd-var.c
This removes some cleanups from mi-cmd-var.c. varobj_gen_name now
returns a string, simplifying mi_cmd_var_create. In
mi_cmd_var_delete, a string copy is apparently unnecessary, so it's
simply removed.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* varobj.h (varobj_gen_name): Return std::string.
* varobj.c (varobj_gen_name): Return std::string.
* mi/mi-cmd-var.c (mi_cmd_var_create): Use std::string.
(mi_cmd_var_delete): Don't copy "name".
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r-- | gdb/varobj.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c index f669180..2d850fb 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -435,17 +435,14 @@ varobj_create (const char *objname, /* Generates an unique name that can be used for a varobj. */ -char * +std::string varobj_gen_name (void) { static int id = 0; - char *obj_name; /* Generate a name for this object. */ id++; - obj_name = xstrprintf ("var%d", id); - - return obj_name; + return string_printf ("var%d", id); } /* Given an OBJNAME, returns the pointer to the corresponding varobj. Call |