Commit b2f6f896 authored by Dario Bertini's avatar Dario Bertini Committed by Ben Gamari

rts/MachO: A bit of refactoring in ocGetNames

Eliminates a bit of repetition.
parent 9e0a23b9
...@@ -1613,7 +1613,6 @@ ocGetNames_MachO(ObjectCode* oc) ...@@ -1613,7 +1613,6 @@ ocGetNames_MachO(ObjectCode* oc)
"ocGetNames_MachO(oc->symbols)"); "ocGetNames_MachO(oc->symbols)");
if (oc->info->symCmd) { if (oc->info->symCmd) {
debugBelch("ocGetNames_MachO: %d macho symbols\n", oc->info->n_macho_symbols);
for (size_t i = 0; i < oc->info->n_macho_symbols; i++) { for (size_t i = 0; i < oc->info->n_macho_symbols; i++) {
SymbolName* nm = oc->info->macho_symbols[i].name; SymbolName* nm = oc->info->macho_symbols[i].name;
if(oc->info->nlist[i].n_type & N_STAB) if(oc->info->nlist[i].n_type & N_STAB)
...@@ -1663,14 +1662,14 @@ ocGetNames_MachO(ObjectCode* oc) ...@@ -1663,14 +1662,14 @@ ocGetNames_MachO(ObjectCode* oc)
if (oc->info->symCmd) { if (oc->info->symCmd) {
for (int i = 0; i < oc->n_symbols; i++) { for (int i = 0; i < oc->n_symbols; i++) {
if((oc->info->nlist[i].n_type & N_TYPE) == N_UNDF SymbolName* nm = oc->info->macho_symbols[i].name;
&& (oc->info->nlist[i].n_type & N_EXT) MachONList *nlist = &oc->info->nlist[i];
&& (oc->info->nlist[i].n_value != 0)) { if((nlist->n_type & N_TYPE) == N_UNDF
&& (nlist->n_type & N_EXT)
SymbolName* nm = oc->info->macho_symbols[i].name; && (nlist->n_value != 0)) {
unsigned long sz = oc->info->nlist[i].n_value; unsigned long sz = nlist->n_value;
oc->info->nlist[i].n_value = commonCounter; nlist->n_value = commonCounter;
/* also set the final address to the macho_symbol */ /* also set the final address to the macho_symbol */
oc->info->macho_symbols[i].addr = (void*)commonCounter; oc->info->macho_symbols[i].addr = (void*)commonCounter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment