summaryrefslogtreecommitdiffstats
path: root/mansearch.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2012-06-08 15:06:28 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2012-06-08 15:06:28 +0000
commitb6082f77bdc720375ca18175f7baa41f15208f85 (patch)
tree674066b74b1dfb57f524992eb21345db13976910 /mansearch.c
parent825e34409a5e85b2ddeb2c79726fc4ad1bfb32ee (diff)
downloadmandoc-b6082f77bdc720375ca18175f7baa41f15208f85.tar.gz
Turn off sqlite3 synchronous mode when creating a new database.
This makes it run about 5x faster. While here, wrap some sqlite3 statements in #defines to extract errors. (Really, the warning/error/etc. macros should be functionified.)
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mansearch.c b/mansearch.c
index 2bc36fb9..1bdd9d0b 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -38,11 +38,11 @@
#include "mandocdb.h"
#include "mansearch.h"
-#define BIND_TEXT(_db, _s, _i, _v) \
+#define SQL_BIND_TEXT(_db, _s, _i, _v) \
if (SQLITE_OK != sqlite3_bind_text \
((_s), (_i)++, (_v), -1, SQLITE_STATIC)) \
fprintf(stderr, "%s\n", sqlite3_errmsg((_db)))
-#define BIND_INT64(_db, _s, _i, _v) \
+#define SQL_BIND_INT64(_db, _s, _i, _v) \
if (SQLITE_OK != sqlite3_bind_int64 \
((_s), (_i)++, (_v))) \
fprintf(stderr, "%s\n", sqlite3_errmsg((_db)))
@@ -208,13 +208,13 @@ mansearch(const struct manpaths *paths,
fprintf(stderr, "%s\n", sqlite3_errmsg(db));
if (NULL != arch)
- BIND_TEXT(db, s, j, arch);
+ SQL_BIND_TEXT(db, s, j, arch);
if (NULL != sec)
- BIND_TEXT(db, s, j, arch);
+ SQL_BIND_TEXT(db, s, j, arch);
for (ep = e; NULL != ep; ep = ep->next) {
- BIND_TEXT(db, s, j, ep->v);
- BIND_INT64(db, s, j, ep->bits);
+ SQL_BIND_TEXT(db, s, j, ep->v);
+ SQL_BIND_INT64(db, s, j, ep->bits);
}
memset(&htab, 0, sizeof(struct ohash));