diff options
| -rw-r--r-- | llex.c | 8 | ||||
| -rw-r--r-- | lobject.h | 2 | ||||
| -rw-r--r-- | lstring.c | 4 |
3 files changed, 7 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llex.c,v 2.59 2011/11/30 12:43:51 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.60 2012/01/20 18:35:36 roberto Exp roberto $ |
| 3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -67,7 +67,7 @@ void luaX_init (lua_State *L) { | |||
| 67 | for (i=0; i<NUM_RESERVED; i++) { | 67 | for (i=0; i<NUM_RESERVED; i++) { |
| 68 | TString *ts = luaS_new(L, luaX_tokens[i]); | 68 | TString *ts = luaS_new(L, luaX_tokens[i]); |
| 69 | luaS_fix(ts); /* reserved words are never collected */ | 69 | luaS_fix(ts); /* reserved words are never collected */ |
| 70 | ts->tsv.reserved = cast_byte(i+1); /* reserved word */ | 70 | ts->tsv.extra = cast_byte(i+1); /* reserved word */ |
| 71 | } | 71 | } |
| 72 | } | 72 | } |
| 73 | 73 | ||
| @@ -491,8 +491,8 @@ static int llex (LexState *ls, SemInfo *seminfo) { | |||
| 491 | ts = luaX_newstring(ls, luaZ_buffer(ls->buff), | 491 | ts = luaX_newstring(ls, luaZ_buffer(ls->buff), |
| 492 | luaZ_bufflen(ls->buff)); | 492 | luaZ_bufflen(ls->buff)); |
| 493 | seminfo->ts = ts; | 493 | seminfo->ts = ts; |
| 494 | if (ts->tsv.reserved > 0) /* reserved word? */ | 494 | if (isreserved(ts)) /* reserved word? */ |
| 495 | return ts->tsv.reserved - 1 + FIRST_RESERVED; | 495 | return ts->tsv.extra - 1 + FIRST_RESERVED; |
| 496 | else { | 496 | else { |
| 497 | return TK_NAME; | 497 | return TK_NAME; |
| 498 | } | 498 | } |
| @@ -409,7 +409,7 @@ typedef union TString { | |||
| 409 | L_Umaxalign dummy; /* ensures maximum alignment for strings */ | 409 | L_Umaxalign dummy; /* ensures maximum alignment for strings */ |
| 410 | struct { | 410 | struct { |
| 411 | CommonHeader; | 411 | CommonHeader; |
| 412 | lu_byte reserved; | 412 | lu_byte extra; /* reserved words for strings */ |
| 413 | unsigned int hash; | 413 | unsigned int hash; |
| 414 | size_t len; /* number of characters in string */ | 414 | size_t len; /* number of characters in string */ |
| 415 | } tsv; | 415 | } tsv; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 2.18 2010/05/10 18:23:45 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.19 2011/05/03 16:01:57 roberto Exp roberto $ |
| 3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -65,7 +65,7 @@ static TString *newlstr (lua_State *L, const char *str, size_t l, | |||
| 65 | ts = &luaC_newobj(L, LUA_TSTRING, totalsize, list, 0)->ts; | 65 | ts = &luaC_newobj(L, LUA_TSTRING, totalsize, list, 0)->ts; |
| 66 | ts->tsv.len = l; | 66 | ts->tsv.len = l; |
| 67 | ts->tsv.hash = h; | 67 | ts->tsv.hash = h; |
| 68 | ts->tsv.reserved = 0; | 68 | ts->tsv.extra = 0; |
| 69 | memcpy(ts+1, str, l*sizeof(char)); | 69 | memcpy(ts+1, str, l*sizeof(char)); |
| 70 | ((char *)(ts+1))[l] = '\0'; /* ending 0 */ | 70 | ((char *)(ts+1))[l] = '\0'; /* ending 0 */ |
| 71 | tb->nuse++; | 71 | tb->nuse++; |
