aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mansearch.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-04-20 16:46:04 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-04-20 16:46:04 +0000
commit29cecee7ff6894517a32d929aecee283bb85058c (patch)
treea8b7e1f77dc92d5398b03e113570778649b94aba /mansearch.c
parent27178e6666d82be945ee668c2530249f5c728eb6 (diff)
downloadmandoc-29cecee7ff6894517a32d929aecee283bb85058c.tar.gz
mandoc-29cecee7ff6894517a32d929aecee283bb85058c.tar.zst
mandoc-29cecee7ff6894517a32d929aecee283bb85058c.zip
KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,
remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/mansearch.c b/mansearch.c
index 97843024..fb2de009 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.33 2014/04/17 19:20:01 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.34 2014/04/20 16:46:05 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -64,7 +64,7 @@ extern const char *const mansearch_keynames[];
} while (0)
struct expr {
- uint64_t bits; /* type-mask */
+ uint64_t bits; /* type-mask */
const char *substr; /* to search for, if applicable */
regex_t regexp; /* compiled regexp, if applicable */
int open; /* opening parentheses before */
@@ -87,7 +87,7 @@ static char *buildoutput(sqlite3 *, sqlite3_stmt *,
static void *hash_alloc(size_t, void *);
static void hash_free(void *, size_t, void *);
static void *hash_halloc(size_t, void *);
-static struct expr *exprcomp(const struct mansearch *,
+static struct expr *exprcomp(const struct mansearch *,
int, char *[]);
static void exprfree(struct expr *);
static struct expr *exprspec(struct expr *, uint64_t,
@@ -101,6 +101,7 @@ static void sql_regexp(sqlite3_context *context,
int argc, sqlite3_value **argv);
static char *sql_statement(const struct expr *);
+
int
mansearch_setup(int start)
{
@@ -235,11 +236,10 @@ mansearch(const struct mansearch *search,
} else if (-1 == chdir(paths->paths[i])) {
perror(paths->paths[i]);
continue;
- }
+ }
- c = sqlite3_open_v2
- (MANDOC_DB, &db,
- SQLITE_OPEN_READONLY, NULL);
+ c = sqlite3_open_v2(MANDOC_DB, &db,
+ SQLITE_OPEN_READONLY, NULL);
if (SQLITE_OK != c) {
perror(MANDOC_DB);
@@ -288,9 +288,9 @@ mansearch(const struct mansearch *search,
*/
while (SQLITE_ROW == (c = sqlite3_step(s))) {
pageid = sqlite3_column_int64(s, 2);
- idx = ohash_lookup_memory
- (&htab, (char *)&pageid,
- sizeof(uint64_t), (uint32_t)pageid);
+ idx = ohash_lookup_memory(&htab,
+ (char *)&pageid, sizeof(uint64_t),
+ (uint32_t)pageid);
if (NULL != ohash_find(&htab, idx))
continue;
@@ -309,7 +309,7 @@ mansearch(const struct mansearch *search,
sqlite3_finalize(s);
- c = sqlite3_prepare_v2(db,
+ c = sqlite3_prepare_v2(db,
"SELECT * FROM mlinks WHERE pageid=?"
" ORDER BY sec, arch, name",
-1, &s, NULL);
@@ -327,8 +327,8 @@ mansearch(const struct mansearch *search,
mp = ohash_next(&htab, &idx)) {
if (cur + 1 > maxres) {
maxres += 1024;
- *res = mandoc_realloc
- (*res, maxres * sizeof(struct manpage));
+ *res = mandoc_realloc(*res,
+ maxres * sizeof(struct manpage));
}
mpage = *res + cur;
mpage->form = mp->form;