summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-10-13 22:57:50 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-10-13 22:57:50 +0000
commitc50fea35705e12062d913205519e3a1b4b80703a (patch)
tree20fdd6861b6fd407e9da1d595e6e81655c8b2fcb /usr.bin/mandoc/term.c
parent94310d765551a9e6c4aaae651d793404f2f33c1b (diff)
Major character table cleanup:
* Use ohash(3) rather than a hand-rolled hash table. * Make the character table static in the chars.c module: There is no need to pass a pointer around, we most certainly never want to use two different character tables concurrently. * No need to keep the characters in a separate file chars.in; that merely encourages downstream porters to mess with them. * Sort the characters to agree with the mandoc_chars(7) manual page. * Specify Unicode codepoints in hex, not decimal (that's the detail that originally triggered this patch). No functional change, minus 100 LOC, and i don't see a performance change.
Diffstat (limited to 'usr.bin/mandoc/term.c')
-rw-r--r--usr.bin/mandoc/term.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index b45414808de..3cb7cdfeaaa 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: term.c,v 1.113 2015/10/12 00:07:27 schwarze Exp $ */
+/* $OpenBSD: term.c,v 1.114 2015/10/13 22:57:49 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -452,12 +452,11 @@ term_word(struct termp *p, const char *word)
break;
case ESCAPE_SPECIAL:
if (p->enc == TERMENC_ASCII) {
- cp = mchars_spec2str(p->symtab,
- seq, sz, &ssz);
+ cp = mchars_spec2str(seq, sz, &ssz);
if (cp != NULL)
encode(p, cp, ssz);
} else {
- uc = mchars_spec2cp(p->symtab, seq, sz);
+ uc = mchars_spec2cp(seq, sz);
if (uc > 0)
encode1(p, uc);
}
@@ -698,13 +697,11 @@ term_strlen(const struct termp *p, const char *cp)
break;
case ESCAPE_SPECIAL:
if (p->enc == TERMENC_ASCII) {
- rhs = mchars_spec2str(p->symtab,
- seq, ssz, &rsz);
+ rhs = mchars_spec2str(seq, ssz, &rsz);
if (rhs != NULL)
break;
} else {
- uc = mchars_spec2cp(p->symtab,
- seq, ssz);
+ uc = mchars_spec2cp(seq, ssz);
if (uc > 0)
sz += cond_width(p, uc, &skip);
}