diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-06-24 10:33:00 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-06-24 10:33:00 -0300 |
| commit | 468fbdbde749d5fe221adebf115f9594067b8da4 (patch) | |
| tree | 675a310082a7fa86af2818c49606060d1c422a97 /lstrlib.c | |
| parent | eb45f8b63166ac06330dbbd2b7c9224e4db9e2ca (diff) | |
| download | lua-468fbdbde749d5fe221adebf115f9594067b8da4.tar.gz lua-468fbdbde749d5fe221adebf115f9594067b8da4.tar.bz2 lua-468fbdbde749d5fe221adebf115f9594067b8da4.zip | |
details
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; |
