Fix FIXME: xstrdup should not be here
authorYao Qi <yao@codesourcery.com>
Fri, 4 Oct 2013 07:16:44 +0000 (07:16 +0000)
committerYao Qi <yao@codesourcery.com>
Fri, 4 Oct 2013 07:16:44 +0000 (07:16 +0000)
commit5e5ac9a570c5aeff695c0663f6cf7f91a6cb50c9
tree75fa3b33b73234b8933ea131c6de23f941fe2bcf
parentc4c2eac59e11b265c06e2a69410387515e90c89c
Fix FIXME: xstrdup should not be here

Hi,

This FIXME goes into my eyes, when I am about to modify something here,

  /* Name is allocated by name_of_child.  */
  /* FIXME: xstrdup should not be here.  */

This FIXME was introduced in the python pretty-pretter patches.

  Python pretty-printing [6/6]
  https://sourceware.org/ml/gdb-patches/2009-05/msg00467.html

create_child_with_value is called in two paths,

 1. varobj_list_children -> create_child -> create_child_with_value,
 2. install_dynamic_child -> install_dynamic_child -> varobj_add_child
    -> create_child_with_value

In path #1, 'name' is allocated by name_of_child, as the original
comment said, we don't have to duplicate NAME in
create_child_with_value.  In path #2, 'name' is got from
PyArg_ParseTuple, and we have to duplicate NAME.

This patch removes the call to xstrdup in create_child_with_value
and call xstrudp in update_dynamic_varobj_children (path #2).

gdb:

2013-10-04  Yao Qi  <yao@codesourcery.com>

* varobj.c (create_child_with_value): Remove 'const' from the
type of parameter 'name'.
(varobj_add_child): Likewise.
(install_dynamic_child): Remove 'const' from the type of
parameter 'name'.
(varobj_add_child): Likewise.
(create_child_with_value): Likewise.  Update comments.  Don't
duplicate 'name'.
(update_dynamic_varobj_children): Duplicate 'name'
and pass it to install_dynamic_child.
gdb/ChangeLog
gdb/varobj.c
This page took 0.025809 seconds and 4 git commands to generate.