cleaner way to ensure alignment for strings and userdata

This commit is contained in:
Roberto Ierusalimschy
2001-06-15 17:36:57 -03:00
parent eadf2aaaff
commit 8e586c13fc
12 changed files with 92 additions and 103 deletions

8
llex.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: llex.c,v 1.85 2001/06/07 15:01:21 roberto Exp roberto $
** $Id: llex.c,v 1.86 2001/06/13 14:25:49 roberto Exp roberto $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@@ -40,7 +40,7 @@ void luaX_init (lua_State *L) {
for (i=0; i<NUM_RESERVED; i++) {
TString *ts = luaS_new(L, token2string[i]);
lua_assert(strlen(token2string[i])+1 <= TOKEN_LEN);
ts->marked = (unsigned short)(RESERVEDMARK+i); /* reserved word */
ts->tsv.marked = (unsigned short)(RESERVEDMARK+i); /* reserved word */
}
}
@@ -370,8 +370,8 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) {
/* identifier or reserved word */
size_t l = readname(LS);
TString *ts = luaS_newlstr(LS->L, (l_char *)G(LS->L)->Mbuffer, l);
if (ts->marked >= RESERVEDMARK) /* reserved word? */
return ts->marked-RESERVEDMARK+FIRST_RESERVED;
if (ts->tsv.marked >= RESERVEDMARK) /* reserved word? */
return ts->tsv.marked-RESERVEDMARK+FIRST_RESERVED;
seminfo->ts = ts;
return TK_NAME;
}