| 931 | |
| 932 | #if 0 // DEFOLD |
| 933 | static int json_encode(lua_State *l) |
| 934 | { |
| 935 | json_config_t *cfg = json_fetch_config(l); |
| 936 | strbuf_t local_encode_buf; |
| 937 | strbuf_t *encode_buf; |
| 938 | char *json; |
| 939 | int len; |
| 940 | |
| 941 | luaL_argcheck(l, lua_gettop(l) == 1, 1, "expected 1 argument"); |
| 942 | |
| 943 | if (!cfg->encode_keep_buffer) { |
| 944 | /* Use private buffer */ |
| 945 | encode_buf = &local_encode_buf; |
| 946 | strbuf_init(encode_buf, 0); |
| 947 | } else { |
| 948 | /* Reuse existing buffer */ |
| 949 | encode_buf = &cfg->encode_buf; |
| 950 | strbuf_reset(encode_buf); |
| 951 | } |
| 952 | |
| 953 | json_append_data(l, cfg, 0, encode_buf); |
| 954 | json = strbuf_string(encode_buf, &len); |
| 955 | |
| 956 | lua_pushlstring(l, json, len); |
| 957 | |
| 958 | if (!cfg->encode_keep_buffer) |
| 959 | strbuf_free(encode_buf); |
| 960 | |
| 961 | return 1; |
| 962 | } |
| 963 | #endif // DEFOLD |
| 964 | |
| 965 | /////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected