From e703547deb5370adce12c439ca894042c7bb9eb5 Mon Sep 17 00:00:00 2001 From: ketmar Date: Tue, 17 Sep 2013 04:55:14 +0300 Subject: [PATCH] got rid of trailing spaces in k8jam output --- src/compile.c | 22 +++++++++++----------- src/expand.c | 6 +++--- src/hcache.c | 4 ++-- src/lists.c | 2 +- src/make1.c | 2 +- src/variable.c | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/compile.c b/src/compile.c index edfd39e..1fabba9 100644 --- a/src/compile.c +++ b/src/compile.c @@ -183,7 +183,7 @@ eval: lr = (*parse->right->func)(parse->right, args, jmp); debug_compile(0, "if"); list_print(ll); printf("(%d) ", status); - list_print(lr); + list_print_ex(lr, LPFLAG_NO_TRSPACE); printf("\n"); } /* find something to return */ @@ -264,7 +264,7 @@ static LIST *compile_include_internal (PARSE *parse, LOL *args, int *jmp, int as LIST *nt = (*parse->left->func)(parse->left, args, jmp); if (DEBUG_COMPILE) { debug_compile(0, (assoft ? "softinclude" : "include")); - list_print(nt); + list_print_ex(nt, LPFLAG_NO_TRSPACE); printf("\n"); } if (nt) { @@ -341,8 +341,8 @@ LIST *compile_local (PARSE *parse, LOL *args, int *jmp) { if (DEBUG_COMPILE) { debug_compile(0, "local"); list_print(nt); - printf(" = "); - list_print(ns); + printf("= "); + list_print_ex(ns, LPFLAG_NO_TRSPACE); printf("\n"); } /* initial value is ns */ @@ -378,7 +378,7 @@ LIST *compile_on (PARSE *parse, LOL *args, int *jmp) { LIST *result = NULL; if (DEBUG_COMPILE) { debug_compile(0, "on"); - list_print(nt); + list_print_ex(nt, LPFLAG_NO_TRSPACE); printf("\n"); } /* copy settings, so that 'on target var on target = val' doesn't set var globally */ @@ -525,8 +525,8 @@ LIST *compile_set (PARSE *parse, LOL *args, int *jmp) { if (DEBUG_COMPILE) { debug_compile(0, "set"); list_print(nt); - printf(" %s ", set_names[parse->num]); - list_print(ns); + printf("%s ", set_names[parse->num]); + list_print_ex(ns, LPFLAG_NO_TRSPACE); printf("\n"); } /* call var_set to set variable */ @@ -553,7 +553,7 @@ LIST *compile_setcomp (PARSE *parse, LOL *args, int *jmp) { if (DEBUG_COMPILE) { debug_compile(0, "rule"); printf("%s ", parse->string); - list_print(params); + list_print_ex(params, LPFLAG_NO_TRSPACE); printf("\n"); } /* free old one, if present */ @@ -612,8 +612,8 @@ LIST *compile_settings (PARSE *parse, LOL *args, int *jmp) { list_print(nt); printf("on "); list_print(targets); - printf(" %s ", set_names[parse->num]); - list_print(ns); + printf("%s ", set_names[parse->num]); + list_print_ex(ns, LPFLAG_NO_TRSPACE); printf("\n"); } /* call addsettings to save variable setting addsettings keeps ns, so need to copy it */ @@ -647,7 +647,7 @@ LIST *compile_switch (PARSE *parse, LOL *args, int *jmp) { LIST *result = NULL; if (DEBUG_COMPILE) { debug_compile(0, "switch"); - list_print(nt); + list_print_ex(nt, LPFLAG_NO_TRSPACE); printf("\n"); } /* step through cases */ diff --git a/src/expand.c b/src/expand.c index 2ba24c0..75ccba4 100644 --- a/src/expand.c +++ b/src/expand.c @@ -215,7 +215,7 @@ expand: } /* empty w/ :E=default? */ if (!value && colon && edits.empty.ptr) evalue = value = list_new(L0, edits.empty.ptr, 0); - //if (DEBUG_VAREXP) { printf(" expanding values for var '%s': ", vtmp); list_print(value); printf("\n"); printf(" curout: (%d) '%s'\n", cpos, dstr_cstr(&obuf)); } + //if (DEBUG_VAREXP) { printf(" expanding values for var '%s': ", vtmp); list_print_ex(value, LPFLAG_NO_TRSPACE); printf("\n"); printf(" curout: (%d) '%s'\n", cpos, dstr_cstr(&obuf)); } /* for each variable value */ for (; value; value = list_next(value)) { /* handle end subscript (length actually) */ @@ -247,7 +247,7 @@ expand: /* remember the end of the variable expansion so we can just tack on each instance of 'remainder' */ { int np = dstr_len(&obuf); - //if (DEBUG_VAREXP) { printf(" remainders for var '%s': ", vtmp); list_print(remainder); printf("\n"); printf(" curout: (%d) '%s'\n", cpos, dstr_cstr(&obuf)); } + //if (DEBUG_VAREXP) { printf(" remainders for var '%s': ", vtmp); list_print_ex(remainder, LPFLAG_NO_TRSPACE); printf("\n"); printf(" curout: (%d) '%s'\n", cpos, dstr_cstr(&obuf)); } for (LIST *rem = remainder; rem; rem = list_next(rem)) { dstr_chop(&obuf, np); dstr_push_cstr(&obuf, rem->string); @@ -261,7 +261,7 @@ expand: /* variables & remainder were gifts from var_expand and must be freed */ if (variables) list_free(variables); if (remainder) list_free(remainder); - if (DEBUG_VAREXP) { printf("expanded to "); list_print(l); printf("\n"); } + if (DEBUG_VAREXP) { printf("expanded to "); list_print_ex(l, LPFLAG_NO_TRSPACE); printf("\n"); } dstr_done(&varname); dstr_done(&varspec); dstr_done(&obuf); diff --git a/src/hcache.c b/src/hcache.c index c071505..f8a47cb 100644 --- a/src/hcache.c +++ b/src/hcache.c @@ -273,9 +273,9 @@ LIST *hcache (TARGET *t, LIST *hdrscan) { /* printf("HDRSCAN out of date for %s\n", t->boundname); printf(" real : "); - list_print(hdrscan); + list_print_ex(hdrscan, LPFLAG_NO_TRSPACE); printf("\n cached: "); - list_print(c->hdrscan); + list_print_ex(c->hdrscan, LPFLAG_NO_TRSPACE); printf("\n"); */ list_free(c->includes); diff --git a/src/lists.c b/src/lists.c index 75ace7f..a1fd2fc 100644 --- a/src/lists.c +++ b/src/lists.c @@ -190,7 +190,7 @@ void list_free (LIST *head) { * list_print() - print a list of strings to stdout */ void list_print_ex (const LIST *l, int flags) { - int spc = 0; + int spc = (l != NULL); for (; l; l = list_next(l)) { if (spc && (flags&LPFLAG_NO_SPACES) == 0) fputc(' ', stdout); fputs(l->string, stdout); diff --git a/src/make1.c b/src/make1.c index 5d2c479..d5c2f5e 100644 --- a/src/make1.c +++ b/src/make1.c @@ -248,7 +248,7 @@ static void make1c (TARGET *t) { if (DEBUG_MAKEQ || !(cmd->rule->flags&RULE_QUIETLY)) { printf("(%3d%%) ", counts->total*100/globs.updating); printf("%s ", cmd->rule->name); - list_print(lol_get(&cmd->args, 0)); + list_print_ex(lol_get(&cmd->args, 0), LPFLAG_NO_TRSPACE); printf("\n"); } } diff --git a/src/variable.c b/src/variable.c index 88926bb..7c9bec1 100644 --- a/src/variable.c +++ b/src/variable.c @@ -58,7 +58,7 @@ struct _variable { */ static void var_dump (const char *symbol, LIST *value, const char *what) { printf("%s %s = ", what, symbol); - list_print(value); + list_print_ex(value, LPFLAG_NO_TRSPACE); printf("\n"); } -- 2.11.4.GIT