summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mandocdb.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 375b83df..2ed78b34 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -138,6 +138,7 @@ struct mdoc_handler {
static void dbclose(int);
static void dbadd(struct mpage *, struct mchars *);
static void dbadd_mlink(const struct mlink *mlink);
+static void dbadd_mlink_name(const struct mlink *mlink);
static int dbopen(int);
static void dbprune(void);
static void filescan(const char *);
@@ -1153,7 +1154,7 @@ mpages_merge(struct mchars *mc, struct mparse *mp)
*/
if (mpage_dest->pageid)
- dbadd_mlink(mlink);
+ dbadd_mlink_name(mlink);
if (NULL == mlink->next)
break;
@@ -1728,7 +1729,8 @@ putkeys(const struct mpage *mpage,
if (TYPE_Nm & v) {
htab = &names;
v &= name_mask;
- name_mask &= ~NAME_FIRST;
+ if (v & NAME_FIRST)
+ name_mask &= ~NAME_FIRST;
if (debug > 1)
say(mpage->mlinks->file,
"Adding name %*s", sz, cp);
@@ -1943,9 +1945,17 @@ dbadd_mlink(const struct mlink *mlink)
SQL_BIND_INT64(stmts[STMT_INSERT_LINK], i, mlink->mpage->pageid);
SQL_STEP(stmts[STMT_INSERT_LINK]);
sqlite3_reset(stmts[STMT_INSERT_LINK]);
+}
+
+static void
+dbadd_mlink_name(const struct mlink *mlink)
+{
+ size_t i;
+
+ dbadd_mlink(mlink);
i = 1;
- SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, NAME_FILE);
+ SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, NAME_FILE & NAME_MASK);
SQL_BIND_TEXT(stmts[STMT_INSERT_NAME], i, mlink->name);
SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, mlink->mpage->pageid);
SQL_STEP(stmts[STMT_INSERT_NAME]);