From 0b49fcb3bd9753e7fe8ef78e73493f10ef4fcd28 Mon Sep 17 00:00:00 2001 From: Kishore Nallan Date: Mon, 1 Jan 2018 21:29:47 +0530 Subject: [PATCH] Fix a few compiler warnings in art. --- src/art.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/art.cpp b/src/art.cpp index 14873f9b..6dd01a1b 100644 --- a/src/art.cpp +++ b/src/art.cpp @@ -606,7 +606,7 @@ static int prefix_mismatch(const art_node *n, const unsigned char *key, int key_ return idx; } -static void* recursive_insert(art_node *n, art_node **ref, const unsigned char *key, uint32_t key_len, art_document *document, uint32_t num_hits, int depth, int *old_val) { +static void* recursive_insert(art_node *n, art_node **ref, const unsigned char *key, uint32_t key_len, art_document *document, uint32_t num_hits, int depth, int *old) { // If we are at a NULL node, inject a leaf if (!n) { *ref = (art_node*)SET_LEAF(make_leaf(key, key_len, document)); @@ -619,15 +619,14 @@ static void* recursive_insert(art_node *n, art_node **ref, const unsigned char * // Check if we are updating an existing value if (!leaf_matches(l, key, key_len, depth)) { - *old_val = 1; + *old = 1; + art_values *ret_val = l->values; // updates are not supported - if(l->values->ids.contains(document->id)) { - return old_val; + if(!l->values->ids.contains(document->id)) { + add_document_to_leaf(document, l); } - - art_values *ret_val = l->values; - add_document_to_leaf(document, l); + return ret_val; } @@ -691,7 +690,7 @@ static void* recursive_insert(art_node *n, art_node **ref, const unsigned char * // Find a child to recurse to art_node **child = find_child(n, key[depth]); if (child) { - return recursive_insert(*child, child, key, key_len, document, num_hits, depth + 1, old_val); + return recursive_insert(*child, child, key, key_len, document, num_hits, depth + 1, old); } // No child, node goes within us