aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make
diff options
context:
space:
mode:
Diffstat (limited to 'src/blogc-make')
-rw-r--r--src/blogc-make/ctx.c20
-rw-r--r--src/blogc-make/ctx.h2
-rw-r--r--src/blogc-make/reloader.c2
3 files changed, 12 insertions, 12 deletions
diff --git a/src/blogc-make/ctx.c b/src/blogc-make/ctx.c
index 8e152da..0a3f9a0 100644
--- a/src/blogc-make/ctx.c
+++ b/src/blogc-make/ctx.c
@@ -270,20 +270,20 @@ bm_ctx_new(bm_ctx_t *base, const char *settings_file, const char *argv0,
bool
-bm_ctx_reload(bm_ctx_t *ctx)
+bm_ctx_reload(bm_ctx_t **ctx)
{
- if (ctx == NULL || ctx->settings_fctx == NULL)
+ if (*ctx == NULL || (*ctx)->settings_fctx == NULL)
return false;
- if (bm_filectx_changed(ctx->settings_fctx, NULL, NULL)) {
+ if (bm_filectx_changed((*ctx)->settings_fctx, NULL, NULL)) {
// reload everything! we could just reload settings_fctx, as this
// would force rebuilding everything, but we need to know new/deleted
// files
// needs to dup path, because it may be freed when reloading.
- char *tmp = bc_strdup(ctx->settings_fctx->path);
+ char *tmp = bc_strdup((*ctx)->settings_fctx->path);
bc_error_t *err = NULL;
- ctx = bm_ctx_new(ctx, tmp, NULL, &err);
+ *ctx = bm_ctx_new(*ctx, tmp, NULL, &err);
free(tmp);
if (err != NULL) {
bc_error_print(err, "blogc-make");
@@ -293,16 +293,16 @@ bm_ctx_reload(bm_ctx_t *ctx)
return true;
}
- bm_filectx_reload(ctx->main_template_fctx);
- bm_filectx_reload(ctx->atom_template_fctx);
+ bm_filectx_reload((*ctx)->main_template_fctx);
+ bm_filectx_reload((*ctx)->atom_template_fctx);
- for (bc_slist_t *tmp = ctx->posts_fctx; tmp != NULL; tmp = tmp->next)
+ for (bc_slist_t *tmp = (*ctx)->posts_fctx; tmp != NULL; tmp = tmp->next)
bm_filectx_reload((bm_filectx_t*) tmp->data);
- for (bc_slist_t *tmp = ctx->pages_fctx; tmp != NULL; tmp = tmp->next)
+ 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_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);
return true;
diff --git a/src/blogc-make/ctx.h b/src/blogc-make/ctx.h
index 294e0d3..2adfc94 100644
--- a/src/blogc-make/ctx.h
+++ b/src/blogc-make/ctx.h
@@ -73,7 +73,7 @@ void bm_filectx_reload(bm_filectx_t *ctx);
void bm_filectx_free(bm_filectx_t *fctx);
bm_ctx_t* bm_ctx_new(bm_ctx_t *base, const char *settings_file,
const char *argv0, bc_error_t **err);
-bool bm_ctx_reload(bm_ctx_t *ctx);
+bool bm_ctx_reload(bm_ctx_t **ctx);
void bm_ctx_free_internal(bm_ctx_t *ctx);
void bm_ctx_free(bm_ctx_t *ctx);
diff --git a/src/blogc-make/reloader.c b/src/blogc-make/reloader.c
index 0edbee7..6b30974 100644
--- a/src/blogc-make/reloader.c
+++ b/src/blogc-make/reloader.c
@@ -25,7 +25,7 @@ bm_reloader_thread(void *arg)
{
bm_reloader_t *reloader = arg;
while (reloader->running) {
- if (!bm_ctx_reload(reloader->ctx)) {
+ if (!bm_ctx_reload(&(reloader->ctx))) {
fprintf(stderr, "blogc-make: warning: failed to reload context. "
"retrying in 5 seconds ...\n\n");
sleep(5);