From 9ba9a5919f6f87700d14a9125359b2bca0d86f58 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sat, 4 Mar 2017 17:37:03 +0100 Subject: make: removed useless "verbose" variables --- src/blogc-make/main.c | 2 +- src/blogc-make/rules.c | 46 +++++++++++++++++++++------------------------- src/blogc-make/rules.h | 7 +++---- 3 files changed, 25 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/blogc-make/main.c b/src/blogc-make/main.c index 96f55b9..8e15981 100644 --- a/src/blogc-make/main.c +++ b/src/blogc-make/main.c @@ -114,7 +114,7 @@ main(int argc, char **argv) } ctx->verbose = verbose; - rv = bm_rule_executor(ctx, rules, verbose); + rv = bm_rule_executor(ctx, rules); cleanup: diff --git a/src/blogc-make/rules.c b/src/blogc-make/rules.c index cdcc838..631d0ee 100644 --- a/src/blogc-make/rules.c +++ b/src/blogc-make/rules.c @@ -48,7 +48,7 @@ index_outputlist(bm_ctx_t *ctx) } static int -index_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +index_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { if (ctx == NULL || ctx->settings->posts == NULL) return 0; @@ -105,7 +105,7 @@ atom_outputlist(bm_ctx_t *ctx) } static int -atom_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +atom_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { if (ctx == NULL || ctx->settings->posts == NULL) return 0; @@ -165,7 +165,7 @@ atom_tags_outputlist(bm_ctx_t *ctx) } static int -atom_tags_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +atom_tags_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { if (ctx == NULL || ctx->settings->posts == NULL || ctx->settings->tags == NULL) return 0; @@ -238,7 +238,7 @@ pagination_outputlist(bm_ctx_t *ctx) } static int -pagination_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +pagination_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { if (ctx == NULL || ctx->settings->posts == NULL) return 0; @@ -301,7 +301,7 @@ posts_outputlist(bm_ctx_t *ctx) } static int -posts_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +posts_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { if (ctx == NULL || ctx->settings->posts == NULL) return 0; @@ -363,7 +363,7 @@ tags_outputlist(bm_ctx_t *ctx) } static int -tags_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +tags_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { if (ctx == NULL || ctx->settings->posts == NULL || ctx->settings->tags == NULL) return 0; @@ -431,7 +431,7 @@ pages_outputlist(bm_ctx_t *ctx) } static int -pages_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +pages_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { if (ctx == NULL || ctx->settings->pages == NULL) return 0; @@ -487,7 +487,7 @@ copy_outputlist(bm_ctx_t *ctx) } static int -copy_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +copy_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { if (ctx == NULL || ctx->settings->copy == NULL) return 0; @@ -504,7 +504,7 @@ copy_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) continue; if (bm_rule_need_rebuild(s, ctx->settings_fctx, NULL, o_fctx, true)) { - rv = bm_exec_native_cp(s->data, o_fctx, verbose); + rv = bm_exec_native_cp(s->data, o_fctx, ctx->verbose); if (rv != 0) break; } @@ -523,7 +523,7 @@ clean_outputlist(bm_ctx_t *ctx) } static int -clean_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +clean_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { int rv = 0; @@ -533,7 +533,7 @@ clean_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) continue; if (fctx->readable) { - rv = bm_exec_native_rm(ctx->output_dir, fctx, verbose); + rv = bm_exec_native_rm(ctx->output_dir, fctx, ctx->verbose); if (rv != 0) break; } @@ -547,15 +547,13 @@ clean_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) } -static int all_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, - bool verbose); +static int all_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args); // RUNSERVER RULE typedef struct { bm_ctx_t *ctx; - bool verbose; bool running; } runserver_args_t; @@ -570,7 +568,7 @@ runserver_thread(void *arg) "reloader disabled!\n"); goto runserver_cleanup; } - if (0 != all_exec(args->ctx, NULL, NULL, args->verbose)) { + if (0 != all_exec(args->ctx, NULL, NULL)) { fprintf(stderr, "blogc-make: error: failed to rebuild website. " "reloader disabled!\n"); goto runserver_cleanup; @@ -584,16 +582,15 @@ runserver_cleanup: } static int -runserver_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +runserver_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { // first 'all' call is syncronous, to do a 'sanity check' - int rv = all_exec(ctx, NULL, NULL, verbose); + int rv = all_exec(ctx, NULL, NULL); if (rv != 0) return rv; runserver_args_t *r_args = bc_malloc(sizeof(runserver_args_t)); r_args->ctx = ctx; - r_args->verbose = verbose; r_args->running = true; int err; @@ -715,14 +712,14 @@ const bm_rule_t rules[] = { // ALL RULE static int -all_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args, bool verbose) +all_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { for (size_t i = 0; rules[i].name != NULL; i++) { if (!rules[i].generate_files) { continue; } - int rv = bm_rule_execute(ctx, &(rules[i]), NULL, verbose); + int rv = bm_rule_execute(ctx, &(rules[i]), NULL); if (rv != 0) { return rv; } @@ -762,7 +759,7 @@ bm_rule_parse_args(const char *sep) int -bm_rule_executor(bm_ctx_t *ctx, bc_slist_t *rule_list, bool verbose) +bm_rule_executor(bm_ctx_t *ctx, bc_slist_t *rule_list) { if (ctx == NULL) return 3; @@ -793,7 +790,7 @@ bm_rule_executor(bm_ctx_t *ctx, bc_slist_t *rule_list, bool verbose) continue; if (0 == strncmp(rule_str, rules[i].name, sep - rule_str)) { rule = &(rules[i]); - rv = bm_rule_execute(ctx, rule, args, verbose); + rv = bm_rule_execute(ctx, rule, args); if (rv != 0) return rv; } @@ -810,8 +807,7 @@ bm_rule_executor(bm_ctx_t *ctx, bc_slist_t *rule_list, bool verbose) int -bm_rule_execute(bm_ctx_t *ctx, const bm_rule_t *rule, bc_trie_t *args, - bool verbose) +bm_rule_execute(bm_ctx_t *ctx, const bm_rule_t *rule, bc_trie_t *args) { if (ctx == NULL || rule == NULL) return 3; @@ -821,7 +817,7 @@ bm_rule_execute(bm_ctx_t *ctx, const bm_rule_t *rule, bc_trie_t *args, outputs = rule->outputlist_func(ctx); } - int rv = rule->exec_func(ctx, outputs, args, verbose); + int rv = rule->exec_func(ctx, outputs, args); bc_slist_free_full(outputs, (bc_free_func_t) bm_filectx_free); diff --git a/src/blogc-make/rules.h b/src/blogc-make/rules.h index 3a04d0c..1604e13 100644 --- a/src/blogc-make/rules.h +++ b/src/blogc-make/rules.h @@ -15,7 +15,7 @@ typedef bc_slist_t* (*bm_rule_outputlist_func_t) (bm_ctx_t *ctx); typedef int (*bm_rule_exec_func_t) (bm_ctx_t *ctx, bc_slist_t *outputs, - bc_trie_t *args, bool verbose); + bc_trie_t *args); typedef struct { const char *name; @@ -26,9 +26,8 @@ typedef struct { } bm_rule_t; bc_trie_t* bm_rule_parse_args(const char *sep); -int bm_rule_executor(bm_ctx_t *ctx, bc_slist_t *rule_list, bool verbose); -int bm_rule_execute(bm_ctx_t *ctx, const bm_rule_t *rule, bc_trie_t *args, - bool verbose); +int bm_rule_executor(bm_ctx_t *ctx, bc_slist_t *rule_list); +int bm_rule_execute(bm_ctx_t *ctx, const bm_rule_t *rule, bc_trie_t *args); bool bm_rule_need_rebuild(bc_slist_t *sources, bm_filectx_t *settings, bm_filectx_t *template, bm_filectx_t *output, bool only_first_source); bc_slist_t* bm_rule_list_built_files(bm_ctx_t *ctx); -- cgit v1.2.3-18-g5258