This commit is contained in:
Roberto Ierusalimschy 1998-06-24 10:33:00 -03:00
parent eb45f8b631
commit 468fbdbde7
2 changed files with 11 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: lstate.h,v 1.9 1998/06/02 20:37:04 roberto Exp roberto $
** $Id: lstate.h,v 1.10 1998/06/19 16:14:09 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@ -7,6 +7,8 @@
#ifndef lstate_h
#define lstate_h
#include <setjmp.h>
#include "lobject.h"
#include "lua.h"
@ -39,9 +41,11 @@ typedef struct {
} stringtable;
enum Status {LOCK, HOLD, FREE, COLLECTED};
struct ref {
TObject o;
enum {LOCK, HOLD, FREE, COLLECTED} status;
enum Status status;
};
@ -49,7 +53,7 @@ struct lua_State {
/* thread-specific state */
struct Stack stack; /* Lua stack */
struct C_Lua_Stack Cstack; /* C2lua struct */
void *errorJmp; /* current error recover point */
jmp_buf *errorJmp; /* current error recover point */
char *Mbuffer; /* global buffer */
char *Mbuffbase; /* current first position of Mbuffer */
int Mbuffsize; /* size of Mbuffer */

View File

@ -1,5 +1,5 @@
/*
** $Id: lstrlib.c,v 1.14 1998/05/31 22:20:45 roberto Exp roberto $
** $Id: lstrlib.c,v 1.15 1998/06/19 16:14:09 roberto Exp roberto $
** Standard library for strings and pattern-matching
** See Copyright Notice in lua.h
*/
@ -302,19 +302,19 @@ static char *match (char *s, char *p, struct Capture *cap)
switch (*ep) {
case '*': { /* repetition */
char *res;
if (s1 && s1>s && (res = match(s1, p, cap)))
if (s1 && s1>s && ((res=match(s1, p, cap)) != NULL))
return res;
p=ep+1; goto init; /* else return match(s, ep+1, cap); */
}
case '?': { /* optional */
char *res;
if (s1 && (res = match(s1, ep+1, cap)))
if (s1 && ((res=match(s1, ep+1, cap)) != NULL))
return res;
p=ep+1; goto init; /* else return match(s, ep+1, cap); */
}
case '-': { /* repetition */
char *res;
if ((res = match(s, ep+1, cap)) != 0)
if ((res = match(s, ep+1, cap)) != NULL)
return res;
else if (s1 && s1>s) {
s = s1;