diff options
author | comex | 2015-07-16 17:58:12 -0400 |
---|---|---|
committer | comex | 2015-07-16 17:58:12 -0400 |
commit | 5a473ee5446c54bac0de451d7058ab6d40079749 (patch) | |
tree | 9a32d7c0e2cc782865bc145d58c88fe0db7ee57c /lib | |
parent | fix idiotic mistake from the <redacted> symbols commit (diff) | |
download | substitute-5a473ee5446c54bac0de451d7058ab6d40079749.tar.gz |
optimization
Diffstat (limited to 'lib')
-rw-r--r-- | lib/darwin/find-syms.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/darwin/find-syms.c b/lib/darwin/find-syms.c index 0205afe..d3524e2 100644 --- a/lib/darwin/find-syms.c +++ b/lib/darwin/find-syms.c @@ -239,6 +239,7 @@ ok: ; ok2: ; symtab = (void *) symtab + *slide; strtab = (void *) strtab + *slide; + size_t found_syms = 0; for (int type = 0; type <= 1; type++) { const substitute_sym *this_symtab = type ? cache_syms : symtab; @@ -251,14 +252,16 @@ ok2: ; uint32_t strx = sym->n_un.n_strx; const char *name = strx == 0 ? "" : this_strtab + strx; for (size_t j = 0; j < nsyms; j++) { - if (!strcmp(name, names[j])) { + if (!syms[j] && !strcmp(name, names[j])) { syms[j] = sym_to_ptr(sym, *slide); - break; + if (++found_syms == nsyms) + goto end; } } } } +end: if (mapping_size) munmap(mapping, mapping_size); } |