MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / b_size

Function b_size

deps/lua/src/lua_struct.c:366–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364
365
366static int b_size (lua_State *L) {
367 Header h;
368 const char *fmt = luaL_checkstring(L, 1);
369 size_t pos = 0;
370 defaultoptions(&h);
371 while (*fmt) {
372 int opt = *fmt++;
373 size_t size = optsize(L, opt, &fmt);
374 pos += gettoalign(pos, &h, opt, size);
375 if (opt == 's')
376 luaL_argerror(L, 1, "option 's' has no fixed size");
377 else if (opt == 'c' && size == 0)
378 luaL_argerror(L, 1, "option 'c0' has no fixed size");
379 if (!isalnum(opt))
380 controloptions(L, opt, &fmt, &h);
381 pos += size;
382 }
383 lua_pushinteger(L, pos);
384 return 1;
385}
386
387/* }====================================================== */
388

Callers

nothing calls this directly

Calls 5

optsizeFunction · 0.85
gettoalignFunction · 0.85
luaL_argerrorFunction · 0.85
controloptionsFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected