(libretro-db) Cleanup

This commit is contained in:
twinaphex 2020-07-05 02:52:56 +02:00
parent 69b457a427
commit c1634914d6

View File

@ -966,6 +966,7 @@ void *libretrodb_query_compile(libretrodb_t *db,
/* TODO/FIXME - static local variable */
static char tmp_error_buff [MAX_ERROR_LEN] = {0};
struct query *q = (struct query*)malloc(sizeof(*q));
size_t error_buff_len = sizeof(tmp_error_buff);
if (!q)
return NULL;
@ -985,24 +986,27 @@ void *libretrodb_query_compile(libretrodb_t *db,
if (query_peek(buff, "{"))
{
buff = query_parse_table(tmp_error_buff,
sizeof(tmp_error_buff), buff, &q->root, error_string);
error_buff_len, buff, &q->root, error_string);
if (*error_string)
goto error;
}
else if (isalpha((int)buff.data[buff.offset]))
buff = query_parse_method_call(tmp_error_buff,
sizeof(tmp_error_buff),
error_buff_len,
buff, &q->root, error_string);
buff = query_expect_eof(tmp_error_buff,
sizeof(tmp_error_buff), buff, error_string);
error_buff_len,
buff, error_string);
if (*error_string)
goto error;
if (!q->root.func)
{
query_raise_unexpected_eof(
tmp_error_buff, sizeof(tmp_error_buff),
tmp_error_buff,
error_buff_len,
buff.offset, error_string);
goto error;
}