|
Line 0
Link Here
|
|
|
1 |
--- src/htree.c.orig 2013-07-17 08:09:12 UTC |
| 2 |
+++ src/htree.c |
| 3 |
@@ -74,23 +74,23 @@ static void split_node(HTree *tree, Node |
| 4 |
static void merge_node(HTree *tree, Node *node); |
| 5 |
static void update_node(HTree *tree, Node *node); |
| 6 |
|
| 7 |
-inline uint32_t get_pos(HTree *tree, Node *node) |
| 8 |
+static inline uint32_t get_pos(HTree *tree, Node *node) |
| 9 |
{ |
| 10 |
return (node - tree->root) - g_index[(int)node->depth]; |
| 11 |
} |
| 12 |
|
| 13 |
-inline Node *get_child(HTree *tree, Node *node, int b) |
| 14 |
+static inline Node *get_child(HTree *tree, Node *node, int b) |
| 15 |
{ |
| 16 |
int i = g_index[node->depth + 1] + (get_pos(tree, node) << 4) + b; |
| 17 |
return tree->root + i; |
| 18 |
} |
| 19 |
|
| 20 |
-inline Data* get_data(Node *node) |
| 21 |
+static inline Data* get_data(Node *node) |
| 22 |
{ |
| 23 |
return node->data; |
| 24 |
} |
| 25 |
|
| 26 |
-inline void set_data(Node *node, Data *data) |
| 27 |
+static inline void set_data(Node *node, Data *data) |
| 28 |
{ |
| 29 |
if (data != node->data) { |
| 30 |
if (node->data) free(node->data); |
| 31 |
@@ -98,7 +98,7 @@ inline void set_data(Node *node, Data *d |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
-inline uint32_t key_hash(HTree *tree, Item* it) |
| 36 |
+static inline uint32_t key_hash(HTree *tree, Item* it) |
| 37 |
{ |
| 38 |
char buf[255]; |
| 39 |
int n = dc_decode(tree->dc, buf, it->key, KEYLENGTH(it)); |
| 40 |
@@ -256,8 +256,7 @@ static void merge_node(HTree *tree, Node |
| 41 |
for (i=0; i<BUCKET_SIZE; i++){ |
| 42 |
Data *data = get_data(child+i); |
| 43 |
Item *it = data->head; |
| 44 |
- int count = (child+i)->count; |
| 45 |
- for (j=0; j < count; j++){ |
| 46 |
+ for (j=0; j < data->count; j++){ |
| 47 |
if (it->ver > 0) { |
| 48 |
add_item(tree, node, it, key_hash(tree, it), false); |
| 49 |
} // drop deleted items, ver < 0 |
| 50 |
@@ -315,7 +314,7 @@ static Item* get_item_hash(HTree* tree, |
| 51 |
return r; |
| 52 |
} |
| 53 |
|
| 54 |
-inline int hex2int(char b) |
| 55 |
+static inline int hex2int(char b) |
| 56 |
{ |
| 57 |
if (('0'<=b && b<='9') || ('a'<=b && b<='f')) { |
| 58 |
return (b>='a') ? (b-'a'+10) : (b-'0'); |
| 59 |
@@ -690,7 +689,7 @@ void ht_destroy(HTree *tree) |
| 60 |
free(tree); |
| 61 |
} |
| 62 |
|
| 63 |
-inline uint32_t keyhash(const char *s, int len) |
| 64 |
+static inline uint32_t keyhash(const char *s, int len) |
| 65 |
{ |
| 66 |
return fnv1a(s, len); |
| 67 |
} |