small corrections (thanks to Mike Pall)

This commit is contained in:
Roberto Ierusalimschy 2004-11-01 11:33:33 -03:00
parent cfb79b1751
commit 45d566f676
1 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lstrlib.c,v 1.105 2004/08/06 17:35:38 roberto Exp roberto $ ** $Id: lstrlib.c,v 1.106 2004/08/09 13:30:33 roberto Exp roberto $
** Standard library for string operations and pattern-matching ** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -250,7 +250,7 @@ static int matchbracketclass (int c, const char *p, const char *ec) {
while (++p < ec) { while (++p < ec) {
if (*p == ESC) { if (*p == ESC) {
p++; p++;
if (match_class(c, *p)) if (match_class(c, uchar(*p)))
return sig; return sig;
} }
else if ((*(p+1) == '-') && (p+2 < ec)) { else if ((*(p+1) == '-') && (p+2 < ec)) {
@ -267,7 +267,7 @@ static int matchbracketclass (int c, const char *p, const char *ec) {
static int luaI_singlematch (int c, const char *p, const char *ep) { static int luaI_singlematch (int c, const char *p, const char *ep) {
switch (*p) { switch (*p) {
case '.': return 1; /* matches any char */ case '.': return 1; /* matches any char */
case ESC: return match_class(c, *(p+1)); case ESC: return match_class(c, uchar(*(p+1)));
case '[': return matchbracketclass(c, p, ep-1); case '[': return matchbracketclass(c, p, ep-1);
default: return (uchar(*p) == c); default: return (uchar(*p) == c);
} }
@ -393,7 +393,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
} }
default: { default: {
if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */
s = match_capture(ms, s, *(p+1)); s = match_capture(ms, s, uchar(*(p+1)));
if (s == NULL) return NULL; if (s == NULL) return NULL;
p+=2; goto init; /* else return match(ms, s, p+2) */ p+=2; goto init; /* else return match(ms, s, p+2) */
} }