MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / createstrobj

Function createstrobj

third-party/lua-5.2.4/src/lstring.c:98–110  ·  view source on GitHub ↗

** creates a new string object */

Source from the content-addressed store, hash-verified

96** creates a new string object
97*/
98static TString *createstrobj (lua_State *L, const char *str, size_t l,
99 int tag, unsigned int h, GCObject **list) {
100 TString *ts;
101 size_t totalsize; /* total size of TString object */
102 totalsize = sizeof(TString) + ((l + 1) * sizeof(char));
103 ts = &luaC_newobj(L, tag, totalsize, list, 0)->ts;
104 ts->tsv.len = l;
105 ts->tsv.hash = h;
106 ts->tsv.extra = 0;
107 memcpy(ts+1, str, l*sizeof(char));
108 ((char *)(ts+1))[l] = '\0'; /* ending 0 */
109 return ts;
110}
111
112
113/*

Callers 2

newshrstrFunction · 0.70
luaS_newlstrFunction · 0.70

Calls 1

luaC_newobjFunction · 0.70

Tested by

no test coverage detected