fix random troff crash (Noel Hunt)
This commit is contained in:
parent
e17c64a7cd
commit
4198bd0e2e
1 changed files with 6 additions and 2 deletions
|
|
@ -400,7 +400,7 @@ static int texit(Tchar *start, Tchar *end) /* hyphenate as in tex, return # foun
|
||||||
for (i = 0; i <= nw; i++)
|
for (i = 0; i <= nw; i++)
|
||||||
cnt[i] = '0';
|
cnt[i] = '0';
|
||||||
|
|
||||||
for (wp = w; wp < w + nw; wp++) {
|
for (wp = w; wp+1 < w+nw; wp++) {
|
||||||
for (pp = trie[trieindex(*wp, *(wp+1))]; pp < nextpat; ) {
|
for (pp = trie[trieindex(*wp, *(wp+1))]; pp < nextpat; ) {
|
||||||
if (pp == 0 /* no trie entry */
|
if (pp == 0 /* no trie entry */
|
||||||
|| *pp != *wp /* no match on 1st letter */
|
|| *pp != *wp /* no match on 1st letter */
|
||||||
|
|
@ -537,5 +537,9 @@ static void fixup(void) /* build indexes of where . a b c ... start */
|
||||||
|
|
||||||
static int trieindex(int d1, int d2)
|
static int trieindex(int d1, int d2)
|
||||||
{
|
{
|
||||||
return 27 * (d1 == '.' ? 0 : d1 - 'a' + 1) + (d2 == '.' ? 0 : d2 - 'a' + 1);
|
int z;
|
||||||
|
|
||||||
|
z = 27 * (d1 == '.' ? 0 : d1 - 'a' + 1) + (d2 == '.' ? 0 : d2 - 'a' + 1);
|
||||||
|
assert(z >= 0 && z < 27*27);
|
||||||
|
return z;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue