diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-07-30 15:06:47 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-07-30 15:06:47 -0700 |
commit | e873c9b16b2d1e1951897a6e7842d6c406166ad3 (patch) | |
tree | ace0e063b8221f3145d9558a3f967a101e2acce0 | |
parent | 984c4db12f312e5d6051e9c02fb02b7b24bdb226 (diff) | |
parent | a95a76a8685b5cb485b11c1c76c2a928d8f9b9a3 (diff) | |
download | nasm-e873c9b16b2d1e1951897a6e7842d6c406166ad3.tar.gz nasm-e873c9b16b2d1e1951897a6e7842d6c406166ad3.tar.bz2 nasm-e873c9b16b2d1e1951897a6e7842d6c406166ad3.zip |
Merge commit 'cyr/hpa-list'
-rw-r--r-- | assemble.c | 4 | ||||
-rw-r--r-- | nasm.c | 6 | ||||
-rw-r--r-- | output/outaout.c | 10 |
3 files changed, 8 insertions, 12 deletions
@@ -378,7 +378,7 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, uint32_t cp, "instruction->times < 0 (%ld) in assemble()", t); while (t--) { /* repeat TIMES times */ - for (e = instruction->eops; e; e = e->next) { + list_for_each(e, instruction->eops) { if (e->type == EOT_DB_NUMBER) { if (wsize == 1) { if (e->segment != NO_SEG) @@ -704,7 +704,7 @@ int64_t insn_size(int32_t segment, int64_t offset, int bits, uint32_t cp, break; } - for (e = instruction->eops; e; e = e->next) { + list_for_each(e, instruction->eops) { int32_t align; osize = 0; @@ -284,7 +284,7 @@ static void emit_dependencies(StrList *list) } linepos = fprintf(deps, "%s:", depend_target); - for (l = list; l; l = l->next) { + list_for_each(l, list) { len = strlen(l->str); if (linepos + len > 62) { fprintf(deps, " \\\n "); @@ -295,11 +295,9 @@ static void emit_dependencies(StrList *list) } fprintf(deps, "\n\n"); - for (l = list; l; l = nl) { + list_for_each_safe(l, nl, list) { if (depend_emit_phony) fprintf(deps, "%s:\n\n", l->str); - - nl = l->next; nasm_free(l); } diff --git a/output/outaout.c b/output/outaout.c index 8bff63e..f0a86ec 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -508,7 +508,7 @@ static int32_t aout_add_gsym_reloc(struct Section *sect, /* * Find a symbol pointing _exactly_ at this one. */ - for (sym = shead; sym; sym = sym->next) + list_for_each(sym, shead) if (sym->value == offset) break; } else { @@ -516,7 +516,7 @@ static int32_t aout_add_gsym_reloc(struct Section *sect, * Find the nearest symbol below this one. */ sym = NULL; - for (sm = shead; sm; sm = sm->next) + list_for_each(sm, shead) if (sm->value <= offset && (!sym || sm->value > sym->value)) sym = sm; } @@ -774,7 +774,7 @@ static void aout_fixup_relocs(struct Section *sect) struct Reloc *r; saa_rewind(sect->data); - for (r = sect->head; r; r = r->next) { + list_for_each(r, sect->head) { uint8_t *p, *q, blk[4]; int32_t l; @@ -843,7 +843,7 @@ static void aout_write(void) static void aout_write_relocs(struct Reloc *r) { - while (r) { + list_for_each(r, r) { uint32_t word2; fwriteint32_t(r->address, ofile); @@ -856,8 +856,6 @@ static void aout_write_relocs(struct Reloc *r) word2 |= (r->bytes == 1 ? 0 : r->bytes == 2 ? 0x2000000L : 0x4000000L); fwriteint32_t(word2, ofile); - - r = r->next; } } |