aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2012-01-23 21:05:51 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2012-01-23 21:05:51 -0200
commit291f564485d8968fc7b0d043dda5ff91a7ce604b (patch)
tree4949c3a32f797f1188963006eaafdab504649f26
parent9f1a8dbdd3ae7ec0b7ff5a916583f02135e21beb (diff)
downloadlua-291f564485d8968fc7b0d043dda5ff91a7ce604b.tar.gz
lua-291f564485d8968fc7b0d043dda5ff91a7ce604b.tar.bz2
lua-291f564485d8968fc7b0d043dda5ff91a7ce604b.zip
field 'reserved' -> 'extra' (may be used for other purposes too)
-rw-r--r--llex.c8
-rw-r--r--lobject.h2
-rw-r--r--lstring.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/llex.c b/llex.c
index b6874e8c..6a19d32c 100644
--- a/llex.c
+++ b/llex.c
@@ -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 }
diff --git a/lobject.h b/lobject.h
index 3050e4e4..a5ace499 100644
--- a/lobject.h
+++ b/lobject.h
@@ -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;
diff --git a/lstring.c b/lstring.c
index 73c3c15f..95a8a6f1 100644
--- a/lstring.c
+++ b/lstring.c
@@ -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++;