aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mansearch.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-04-16 21:36:18 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-04-16 21:36:18 +0000
commit49218f3a03d34d07bd65bab6b920d81cb2b7499b (patch)
tree0563a8e20e2e718e65cecb2fe6166f99faaddf00 /mansearch.c
parenta63a6bea52c160a0ae3a17b7dd4931b76f84e5bd (diff)
downloadmandoc-49218f3a03d34d07bd65bab6b920d81cb2b7499b.tar.gz
mandoc-49218f3a03d34d07bd65bab6b920d81cb2b7499b.tar.zst
mandoc-49218f3a03d34d07bd65bab6b920d81cb2b7499b.zip
Rename the mpages.id column to mpages.pageid. There is no good reason
to call this kid by a different name here than in all other tables.
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/mansearch.c b/mansearch.c
index 957c56ec..1854eeca 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.31 2014/04/16 00:33:47 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.32 2014/04/16 21:36:18 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -74,7 +74,7 @@ struct expr {
};
struct match {
- uint64_t id; /* identifier in database */
+ uint64_t pageid; /* identifier in database */
char *desc; /* manual page description */
int form; /* 0 == catpage */
};
@@ -156,7 +156,7 @@ mansearch(const struct mansearch *search,
struct manpage **res, size_t *sz)
{
int fd, rc, c, indexbit;
- int64_t id;
+ int64_t pageid;
uint64_t outbit, iterbit;
char buf[PATH_MAX];
char *sql;
@@ -175,7 +175,7 @@ mansearch(const struct mansearch *search,
info.halloc = hash_halloc;
info.alloc = hash_alloc;
info.hfree = hash_free;
- info.key_offset = offsetof(struct match, id);
+ info.key_offset = offsetof(struct match, pageid);
*sz = cur = maxres = 0;
sql = NULL;
@@ -287,16 +287,16 @@ mansearch(const struct mansearch *search,
* distribution of buckets in the table.
*/
while (SQLITE_ROW == (c = sqlite3_step(s))) {
- id = sqlite3_column_int64(s, 2);
+ pageid = sqlite3_column_int64(s, 2);
idx = ohash_lookup_memory
- (&htab, (char *)&id,
- sizeof(uint64_t), (uint32_t)id);
+ (&htab, (char *)&pageid,
+ sizeof(uint64_t), (uint32_t)pageid);
if (NULL != ohash_find(&htab, idx))
continue;
mp = mandoc_calloc(1, sizeof(struct match));
- mp->id = id;
+ mp->pageid = pageid;
mp->form = sqlite3_column_int(s, 1);
if (TYPE_Nd == outbit)
mp->desc = mandoc_strdup(
@@ -332,11 +332,11 @@ mansearch(const struct mansearch *search,
}
mpage = *res + cur;
mpage->form = mp->form;
- buildnames(mpage, db, s, mp->id,
+ buildnames(mpage, db, s, mp->pageid,
paths->paths[i], mp->form);
mpage->output = TYPE_Nd & outbit ?
mp->desc : outbit ?
- buildoutput(db, s2, mp->id, outbit) : NULL;
+ buildoutput(db, s2, mp->pageid, outbit) : NULL;
free(mp);
cur++;
@@ -362,7 +362,7 @@ out:
static void
buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s,
- uint64_t id, const char *path, int form)
+ uint64_t pageid, const char *path, int form)
{
char *newnames, *prevsec, *prevarch;
const char *oldnames, *sep1, *name, *sec, *sep2, *arch, *fsec;
@@ -373,7 +373,7 @@ buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s,
mpage->names = NULL;
prevsec = prevarch = NULL;
i = 1;
- SQL_BIND_INT64(db, s, i, id);
+ SQL_BIND_INT64(db, s, i, pageid);
while (SQLITE_ROW == (c = sqlite3_step(s))) {
/* Decide whether we already have some names. */
@@ -455,7 +455,7 @@ buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s,
}
static char *
-buildoutput(sqlite3 *db, sqlite3_stmt *s, uint64_t id, uint64_t outbit)
+buildoutput(sqlite3 *db, sqlite3_stmt *s, uint64_t pageid, uint64_t outbit)
{
char *output, *newoutput;
const char *oldoutput, *sep1, *data;
@@ -464,7 +464,7 @@ buildoutput(sqlite3 *db, sqlite3_stmt *s, uint64_t id, uint64_t outbit)
output = NULL;
i = 1;
- SQL_BIND_INT64(db, s, i, id);
+ SQL_BIND_INT64(db, s, i, pageid);
SQL_BIND_INT64(db, s, i, outbit);
while (SQLITE_ROW == (c = sqlite3_step(s))) {
if (NULL == output) {
@@ -559,14 +559,14 @@ sql_statement(const struct expr *e)
: "desc MATCH ?")
: TYPE_Nm == e->bits
? (NULL == e->substr
- ? "id IN (SELECT pageid FROM names "
+ ? "pageid IN (SELECT pageid FROM names "
"WHERE name REGEXP ?)"
- : "id IN (SELECT pageid FROM names "
+ : "pageid IN (SELECT pageid FROM names "
"WHERE name MATCH ?)")
: (NULL == e->substr
- ? "id IN (SELECT pageid FROM keys "
+ ? "pageid IN (SELECT pageid FROM keys "
"WHERE key REGEXP ? AND bits & ?)"
- : "id IN (SELECT pageid FROM keys "
+ : "pageid IN (SELECT pageid FROM keys "
"WHERE key MATCH ? AND bits & ?)"), 1);
if (e->close)
sql_append(&sql, &sz, ")", e->close);