aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-13 22:59:54 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-13 22:59:54 +0000
commit35c319dedab41299e8ad1ec62697c36315fb88da (patch)
tree6d0023d2c650f7cadfa9c71eebdfd679f0bf3d51 /term.c
parente47784200392e2dea53b3decd3ceb23e1e2a0ca6 (diff)
downloadmandoc-35c319dedab41299e8ad1ec62697c36315fb88da.tar.gz
mandoc-35c319dedab41299e8ad1ec62697c36315fb88da.tar.zst
mandoc-35c319dedab41299e8ad1ec62697c36315fb88da.zip
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 'term.c')
-rw-r--r--term.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/term.c b/term.c
index 973b404e..4bab9034 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.253 2015/10/12 00:08:16 schwarze Exp $ */
+/* $Id: term.c,v 1.254 2015/10/13 22:59:54 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -454,12 +454,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);
}
@@ -700,13 +699,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);
}