-/* $Id: mandocdb.c,v 1.112 2014/01/19 22:41:25 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.114 2014/01/22 20:58:39 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
static void
mpages_merge(struct mchars *mc, struct mparse *mp)
{
+ char any[] = "any";
struct ohash_info str_info;
struct mpage *mpage;
struct mlink *mlink;
}
putkey(mpage, mpage->sec, TYPE_sec);
putkey(mpage, '\0' == *mpage->arch ?
- "any" : mpage->arch, TYPE_arch);
+ any : mpage->arch, TYPE_arch);
for (mlink = mpage->mlinks; mlink; mlink = mlink->next) {
if ('\0' != *mlink->dsec)
if ('\0' != *mlink->fsec)
putkey(mpage, mlink->fsec, TYPE_sec);
putkey(mpage, '\0' == *mlink->arch ?
- "any" : mlink->arch, TYPE_arch);
+ any : mlink->arch, TYPE_arch);
putkey(mpage, mlink->name, TYPE_Nm);
}
render_key(struct mchars *mc, struct str *key)
{
size_t sz, bsz, pos;
- char utfbuf[7], res[5];
+ char utfbuf[7], res[6];
char *buf;
const char *seq, *cpp, *val;
int len, u;
res[1] = '\t';
res[2] = ASCII_NBRSP;
res[3] = ASCII_HYPH;
- res[4] = '\0';
+ res[4] = ASCII_BREAK;
+ res[5] = '\0';
val = key->key;
bsz = strlen(val);
val += sz;
}
- if (ASCII_HYPH == *val) {
+ switch (*val) {
+ case (ASCII_HYPH):
buf[pos++] = '-';
val++;
continue;
- } else if ('\t' == *val || ASCII_NBRSP == *val) {
+ case ('\t'):
+ /* FALLTHROUGH */
+ case (ASCII_NBRSP):
buf[pos++] = ' ';
val++;
+ /* FALLTHROUGH */
+ case (ASCII_BREAK):
continue;
- } else if ('\\' != *val)
+ default:
+ break;
+ }
+ if ('\\' != *val)
break;
/* Read past the slash. */