summaryrefslogtreecommitdiff
path: root/lstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'lstring.c')
-rw-r--r--lstring.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lstring.c b/lstring.c
index f99e4c37..c8e2d608 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.c,v 1.56 2001/02/09 19:53:16 roberto Exp roberto $ 2** $Id: lstring.c,v 1.57 2001/02/09 20:22:29 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*/
@@ -89,13 +89,12 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
89 89
90 90
91TString *luaS_newudata (lua_State *L, size_t s, void *udata) { 91TString *luaS_newudata (lua_State *L, size_t s, void *udata) {
92 union L_UTString *uts = (union L_UTString *)luaM_malloc(L, sizeudata(s)); 92 TString *ts = (TString *)luaM_malloc(L, sizeudata(s));
93 TString *ts = &uts->ts;
94 ts->marked = 0; 93 ts->marked = 0;
95 ts->nexthash = NULL; 94 ts->nexthash = NULL;
96 ts->len = s; 95 ts->len = s;
97 ts->u.d.tag = 0; 96 ts->u.d.tag = 0;
98 ts->u.d.value = (s > 0) ? uts+1 : udata; 97 ts->u.d.value = (s > 0) ? getstr(ts) : udata;
99 /* insert it on table */ 98 /* insert it on table */
100 newentry(L, &G(L)->udt, ts, lmod(IntPoint(ts->u.d.value), G(L)->udt.size)); 99 newentry(L, &G(L)->udt, ts, lmod(IntPoint(ts->u.d.value), G(L)->udt.size));
101 return ts; 100 return ts;