diff options
| -rw-r--r-- | bugs | 4 | ||||
| -rw-r--r-- | lstrlib.c | 6 |
2 files changed, 7 insertions, 3 deletions
| @@ -33,3 +33,7 @@ Tue Jan 27 17:12:36 EDT 1998 | |||
| 33 | Wed Jan 28 14:48:12 EDT 1998 | 33 | Wed Jan 28 14:48:12 EDT 1998 |
| 34 | >> tables can become full of "emptys" slots, and keep growing without limits. | 34 | >> tables can become full of "emptys" slots, and keep growing without limits. |
| 35 | 35 | ||
| 36 | ** lstrlib.c | ||
| 37 | Mon Mar 9 15:26:09 EST 1998 | ||
| 38 | >> gsub('a', '(b?)%1*' ...) loops (because the capture is empty). | ||
| 39 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstrlib.c,v 1.9 1998/03/06 16:54:42 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.10 1998/03/06 18:47:42 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 | */ |
| @@ -286,7 +286,7 @@ static char *match (char *s, char *p, struct Capture *cap) | |||
| 286 | switch (*ep) { | 286 | switch (*ep) { |
| 287 | case '*': { /* repetition */ | 287 | case '*': { /* repetition */ |
| 288 | char *res; | 288 | char *res; |
| 289 | if (s1 && (res = match(s1, p, cap))) | 289 | if (s1 && s1>s && (res = match(s1, p, cap))) |
| 290 | return res; | 290 | return res; |
| 291 | p=ep+1; goto init; /* else return match(s, ep+1, cap); */ | 291 | p=ep+1; goto init; /* else return match(s, ep+1, cap); */ |
| 292 | } | 292 | } |
| @@ -300,7 +300,7 @@ static char *match (char *s, char *p, struct Capture *cap) | |||
| 300 | char *res; | 300 | char *res; |
| 301 | if ((res = match(s, ep+1, cap)) != 0) | 301 | if ((res = match(s, ep+1, cap)) != 0) |
| 302 | return res; | 302 | return res; |
| 303 | else if (s1) { | 303 | else if (s1 && s1>s) { |
| 304 | s = s1; | 304 | s = s1; |
| 305 | goto init; /* return match(s1, p, cap); */ | 305 | goto init; /* return match(s1, p, cap); */ |
| 306 | } | 306 | } |
