diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2013-12-27 16:40:35 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2013-12-27 16:40:35 +0000 |
commit | c766f66a5a38d4d94ca953ff918c04ee9c2b95ca (patch) | |
tree | fd50774e8f4571443aec6590a3bcff6ac327c0b3 /mandocdb.c | |
parent | 13f6fb15011d3da3e11665ae0bf03a083112e2e6 (diff) | |
download | mandoc-c766f66a5a38d4d94ca953ff918c04ee9c2b95ca.tar.gz |
Write more than one mlink per mpage to the database.
Not yet used by apropos(1).
Diffstat (limited to 'mandocdb.c')
-rw-r--r-- | mandocdb.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -1764,6 +1764,7 @@ utf8key(struct mchars *mc, struct str *key) static void dbindex(const struct mpage *mpage, struct mchars *mc) { + struct mlink *mlink; struct str *key; const char *desc; int64_t recno; @@ -1803,13 +1804,15 @@ dbindex(const struct mpage *mpage, struct mchars *mc) recno = sqlite3_last_insert_rowid(db); sqlite3_reset(stmts[STMT_INSERT_PAGE]); - i = 1; - SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mpage->mlinks->dsec); - SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mpage->mlinks->arch); - SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mpage->mlinks->file); - SQL_BIND_INT64(stmts[STMT_INSERT_LINK], i, recno); - SQL_STEP(stmts[STMT_INSERT_LINK]); - sqlite3_reset(stmts[STMT_INSERT_LINK]); + for (mlink = mpage->mlinks; mlink; mlink = mlink->next) { + i = 1; + SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->dsec); + SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->arch); + SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->file); + SQL_BIND_INT64(stmts[STMT_INSERT_LINK], i, recno); + SQL_STEP(stmts[STMT_INSERT_LINK]); + sqlite3_reset(stmts[STMT_INSERT_LINK]); + } for (key = ohash_first(&strings, &slot); NULL != key; key = ohash_next(&strings, &slot)) { |