Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/makemandb Don't use the custom tokenizer when compi...



details:   https://anonhg.NetBSD.org/src/rev/3c3846f67330
branches:  trunk
changeset: 825831:3c3846f67330
user:      abhinav <abhinav%NetBSD.org@localhost>
date:      Tue Aug 01 16:16:32 2017 +0000

description:
Don't use the custom tokenizer when compiled with debugging on

Using the custom tokenizer means one cannot interactively query the database
through the SQLite shell, thus thwarting the purpose of the debug build option.

Thanks to leot@ for reporting it.

(While there change the debug macro from DEBUG to APROPOS_DEBUG)

diffstat:

 usr.sbin/makemandb/apropos-utils.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (64 lines):

diff -r 3c24d42a1735 -r 3c3846f67330 usr.sbin/makemandb/apropos-utils.c
--- a/usr.sbin/makemandb/apropos-utils.c        Tue Aug 01 16:12:32 2017 +0000
+++ b/usr.sbin/makemandb/apropos-utils.c        Tue Aug 01 16:16:32 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apropos-utils.c,v 1.38 2017/06/18 16:24:10 abhinav Exp $       */
+/*     $NetBSD: apropos-utils.c,v 1.39 2017/08/01 16:16:32 abhinav Exp $       */
 /*-
  * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: apropos-utils.c,v 1.38 2017/06/18 16:24:10 abhinav Exp $");
+__RCSID("$NetBSD: apropos-utils.c,v 1.39 2017/08/01 16:16:32 abhinav Exp $");
 
 #include <sys/queue.h>
 #include <sys/stat.h>
@@ -81,6 +81,7 @@
        1.00    //machine
 };
 
+#ifndef APROPOS_DEBUG
 static int
 register_tokenizer(sqlite3 *db)
 {
@@ -102,6 +103,7 @@
 
        return sqlite3_finalize(stmt);
 }
+#endif
 
 /*
  * lower --
@@ -201,10 +203,12 @@
            "CREATE VIRTUAL TABLE mandb USING fts4(section, name, "
                "name_desc, desc, lib, return_vals, env, files, "
                "exit_status, diagnostics, errors, md5_hash UNIQUE, machine, "
-#ifndef DEBUG          
-               "compress=zip, uncompress=unzip, "
+#ifndef APROPOS_DEBUG          
+               "compress=zip, uncompress=unzip, tokenize=custom_apropos_tokenizer, "
+#else
+               "tokenize=porter, "
 #endif         
-               "tokenize=custom_apropos_tokenizer, notindexed=section, notindexed=md5_hash); "
+               "notindexed=section, notindexed=md5_hash); "
            //mandb_meta
            "CREATE TABLE IF NOT EXISTS mandb_meta(device, inode, mtime, "
                "file UNIQUE, md5_hash UNIQUE, id  INTEGER PRIMARY KEY); "
@@ -391,11 +395,13 @@
 
        sqlite3_extended_result_codes(db, 1);
 
+#ifndef APROPOS_DEBUG
        rc = register_tokenizer(db);
        if (rc != SQLITE_OK) {
                warnx("Unable to register custom tokenizer: %s", sqlite3_errmsg(db));
                goto error;
        }
+#endif
 
        if (create_db_flag && create_db(db) < 0) {
                warnx("%s", "Unable to create database schema");



Home | Main Index | Thread Index | Old Index