** creates a new string object */
| 96 | ** creates a new string object |
| 97 | */ |
| 98 | static 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 | /* |
no test coverage detected