Mercurial > hg-old > index.cgi
diff src/parse.c @ 68:cef25b0088e6
Fixed some problems detected by valgrind and testing
author | lost |
---|---|
date | Mon, 05 Jan 2009 06:14:41 +0000 |
parents | aa9d9fedfdf4 |
children | 90a5657d5408 |
line wrap: on
line diff
--- a/src/parse.c Mon Jan 05 05:40:33 2009 +0000 +++ b/src/parse.c Mon Jan 05 06:14:41 2009 +0000 @@ -115,9 +115,10 @@ // the reason this check is here is to allow for "private" // operation codes like "*pragma" which will be ignored by // other assemblers + // also skip empty ops if (!(instab[opnum].opcode)) { - if (*opc == '*' || *opc == ';') + if (*opc == '*' || *opc == ';' || !*opc) goto done_line; } @@ -142,17 +143,6 @@ if (as -> skipcond && instab[opnum].iscond == 0) goto done_line; - // register symbol if the operation won't - if (sym && instab[opnum].setsym == 0) - { - if (as -> passnum == 1) - { - debug_message(1, "Registering symbol '%s' at %04X", sym, as -> addr); - if (lwasm_register_symbol(as, l, sym, as -> addr, SYMBOL_NORM) < 0) - l -> sym = NULL; - } - } - // we've registered the symbol as needed // now we need to check for a macro call IFF we don't collide with // an operation code; otherwise, call the operation function @@ -180,6 +170,22 @@ } done_line: + if (!(as -> skipcond || as -> inmacro)) + { + // register symbol if the operation didn't + if (sym && instab[opnum].setsym == 0) + { + if (as -> passnum == 1) + { + debug_message(1, "Registering symbol '%s' at %04X", sym, as -> addr); + if (lwasm_register_symbol(as, l, sym, as -> addr, SYMBOL_NORM) < 0) + l -> sym = NULL; + else + l -> addrset = 1; + } + } + } + lwasm_free(opc); if (sym) lwasm_free(sym);