From 244481c68cb54e08e38b8b85a4371a2f5dbbef69 Mon Sep 17 00:00:00 2001 From: Justin Wind Date: Tue, 17 Apr 2012 20:03:47 -0700 Subject: [PATCH] minor cleanup of verbosity --- as-dcpu16.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) 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"); -- 2.43.2