From 487ad57ccfe1434e21774117d20dfd9e23f12afa Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 24 Oct 2013 20:42:02 +0800 Subject: 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 * 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. --- gdb/solib-dsbt.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'gdb/solib-dsbt.c') diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index 4fe24f8..4e2091b 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -166,10 +166,7 @@ static const struct program_space_data *solib_dsbt_pspace_data; static void dsbt_pspace_data_cleanup (struct program_space *pspace, void *arg) { - struct dsbt_info *info; - - info = program_space_data (pspace, solib_dsbt_pspace_data); - xfree (info); + xfree (arg); } /* Get the current dsbt data. If none is found yet, add it now. This -- cgit v1.1