| 1607 | //////////////////////////////////////////////////////////// |
| 1608 | |
| 1609 | static int DefoldError(json_config_t* cfg, const char* format, ...) |
| 1610 | { |
| 1611 | va_list argp; |
| 1612 | va_start(argp, format); |
| 1613 | |
| 1614 | char tmp_buffer[256]; |
| 1615 | char* buffer = cfg->error_message ? cfg->error_message : tmp_buffer; |
| 1616 | size_t buffer_len = cfg->error_message ? cfg->error_message_length : sizeof(tmp_buffer); |
| 1617 | vsnprintf(buffer, buffer_len, format, argp); |
| 1618 | |
| 1619 | if (cfg->protected_mode) |
| 1620 | { |
| 1621 | return luaL_error(cfg->l, "%s", buffer); |
| 1622 | } |
| 1623 | va_end(argp); |
| 1624 | return 0; |
| 1625 | } |
| 1626 | |
| 1627 | // Note: The major difference between this function and the internal |
| 1628 | // cjson json_encode function is that we don't use the config |
no test coverage detected