blob: ea10582eeba962bb9e1057f291742c62df590023 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
if (complement) {
Zero(tbl, 256, short);
for (i = 0; i < tlen; i++)
tbl[t[i] & 0377] = -1;
for (i = 0, j = 0; i < 256; i++) {
if (!tbl[i]) {
if (j >= rlen) {
if (delete)
tbl[i] = -2;
else if (rlen)
tbl[i] = r[j-1] & 0377;
else
tbl[i] = i;
}
else
tbl[i] = r[j++] & 0377;
}
}
}
else {
if (!rlen && !delete) {
r = t; rlen = tlen;
}
for (i = 0; i < 256; i++)
tbl[i] = -1;
for (i = 0, j = 0; i < tlen; i++,j++) {
if (j >= rlen) {
if (delete) {
if (tbl[t[i] & 0377] == -1)
tbl[t[i] & 0377] = -2;
continue;
}
--j;
}
if (tbl[t[i] & 0377] == -1)
tbl[t[i] & 0377] = r[j] & 0377;
}
}
sv_free(tstr);
sv_free(rstr);
|