MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / luaS_newlstr

Function luaS_newlstr

other_src/lua/src/lstring.cpp:107–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106
107TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
108 GCObject *o;
109 const lua_Hash h = calchash(str, l);
110 for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)];
111 o != NULL;
112 o = o->gch.next) {
113 TString *ts = rawgco2ts(o);
114 if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) {
115 /* string may be dead */
116 if (isdead(G(L), o)) changewhite(o);
117 return ts;
118 }
119 }
120 return newlstr(L, str, l, h); /* not found */
121}
122
123
124Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {

Callers 6

LoadStringFunction · 0.70
luaV_concatFunction · 0.70
luaX_newstringFunction · 0.70
luaO_pushvfstringFunction · 0.70
lua_pushlstringFunction · 0.70
lua_concatFunction · 0.70

Calls 2

calchashFunction · 0.85
newlstrFunction · 0.70

Tested by

no test coverage detected