Welcome to little lamb

Code » qmdoc » commit 6803911

Fix index handling

author Olivier Brunel
2023-07-07 15:50:23 UTC
committer Olivier Brunel
2023-07-07 16:59:36 UTC
parent 095c13a2eccf83355a4c5ba4556f08dd24f76d04

Fix index handling

src/qmdoc/qmdoc.c +4 -4

diff --git a/src/qmdoc/qmdoc.c b/src/qmdoc/qmdoc.c
index 3b3edd1..32541a6 100644
--- a/src/qmdoc/qmdoc.c
+++ b/src/qmdoc/qmdoc.c
@@ -1791,12 +1791,12 @@ scan_pages(enum idx *idx_mode, int bfd, stralloc *filesa, size_t fileoff, int nf
 
             if (*idx_mode == IDX_UNKNOWN
                     && !strcmp(ctx->sa.s + page.dstoff, "index.html")) {
-                /* OPT_INDEX or this is the first page we're adding means we're
-                 * enabling index mode, and putting this entry in the reserved
-                 * index spot.
+                /* OPT_INDEX or this is the first page we've just added means
+                 * we're enabling index mode, and putting this entry in the
+                 * reserved index spot.
                  * Else index mode is disabled (index wasn't first) and the
                  * entry will be added as any others. */
-                if ((ctx->options & OPT_INDEX) || !NB_PAGES(ctx)) {
+                if ((ctx->options & OPT_INDEX) || NB_PAGES(ctx) == 1) {
                     ENTRY(ctx)[0] = e;
                     r = 0;
                     *idx_mode = IDX_SET;