diff options
Diffstat (limited to 'lstrlib.c')
-rw-r--r-- | lstrlib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.14 1998/05/31 22:20:45 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.15 1998/06/19 16:14:09 roberto Exp roberto $ |
3 | ** Standard library for strings and pattern-matching | 3 | ** Standard library for strings and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -302,19 +302,19 @@ static char *match (char *s, char *p, struct Capture *cap) | |||
302 | switch (*ep) { | 302 | switch (*ep) { |
303 | case '*': { /* repetition */ | 303 | case '*': { /* repetition */ |
304 | char *res; | 304 | char *res; |
305 | if (s1 && s1>s && (res = match(s1, p, cap))) | 305 | if (s1 && s1>s && ((res=match(s1, p, cap)) != NULL)) |
306 | return res; | 306 | return res; |
307 | p=ep+1; goto init; /* else return match(s, ep+1, cap); */ | 307 | p=ep+1; goto init; /* else return match(s, ep+1, cap); */ |
308 | } | 308 | } |
309 | case '?': { /* optional */ | 309 | case '?': { /* optional */ |
310 | char *res; | 310 | char *res; |
311 | if (s1 && (res = match(s1, ep+1, cap))) | 311 | if (s1 && ((res=match(s1, ep+1, cap)) != NULL)) |
312 | return res; | 312 | return res; |
313 | p=ep+1; goto init; /* else return match(s, ep+1, cap); */ | 313 | p=ep+1; goto init; /* else return match(s, ep+1, cap); */ |
314 | } | 314 | } |
315 | case '-': { /* repetition */ | 315 | case '-': { /* repetition */ |
316 | char *res; | 316 | char *res; |
317 | if ((res = match(s, ep+1, cap)) != 0) | 317 | if ((res = match(s, ep+1, cap)) != NULL) |
318 | return res; | 318 | return res; |
319 | else if (s1 && s1>s) { | 319 | else if (s1 && s1>s) { |
320 | s = s1; | 320 | s = s1; |