summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-hash.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-01-10 21:02:48 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-01-10 21:02:48 +0000
commit27d501fdbf0c6932e6170e8dece4d178d912bf94 (patch)
tree054224e4ebe3ee638fb5b8d28e9873fbcd13c537 /ldso/ldso/dl-hash.c
parent1c778b7cfac9228aa6dbd3c7d3b1417887fc3031 (diff)
simple optimizations and style fixes in dynamic loading
text data bss dec hex filename - 16709 240 92 17041 4291 lib/ld-uClibc.so + 16634 236 92 16962 4242 lib/ld-uClibc.so - 4602 344 4 4950 1356 lib/libdl-0.9.30-svn.so + 4571 328 4 4903 1327 lib/libdl-0.9.30-svn.so - 4602 344 4 4950 1356 lib/libdl.so + 4571 328 4 4903 1327 lib/libdl.so
Diffstat (limited to 'ldso/ldso/dl-hash.c')
-rw-r--r--ldso/ldso/dl-hash.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c
index a251aaff3..4809c4348 100644
--- a/ldso/ldso/dl-hash.c
+++ b/ldso/ldso/dl-hash.c
@@ -95,17 +95,18 @@ struct elf_resolve *_dl_add_elf_hash_table(const char *libname,
struct elf_resolve *tpnt;
int i;
- if (!_dl_loaded_modules) {
- tpnt = _dl_loaded_modules = (struct elf_resolve *) _dl_malloc(sizeof(struct elf_resolve));
- _dl_memset(tpnt, 0, sizeof(struct elf_resolve));
- } else {
- tpnt = _dl_loaded_modules;
- while (tpnt->next)
- tpnt = tpnt->next;
- tpnt->next = (struct elf_resolve *) _dl_malloc(sizeof(struct elf_resolve));
- _dl_memset(tpnt->next, 0, sizeof(struct elf_resolve));
- tpnt->next->prev = tpnt;
- tpnt = tpnt->next;
+ tpnt = _dl_malloc(sizeof(struct elf_resolve));
+ _dl_memset(tpnt, 0, sizeof(struct elf_resolve));
+
+ if (!_dl_loaded_modules)
+ _dl_loaded_modules = tpnt;
+ else {
+ struct elf_resolve *t = _dl_loaded_modules;
+ while (t->next)
+ t = t->next;
+ t->next = tpnt;
+ t->next->prev = t;
+ tpnt = t->next;
}
tpnt->next = NULL;