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

Function json_cfg_encode_keep_buffer

deps/lua/src/lua_cjson.c:306–324  ·  view source on GitHub ↗

Configures JSON encoding buffer persistence */

Source from the content-addressed store, hash-verified

304
305/* Configures JSON encoding buffer persistence */
306static int json_cfg_encode_keep_buffer(lua_State *l)
307{
308 json_config_t *cfg = json_arg_init(l, 1);
309 int old_value;
310
311 old_value = cfg->encode_keep_buffer;
312
313 json_enum_option(l, 1, &cfg->encode_keep_buffer, NULL, 1);
314
315 /* Init / free the buffer if the setting has changed */
316 if (old_value ^ cfg->encode_keep_buffer) {
317 if (cfg->encode_keep_buffer)
318 strbuf_init(&cfg->encode_buf, 0);
319 else
320 strbuf_free(&cfg->encode_buf);
321 }
322
323 return 1;
324}
325
326#if defined(DISABLE_INVALID_NUMBERS) && !defined(USE_INTERNAL_FPCONV)
327void json_verify_invalid_number_setting(lua_State *l, int *setting)

Callers

nothing calls this directly

Calls 4

json_arg_initFunction · 0.85
json_enum_optionFunction · 0.85
strbuf_initFunction · 0.85
strbuf_freeFunction · 0.85

Tested by

no test coverage detected