From: Justin Wind Date: Wed, 18 Apr 2012 03:03:47 +0000 (-0700) Subject: minor cleanup of verbosity X-Git-Url: http://git.squeep.com/?p=dcpu16;a=commitdiff_plain;h=244481c68cb54e08e38b8b85a4371a2f5dbbef69 minor cleanup of verbosity --- diff --git a/as-dcpu16.c b/as-dcpu16.c index 2d131d7..063741d 100644 --- a/as-dcpu16.c +++ b/as-dcpu16.c @@ -597,13 +597,9 @@ int tokenize_line_(char *line, struct instruction_ **next_instr) { struct operand_ *new_operand; char *y; - DEBUG_PRINTF("considering operand '%s'\n", x); - /* trim whitespaces */ x += strspn(x, whitespace); - DEBUG_PRINTF("considering ftrim operand '%s'\n", x); - if (*x) { for (y = x + strlen(x) - 1; *y; y--) { if (strchr(whitespace, *y)) { @@ -613,11 +609,11 @@ int tokenize_line_(char *line, struct instruction_ **next_instr) { } /* nothing left? */ if (*x == '\0') { - fprintf(stderr, "ignoring null operand in line %zu\n", instr->src_line); - continue; + fprintf(stderr, "null operand encountered\n"); + return -1; } - DEBUG_PRINTF("found operand '%s'\n", x); + DEBUG_PRINTF("tokenized operand '%s'\n", x); new_operand = malloc(sizeof *new_operand); if (new_operand == NULL) { @@ -644,7 +640,7 @@ int tokenize_line_(char *line, struct instruction_ **next_instr) { } } - DEBUG_PRINTF("allocating instruction with room for %zu bytes\n", instr_words_needed); + DEBUG_PRINTF("allocating new instruction with room for %zu bytes\n", instr_words_needed); instr = calloc(1, (instr_words_needed * sizeof *instr->instr_words) + sizeof *instr); if (instr == NULL) { @@ -1092,9 +1088,9 @@ int main(int argc, char *argv[]) { VERBOSE_PRINTF("assembling '%s'...\n", filename); c = parse_stream_(f, filename, instructionps_, labels_, allow_short_labels); + fclose(f); if (c) break; - fclose(f); } } else { VERBOSE_PRINTF("assembling '%s'...\n", "stdin");