diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-05-23 16:17:18 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-05-23 16:17:18 +0000 |
commit | 1b36a34b7a279d934ee183f3d97562d49b612cc5 (patch) | |
tree | 3a9bd202bdab9e50804c1096fb173ced0b5db2d9 /gdb/varobj.c | |
parent | 61d8f2758f5881aa0138e31b45105515e98eb715 (diff) | |
download | gdb-1b36a34b7a279d934ee183f3d97562d49b612cc5.zip gdb-1b36a34b7a279d934ee183f3d97562d49b612cc5.tar.gz gdb-1b36a34b7a279d934ee183f3d97562d49b612cc5.tar.bz2 |
gdb/
Replace the savestring calls by xstrdup calls where possible.
* breakpoint.c (condition_command, set_raw_breakpoint)
(create_catchpoint, update_breakpoint_locations): Replace the
savestring calls by xstrdup calls where possible.
* buildsym.c (start_subfile, patch_subfile_names, record_debugformat)
(record_producer): Likewise.
* coffread.c (coff_start_symtab, complete_symtab): Likewise.
* corefile.c (set_gnutarget): Likewise.
* dbxread.c (add_new_header_file): Likewise.
* demangle.c (set_demangling_command, set_demangling_style): Likewise.
* event-top.c (push_prompt, pop_prompt, command_line_handler)
(set_async_prompt): Likewise.
* infcmd.c (set_inferior_io_terminal, attach_command_post_wait):
Likewise.
* language.c (set_language_command, _initialize_language): Likewise.
* linespec.c (decode_line_2): Likewise.
* rs6000-nat.c (add_vmap): Likewise.
* top.c (set_prompt, init_history, init_main): Likewise.
* tracepoint.c (stringify_collection_list): Likewise.
* varobj.c (varobj_create): Remove variable expr_len. Replace the
savestring calls by xstrdup calls where possible.
(value_of_root, c_name_of_variable, c_describe_child): Replace the
savestring calls by xstrdup calls where possible.
* xcoffread.c (complete_symtab): Likewise.
* cli/cli-script.c (build_command_line, define_command): Likewise.
* cli/cli-setshow.c (do_setshow_command): Likewise.
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r-- | gdb/varobj.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c index 54c2a02..e8556d7 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -461,7 +461,6 @@ varobj_create (char *objname, char *p; enum varobj_languages lang; struct value *value = NULL; - int expr_len; /* Parse and evaluate the expression, filling in as much of the variable's data as possible. */ @@ -512,10 +511,9 @@ varobj_create (char *objname, var->format = variable_default_display (var); var->root->valid_block = innermost_block; - expr_len = strlen (expression); - var->name = savestring (expression, expr_len); + var->name = xstrdup (expression); /* For a root var, the name and the expr are the same. */ - var->path_expr = savestring (expression, expr_len); + var->path_expr = xstrdup (expression); /* When the frame is different from the current frame, we must select the appropriate frame before parsing @@ -561,7 +559,7 @@ varobj_create (char *objname, if ((var != NULL) && (objname != NULL)) { - var->obj_name = savestring (objname, strlen (objname)); + var->obj_name = xstrdup (objname); /* If a varobj name is duplicated, the install will fail so we must clenup */ @@ -1765,8 +1763,7 @@ value_of_root (struct varobj **var_handle, int *type_changed) } else { - tmp_var->obj_name = - savestring (var->obj_name, strlen (var->obj_name)); + tmp_var->obj_name = xstrdup (var->obj_name); varobj_delete (var, NULL, 0); install_variable (tmp_var); @@ -2015,7 +2012,7 @@ c_number_of_children (struct varobj *var) static char * c_name_of_variable (struct varobj *parent) { - return savestring (parent->name, strlen (parent->name)); + return xstrdup (parent->name); } /* Return the value of element TYPE_INDEX of a structure @@ -2114,10 +2111,7 @@ c_describe_child (struct varobj *parent, int index, case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: if (cname) - { - char *string = TYPE_FIELD_NAME (type, index); - *cname = savestring (string, strlen (string)); - } + *cname = xstrdup (TYPE_FIELD_NAME (type, index)); if (cvalue && value) { |