diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-03-04 22:28:12 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-03-04 22:28:12 +0100 |
commit | bda4570a0273cffb60ff63743110bc7a8026216b (patch) | |
tree | 236799fc528b2c8027852b07029790235115430e /src/blogc-make/reloader.c | |
parent | 6f497276ca155173b4679e069de5b148af2905c0 (diff) | |
download | blogc-bda4570a0273cffb60ff63743110bc7a8026216b.tar.gz blogc-bda4570a0273cffb60ff63743110bc7a8026216b.tar.bz2 blogc-bda4570a0273cffb60ff63743110bc7a8026216b.zip |
make: make the reloader interface generic
this way it can run any rule, even if we don't need this feature now
Diffstat (limited to 'src/blogc-make/reloader.c')
-rw-r--r-- | src/blogc-make/reloader.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/blogc-make/reloader.c b/src/blogc-make/reloader.c index 0832ae8..a4b837d 100644 --- a/src/blogc-make/reloader.c +++ b/src/blogc-make/reloader.c @@ -30,7 +30,7 @@ bm_reloader_thread(void *arg) "reloader disabled!\n"); break; } - if (0 != reloader->rule_exec(reloader->ctx, NULL, NULL)) { + if (0 != reloader->rule_exec(reloader->ctx, reloader->outputs, reloader->args)) { fprintf(stderr, "blogc-make: error: failed to rebuild website. " "reloader disabled!\n"); break; @@ -44,10 +44,11 @@ bm_reloader_thread(void *arg) bm_reloader_t* -bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec) +bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec, + bc_slist_t *outputs, bc_trie_t *args) { // first rule_exec call is syncronous, to do a 'sanity check' - if (0 != rule_exec(ctx, NULL, NULL)) + if (0 != rule_exec(ctx, outputs, args)) return NULL; int err; @@ -70,6 +71,8 @@ bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec) bm_reloader_t *rv = bc_malloc(sizeof(bm_reloader_t)); rv->ctx = ctx; rv->rule_exec = rule_exec; + rv->outputs = outputs; + rv->args = args; rv->running = true; pthread_t thread; |