Try to fix Coverity warning 'uninitialized scalar variable'

This commit is contained in:
twinaphex 2017-01-17 14:21:41 +01:00
parent f82e51e5e8
commit 68bb87f392

View File

@ -464,8 +464,8 @@ int libretrodb_create_index(libretrodb_t *db,
struct node_iter_ctx nictx;
struct rmsgpack_dom_value key;
libretrodb_index_t idx;
uint64_t idx_header_offset;
struct rmsgpack_dom_value item;
uint64_t idx_header_offset = 0;
libretrodb_cursor_t cur = {0};
struct rmsgpack_dom_value *field = NULL;
void *buff = NULL;
@ -474,15 +474,14 @@ int libretrodb_create_index(libretrodb_t *db,
uint64_t item_loc = libretrodb_tell(db);
bintree_t *tree = bintree_new(node_compare, &field_size);
item.type = RDT_NULL;
if (!tree || (libretrodb_cursor_open(db, &cur, NULL) != 0))
goto clean;
key.type = RDT_STRING;
key.val.string.len = strlen(field_name);
/* We know we aren't going to change it */
key.val.string.buff = (char *) field_name;
item.type = RDT_NULL;
key.val.string.buff = (char *) field_name; /* We know we aren't going to change it */
while (libretrodb_cursor_read_item(&cur, &item) == 0)
{
@ -522,9 +521,7 @@ int libretrodb_create_index(libretrodb_t *db,
buff = malloc(field_size + sizeof(uint64_t));
if (!buff)
{
goto clean;
}
memcpy(buff, field->val.binary.buff, field_size);