| 86 | |
| 87 | |
| 88 | static TString *LoadString (LoadState *S, Proto *p) { |
| 89 | lua_State *L = S->L; |
| 90 | size_t size = LoadByte(S); |
| 91 | TString *ts; |
| 92 | if (size == 0xFF) |
| 93 | LoadVar(S, size); |
| 94 | if (size == 0) |
| 95 | return NULL; |
| 96 | else if (--size <= LUAI_MAXSHORTLEN) { /* short string? */ |
| 97 | char buff[LUAI_MAXSHORTLEN]; |
| 98 | LoadVector(S, buff, size); |
| 99 | ts = luaS_newlstr(L, buff, size); |
| 100 | } |
| 101 | else { /* long string */ |
| 102 | ts = luaS_createlngstrobj(L, size); |
| 103 | setsvalue2s(L, L->top, ts); /* anchor it ('loadVector' can GC) */ |
| 104 | luaD_inctop(L); |
| 105 | LoadVector(S, getstr(ts), size); /* load directly in final place */ |
| 106 | L->top--; /* pop string */ |
| 107 | } |
| 108 | luaC_objbarrier(L, p, ts); |
| 109 | return ts; |
| 110 | } |
| 111 | |
| 112 | |
| 113 | static void LoadCode (LoadState *S, Proto *f) { |
no test coverage detected