diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-02-14 00:11:29 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-02-14 00:11:29 +0100 |
commit | 99ef1c93f0359741fd18217cd81cf2c3e0beaf7b (patch) | |
tree | 993788059d2b7b6b8989df1d5d28f259d7bab56c | |
parent | 3d93f3a5e165ec12b97a269ef8fe599981e61e92 (diff) | |
download | blogc-99ef1c93f0359741fd18217cd81cf2c3e0beaf7b.tar.gz blogc-99ef1c93f0359741fd18217cd81cf2c3e0beaf7b.tar.bz2 blogc-99ef1c93f0359741fd18217cd81cf2c3e0beaf7b.zip |
blogc-make: renamed copy_files settings to copy
-rw-r--r-- | src/blogc-make/ctx.c | 16 | ||||
-rw-r--r-- | src/blogc-make/ctx.h | 2 | ||||
-rw-r--r-- | src/blogc-make/rules.c | 20 | ||||
-rw-r--r-- | src/blogc-make/settings.c | 8 | ||||
-rw-r--r-- | src/blogc-make/settings.h | 2 | ||||
-rw-r--r-- | tests/blogc-make/check_settings.c | 12 |
6 files changed, 30 insertions, 30 deletions
diff --git a/src/blogc-make/ctx.c b/src/blogc-make/ctx.c index 2dd4f97..0e885ec 100644 --- a/src/blogc-make/ctx.c +++ b/src/blogc-make/ctx.c @@ -197,11 +197,11 @@ bm_ctx_new(bm_ctx_t *base, const char *settings_file, bc_error_t **err) } } - rv->copy_files_fctx = NULL; - if (settings->copy_files != NULL) { - for (size_t i = 0; settings->copy_files[i] != NULL; i++) { - rv->copy_files_fctx = bc_slist_append(rv->copy_files_fctx, - bm_filectx_new(rv, settings->copy_files[i])); + rv->copy_fctx = NULL; + if (settings->copy != NULL) { + for (size_t i = 0; settings->copy[i] != NULL; i++) { + rv->copy_fctx = bc_slist_append(rv->copy_fctx, + bm_filectx_new(rv, settings->copy[i])); } } @@ -241,7 +241,7 @@ bm_ctx_reload(bm_ctx_t *ctx) for (bc_slist_t *tmp = ctx->pages_fctx; tmp != NULL; tmp = tmp->next) bm_filectx_reload((bm_filectx_t*) tmp->data); - for (bc_slist_t *tmp = ctx->copy_files_fctx; tmp != NULL; tmp = tmp->next) + for (bc_slist_t *tmp = ctx->copy_fctx; tmp != NULL; tmp = tmp->next) bm_filectx_reload((bm_filectx_t*) tmp->data); } @@ -273,8 +273,8 @@ bm_ctx_free_internal(bm_ctx_t *ctx) ctx->posts_fctx = NULL; bc_slist_free_full(ctx->pages_fctx, (bc_free_func_t) bm_filectx_free); ctx->pages_fctx = NULL; - bc_slist_free_full(ctx->copy_files_fctx, (bc_free_func_t) bm_filectx_free); - ctx->copy_files_fctx = NULL; + bc_slist_free_full(ctx->copy_fctx, (bc_free_func_t) bm_filectx_free); + ctx->copy_fctx = NULL; } diff --git a/src/blogc-make/ctx.h b/src/blogc-make/ctx.h index 7b68965..df640a3 100644 --- a/src/blogc-make/ctx.h +++ b/src/blogc-make/ctx.h @@ -34,7 +34,7 @@ typedef struct { bc_slist_t *posts_fctx; bc_slist_t *pages_fctx; - bc_slist_t *copy_files_fctx; + bc_slist_t *copy_fctx; } bm_ctx_t; bm_filectx_t* bm_filectx_new(bm_ctx_t *ctx, const char *filename); diff --git a/src/blogc-make/rules.c b/src/blogc-make/rules.c index 49fc36c..9f5d9bc 100644 --- a/src/blogc-make/rules.c +++ b/src/blogc-make/rules.c @@ -475,15 +475,15 @@ pages_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bool verbose) // COPY FILES RULE static bc_slist_t* -copy_files_outputlist(bm_ctx_t *ctx) +copy_outputlist(bm_ctx_t *ctx) { - if (ctx == NULL || ctx->settings->copy_files == NULL) + if (ctx == NULL || ctx->settings->copy == NULL) return NULL; bc_slist_t *rv = NULL; const char *dir = bc_trie_lookup(ctx->settings->settings, "output_dir"); - for (size_t i = 0; ctx->settings->copy_files[i] != NULL; i++) { - char *f = bc_strdup_printf("%s/%s", dir, ctx->settings->copy_files[i]); + for (size_t i = 0; ctx->settings->copy[i] != NULL; i++) { + char *f = bc_strdup_printf("%s/%s", dir, ctx->settings->copy[i]); rv = bc_slist_append(rv, bm_filectx_new(ctx, f)); free(f); } @@ -491,16 +491,16 @@ copy_files_outputlist(bm_ctx_t *ctx) } static int -copy_files_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bool verbose) +copy_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bool verbose) { - if (ctx == NULL || ctx->settings->copy_files == NULL) + if (ctx == NULL || ctx->settings->copy == NULL) return 0; int rv = 0; bc_slist_t *s, *o; - for (s = ctx->copy_files_fctx, o = outputs; s != NULL && o != NULL; + for (s = ctx->copy_fctx, o = outputs; s != NULL && o != NULL; s = s->next, o = o->next) { bm_filectx_t *o_fctx = o->data; @@ -687,10 +687,10 @@ const bm_rule_t rules[] = { .generate_files = true, }, { - .name = "copy_files", + .name = "copy", .help = "copy static files from source directory to output directory", - .outputlist_func = copy_files_outputlist, - .exec_func = copy_files_exec, + .outputlist_func = copy_outputlist, + .exec_func = copy_exec, .generate_files = true, }, { diff --git a/src/blogc-make/settings.c b/src/blogc-make/settings.c index 3a45854..a16b9be 100644 --- a/src/blogc-make/settings.c +++ b/src/blogc-make/settings.c @@ -71,7 +71,7 @@ static const char* required_environment[] = { static const char* list_sections[] = { "posts", "pages", - "copy_files", + "copy", "tags", NULL, }; @@ -97,7 +97,7 @@ bm_settings_parse(const char *content, size_t content_len, bc_error_t **err) rv->settings = bc_trie_new(free); rv->posts = NULL; rv->pages = NULL; - rv->copy_files = NULL; + rv->copy = NULL; rv->tags = NULL; char **env = bc_config_list_keys(config, "environment"); @@ -143,7 +143,7 @@ bm_settings_parse(const char *content, size_t content_len, bc_error_t **err) rv->posts = bc_config_get_list(config, "posts"); rv->pages = bc_config_get_list(config, "pages"); - rv->copy_files = bc_config_get_list(config, "copy_files"); + rv->copy = bc_config_get_list(config, "copy"); rv->tags = bc_config_get_list(config, "tags"); cleanup: @@ -184,7 +184,7 @@ bm_settings_free(bm_settings_t *settings) bc_trie_free(settings->settings); bc_strv_free(settings->posts); bc_strv_free(settings->pages); - bc_strv_free(settings->copy_files); + bc_strv_free(settings->copy); bc_strv_free(settings->tags); free(settings); } diff --git a/src/blogc-make/settings.h b/src/blogc-make/settings.h index 87d8fe9..8ac5cd2 100644 --- a/src/blogc-make/settings.h +++ b/src/blogc-make/settings.h @@ -19,7 +19,7 @@ typedef struct { bc_trie_t *settings; char **posts; char **pages; - char **copy_files; + char **copy; char **tags; } bm_settings_t; diff --git a/tests/blogc-make/check_settings.c b/tests/blogc-make/check_settings.c index 3b19f2f..ab58cb8 100644 --- a/tests/blogc-make/check_settings.c +++ b/tests/blogc-make/check_settings.c @@ -89,7 +89,7 @@ test_settings2(void **state) "\n" " hhhh\n" "iiii\n" - "[copy_files]\n" + "[copy]\n" "jjjj\n" "kkkk\n" "llll\n"; @@ -135,11 +135,11 @@ test_settings2(void **state) assert_string_equal(s->pages[1], "eeee"); assert_string_equal(s->pages[2], "ffff"); assert_null(s->pages[3]); - assert_non_null(s->copy_files); - assert_string_equal(s->copy_files[0], "jjjj"); - assert_string_equal(s->copy_files[1], "kkkk"); - assert_string_equal(s->copy_files[2], "llll"); - assert_null(s->copy_files[3]); + assert_non_null(s->copy); + assert_string_equal(s->copy[0], "jjjj"); + assert_string_equal(s->copy[1], "kkkk"); + assert_string_equal(s->copy[2], "llll"); + assert_null(s->copy[3]); assert_non_null(s->tags); assert_string_equal(s->tags[0], "gggg"); assert_string_equal(s->tags[1], "hhhh"); |