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

Function json_cfg_encode_sparse_array

deps/lua/src/lua_cjson.c:268–277  ·  view source on GitHub ↗

Configures handling of extremely sparse arrays: * convert: Convert extremely sparse arrays into objects? Otherwise error. * ratio: 0: always allow sparse; 1: never allow sparse; >1: use ratio * safe: Always use an array when the max index <= safe */

Source from the content-addressed store, hash-verified

266 * ratio: 0: always allow sparse; 1: never allow sparse; >1: use ratio
267 * safe: Always use an array when the max index <= safe */
268static int json_cfg_encode_sparse_array(lua_State *l)
269{
270 json_config_t *cfg = json_arg_init(l, 3);
271
272 json_enum_option(l, 1, &cfg->encode_sparse_convert, NULL, 1);
273 json_integer_option(l, 2, &cfg->encode_sparse_ratio, 0, INT_MAX);
274 json_integer_option(l, 3, &cfg->encode_sparse_safe, 0, INT_MAX);
275
276 return 3;
277}
278
279/* Configures the maximum number of nested arrays/objects allowed when
280 * encoding */

Callers

nothing calls this directly

Calls 3

json_arg_initFunction · 0.85
json_enum_optionFunction · 0.85
json_integer_optionFunction · 0.85

Tested by

no test coverage detected