This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix FIXME: xstrdup should not be here
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 13 Sep 2013 14:49:11 +0800
- Subject: Re: [PATCH] Fix FIXME: xstrdup should not be here
- Authentication-results: sourceware.org; auth=none
- References: <1377826046-21218-1-git-send-email-yao at codesourcery dot com> <522E84B9 dot 10502 at codesourcery dot com>
On 09/10/2013 10:32 AM, Yao Qi wrote:
> gdb:
>
> 2013-09-10 Yao Qi<yao@codesourcery.com>
>
> * varobj.c (update_dynamic_varobj_children): Duplicate 'name'
> and pass it to install_dynamic_child.
> (create_child_with_value): Update comments. Don't duplicate
> 'name'.
Here is the updated version, with a cast NAME to 'char *'.
--
Yao (éå)
gdb:
2013-09-13 Yao Qi <yao@codesourcery.com>
* varobj.c (update_dynamic_varobj_children): Duplicate 'name'
and pass it to install_dynamic_child.
(create_child_with_value): Update comments. Don't duplicate
'name'.
---
gdb/varobj.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/varobj.c b/gdb/varobj.c
index ced3e2d..7bdac62 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1225,7 +1225,8 @@ update_dynamic_varobj_children (struct varobj *var,
can_mention ? type_changed : NULL,
can_mention ? new : NULL,
can_mention ? unchanged : NULL,
- can_mention ? cchanged : NULL, i, name, v);
+ can_mention ? cchanged : NULL, i,
+ xstrdup (name), v);
do_cleanups (inner);
}
else
@@ -2439,9 +2440,8 @@ create_child_with_value (struct varobj *parent, int index, const char *name,
child = new_variable ();
- /* Name is allocated by name_of_child. */
- /* FIXME: xstrdup should not be here. */
- child->name = xstrdup (name);
+ /* NAME is allocated by caller. */
+ child->name = (char *) name;
child->index = index;
child->parent = parent;
child->root = parent->root;
--
1.7.7.6