diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-10-02 21:05:58 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-10-02 21:05:58 +0000 |
commit | e93f4ae6aa29887e022cf389dcbf1440b457e67b (patch) | |
tree | 51b1a3ec10d8114e76505080843b9316f2dbb526 /gdb/solib-svr4.c | |
parent | 794929bdced64854d1c9f861f4894bd76f93e2a9 (diff) | |
download | gdb-e93f4ae6aa29887e022cf389dcbf1440b457e67b.tar.gz |
gdb/
Code cleanup.
* solib-svr4.c (svr4_default_sos): Remove variables head and link_ptr.
Rearrange the code for it.
Diffstat (limited to 'gdb/solib-svr4.c')
-rw-r--r-- | gdb/solib-svr4.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index d58ca1a26e0..11ecf874e00 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -949,32 +949,26 @@ static struct so_list * svr4_default_sos (void) { struct svr4_info *info = get_svr4_info (); + struct so_list *new; - struct so_list *head = NULL; - struct so_list **link_ptr = &head; - - if (info->debug_loader_offset_p) - { - struct so_list *new = XZALLOC (struct so_list); + if (!info->debug_loader_offset_p) + return NULL; - new->lm_info = xmalloc (sizeof (struct lm_info)); + new = XZALLOC (struct so_list); - /* Nothing will ever check the cached copy of the link - map if we set l_addr. */ - new->lm_info->l_addr = info->debug_loader_offset; - new->lm_info->lm_addr = 0; - new->lm_info->lm = NULL; + new->lm_info = xmalloc (sizeof (struct lm_info)); - strncpy (new->so_name, info->debug_loader_name, - SO_NAME_MAX_PATH_SIZE - 1); - new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; - strcpy (new->so_original_name, new->so_name); + /* Nothing will ever check the cached copy of the link + map if we set l_addr. */ + new->lm_info->l_addr = info->debug_loader_offset; + new->lm_info->lm_addr = 0; + new->lm_info->lm = NULL; - *link_ptr = new; - link_ptr = &new->next; - } + strncpy (new->so_name, info->debug_loader_name, SO_NAME_MAX_PATH_SIZE - 1); + new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; + strcpy (new->so_original_name, new->so_name); - return head; + return new; } /* Implement the "current_sos" target_so_ops method. */ |