diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-01-19 22:40:43 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-01-19 22:40:43 +0000 |
commit | 70815f625a6d4d6ff18515af41f747644397b6dd (patch) | |
tree | a233ffbbde219315fc3f40f18a9def23c5b9d320 /usr.bin/mandoc | |
parent | 455bbd5ebf12f01ca599046bee53cc09b81ec526 (diff) |
Always store the arch in lower-case only.
Reduces database size by ~0.5%, and by ~1.5% with -Q.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/mandocdb.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c index 0e9c8f98a17..12b2e9b87a1 100644 --- a/usr.bin/mandoc/mandocdb.c +++ b/usr.bin/mandoc/mandocdb.c @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.68 2014/01/19 00:09:33 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.69 2014/01/19 22:40:42 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -149,8 +149,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 *, @@ -954,7 +953,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; @@ -1178,10 +1177,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); } @@ -1435,7 +1439,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); |