aboutsummaryrefslogtreecommitdiff
path: root/lstring.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-23 14:17:25 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-23 14:17:25 -0300
commit39b79783297bee79db9853b63d199e120a009a8f (patch)
treec738c621c4c28d8822c2f785400786301985273b /lstring.c
parentd164e2294f73d8e69f00d95a66014514b2dd0ec0 (diff)
downloadlua-39b79783297bee79db9853b63d199e120a009a8f.tar.gz
lua-39b79783297bee79db9853b63d199e120a009a8f.tar.bz2
lua-39b79783297bee79db9853b63d199e120a009a8f.zip
first (big) step to support wide chars
Diffstat (limited to 'lstring.c')
-rw-r--r--lstring.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lstring.c b/lstring.c
index 660e9db5..7dee4285 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.c,v 1.59 2001/02/20 18:15:33 roberto Exp roberto $ 2** $Id: lstring.c,v 1.60 2001/02/22 17:15:18 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*/
@@ -63,7 +63,7 @@ static void newentry (lua_State *L, stringtable *tb, TString *ts, int h) {
63 63
64 64
65 65
66TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { 66TString *luaS_newlstr (lua_State *L, const l_char *str, size_t l) {
67 TString *ts; 67 TString *ts;
68 lu_hash h = l; /* seed */ 68 lu_hash h = l; /* seed */
69 size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ 69 size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */
@@ -81,7 +81,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
81 ts->len = l; 81 ts->len = l;
82 ts->u.s.hash = h; 82 ts->u.s.hash = h;
83 ts->u.s.constindex = 0; 83 ts->u.s.constindex = 0;
84 memcpy(getstr(ts), str, l*sizeof(char)); 84 memcpy(getstr(ts), str, l*sizeof(l_char));
85 getstr(ts)[l] = 0; /* ending 0 */ 85 getstr(ts)[l] = 0; /* ending 0 */
86 newentry(L, &G(L)->strt, ts, lmod(h, G(L)->strt.size)); /* insert it */ 86 newentry(L, &G(L)->strt, ts, lmod(h, G(L)->strt.size)); /* insert it */
87 return ts; 87 return ts;