aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2019-07-15 22:32:01 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2019-07-15 22:32:01 +0200
commitf25cef814207684104ec2b39ea1b3976118fbc14 (patch)
treeb593e46402a28eb65b15ea637101dbe541779bed
parent43a5963fb76f9e898182040a6670546f9eb301c2 (diff)
downloadblogc-f25cef814207684104ec2b39ea1b3976118fbc14.tar.gz
blogc-f25cef814207684104ec2b39ea1b3976118fbc14.tar.bz2
blogc-f25cef814207684104ec2b39ea1b3976118fbc14.zip
make: rules: minor improvements in pagination_tags
-rw-r--r--src/blogc-make/rules.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/blogc-make/rules.c b/src/blogc-make/rules.c
index 4d7a43e..591ad21 100644
--- a/src/blogc-make/rules.c
+++ b/src/blogc-make/rules.c
@@ -416,7 +416,7 @@ pagination_tags_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args)
const char *pagination_prefix = bm_ctx_settings_lookup(ctx, "pagination_prefix");
const char *html_ext = bm_ctx_settings_lookup(ctx, "html_ext");
- for (bc_slist_t *l = outputs; l != NULL; l = l->next, page++) {
+ for (bc_slist_t *l = outputs; l != NULL; l = l->next) {
bm_filectx_t *fctx = l->data;
if (fctx == NULL)
continue;
@@ -431,14 +431,14 @@ pagination_tags_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args)
// it is impossible to have more output files per tag than the whole
// amount of output pages
- for (size_t k = 0; k < bc_slist_length(outputs); k++) {
- char *j = bc_strdup_printf("%d", k + 1);
+ for (size_t k = 1; k <= bc_slist_length(outputs); k++) {
+ char *j = bc_strdup_printf("%d", k);
char *f = bm_generate_filename(ctx->short_output_dir, prefix,
j, html_ext);
free(j);
if (0 == strcmp(fctx->short_path, f)) {
tag = ctx->settings->tags[i];
- page = k + 1;
+ page = k;
b = true;
free(f);
break;