This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix FIXME: xstrdup should not be here


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]