aboutsummaryrefslogtreecommitdiff
path: root/gdb/auto-load.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-10-24 20:42:02 +0800
committerYao Qi <yao@codesourcery.com>2013-10-29 14:36:29 +0800
commit487ad57ccfe1434e21774117d20dfd9e23f12afa (patch)
treeda22685f2b7ee912998a8a96cd5d7eff900872d5 /gdb/auto-load.c
parent3c4797ba74e0b7db0db3e34b606ba9c1d0f2baf7 (diff)
downloadgdb-487ad57ccfe1434e21774117d20dfd9e23f12afa.zip
gdb-487ad57ccfe1434e21774117d20dfd9e23f12afa.tar.gz
gdb-487ad57ccfe1434e21774117d20dfd9e23f12afa.tar.bz2
Simplify REGISTRY cleanup usages
In registry.c:registry_clear_data, the registered data is iterated and invoke each 'free' function with the data passed: for (registration = data_registry->registrations, i = 0; i < fields->num_data; registration = registration->next, i++) if (fields->data[i] != NULL && registration->data->free != NULL) adaptor (registration->data->free, container, fields->data[i]); we can see that data is passed to function 'free' and data is not NULL. In each usage, we don't have to get the data again through key and do NULL pointer checking. This patch is to simplify them. gdb: 2013-10-29 Yao Qi <yao@codesourcery.com> * auto-load.c (auto_load_pspace_data_cleanup): Get data from parameter 'arg' instead of from program_space_data. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. * solib-darwin.c (darwin_pspace_data_cleanup): Likewise. * solib-dsbt.c (dsbt_pspace_data_cleanup): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. * inflow.c (inflow_inferior_data_cleanup): Get data from parameter 'arg' instead of inferior_data. * registry.h: Add comments.
Diffstat (limited to 'gdb/auto-load.c')
-rw-r--r--gdb/auto-load.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 4eb7cdd..2c534c7 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -572,15 +572,11 @@ static const struct program_space_data *auto_load_pspace_data;
static void
auto_load_pspace_data_cleanup (struct program_space *pspace, void *arg)
{
- struct auto_load_pspace_info *info;
+ struct auto_load_pspace_info *info = arg;
- info = program_space_data (pspace, auto_load_pspace_data);
- if (info != NULL)
- {
- if (info->loaded_scripts)
- htab_delete (info->loaded_scripts);
- xfree (info);
- }
+ if (info->loaded_scripts)
+ htab_delete (info->loaded_scripts);
+ xfree (info);
}
/* Get the current autoload data. If none is found yet, add it now. This