blob: 6e0104c3d4c9292edcc5f45db376269f583d871d (
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
|
diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c
index caf9519..13c2c3d 100644
--- a/sbr/m_getfld.c
+++ b/sbr/m_getfld.c
@@ -731,18 +731,18 @@ matchc(int patln, char *pat, int strln, char *str)
register char *ep = pat + patln;
register char pc = *pat++;
- for(;;) {
- while (pc != *str++)
- if (str > es)
- return 0;
+ for(;str <= es; str++) {
+ if (pc != *str)
+ continue;
if (str > es+1)
return 0;
- sp = str; pp = pat;
+ sp = str+1; pp = pat;
while (pp < ep && *sp++ == *pp)
pp++;
if (pp >= ep)
- return ((unsigned char *)--str);
+ return ((unsigned char *)str);
}
+ return 0;
}
|