aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-01-19 22:41:25 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-01-19 22:41:25 +0000
commit02fb6171e927dc407950704f91012c416172d046 (patch)
treebcd21c9833f50fa79cd36f94179b71e1624f5b80 /mandocdb.c
parent587456eef33dcb8edb32473a710464ef68decc85 (diff)
downloadmandoc-02fb6171e927dc407950704f91012c416172d046.tar.gz
mandoc-02fb6171e927dc407950704f91012c416172d046.tar.zst
mandoc-02fb6171e927dc407950704f91012c416172d046.zip
Always store the arch in lower-case only.
Reduces database size by ~0.5%, and by ~1.5% with -Q.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 467e8f86..da72aa7e 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.111 2014/01/19 00:09:38 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.112 2014/01/19 22:41:25 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -157,8 +157,7 @@ static int parse_mdoc_Nd(struct mpage *, const struct mdoc_node *);
static int parse_mdoc_Nm(struct mpage *, const struct mdoc_node *);
static int parse_mdoc_Sh(struct mpage *, const struct mdoc_node *);
static int parse_mdoc_Xr(struct mpage *, const struct mdoc_node *);
-static void putkey(const struct mpage *,
- const char *, uint64_t);
+static void putkey(const struct mpage *, char *, uint64_t);
static void putkeys(const struct mpage *,
const char *, size_t, uint64_t);
static void putmdockey(const struct mpage *,
@@ -962,7 +961,7 @@ mpages_merge(struct mchars *mc, struct mparse *mp)
struct mlink *mlink;
struct mdoc *mdoc;
struct man *man;
- const char *cp;
+ char *cp;
int match;
unsigned int pslot;
enum mandoclevel lvl;
@@ -1186,10 +1185,15 @@ parse_cat(struct mpage *mpage)
* Put a type/word pair into the word database for this particular file.
*/
static void
-putkey(const struct mpage *mpage, const char *value, uint64_t type)
+putkey(const struct mpage *mpage, char *value, uint64_t type)
{
+ char *cp;
assert(NULL != value);
+ if (TYPE_arch == type)
+ for (cp = value; *cp; cp++)
+ if (isupper((unsigned char)*cp))
+ *cp = _tolower((unsigned char)*cp);
putkeys(mpage, value, strlen(value), type);
}
@@ -1443,7 +1447,7 @@ parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_node *n)
static int
parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_node *n)
{
- const char *cp;
+ char *cp;
if (NULL == (n = n->child) || MDOC_TEXT != n->type)
return(0);