@@ -61,7 +61,7 @@ rb_gen(static, tree_, tree_t, tree_node_t, tree_link, tree_cmp)
61
61
struct strings {
62
62
struct block * hashes ;
63
63
struct block * strings ;
64
- struct block * tree_nodes ;
64
+ struct block * index ;
65
65
tree_t hash_map ;
66
66
uint32_t total ;
67
67
uint32_t hash_seed ;
@@ -78,8 +78,8 @@ struct strings *strings_new() {
78
78
79
79
strings -> hashes = block_new (PAGE_SIZE );
80
80
strings -> strings = block_new (PAGE_SIZE );
81
- strings -> tree_nodes = block_new (PAGE_SIZE );
82
- if (!strings -> hashes || !strings -> strings || !strings -> tree_nodes ) {
81
+ strings -> index = block_new (PAGE_SIZE );
82
+ if (!strings -> hashes || !strings -> strings || !strings -> index ) {
83
83
goto error ;
84
84
}
85
85
@@ -97,8 +97,8 @@ struct strings *strings_new() {
97
97
if (strings -> strings ) {
98
98
block_free (strings -> strings );
99
99
}
100
- if (strings -> tree_nodes ) {
101
- block_free (strings -> tree_nodes );
100
+ if (strings -> index ) {
101
+ block_free (strings -> index );
102
102
}
103
103
free (strings );
104
104
return NULL ;
@@ -107,7 +107,7 @@ struct strings *strings_new() {
107
107
void strings_free (struct strings * strings ) {
108
108
block_free (strings -> hashes );
109
109
block_free (strings -> strings );
110
- block_free (strings -> tree_nodes );
110
+ block_free (strings -> index );
111
111
free (strings );
112
112
}
113
113
@@ -131,7 +131,7 @@ bool strings_hash_seed(struct strings *strings, uint32_t seed) {
131
131
132
132
static tree_node_t * create_node (struct strings * strings , uint32_t hash ,
133
133
const char * string ) {
134
- tree_node_t * node = block_alloc (strings -> tree_nodes , sizeof (* node ));
134
+ tree_node_t * node = block_alloc (strings -> index , sizeof (* node ));
135
135
if (UNLIKELY (!node )) {
136
136
return NULL ;
137
137
}
@@ -313,21 +313,21 @@ void strings_snapshot(const struct strings *strings,
313
313
struct strings_snapshot * snapshot ) {
314
314
block_snapshot (strings -> strings , & snapshot -> strings );
315
315
block_snapshot (strings -> hashes , & snapshot -> hashes );
316
- block_snapshot (strings -> tree_nodes , & snapshot -> tree_nodes );
316
+ block_snapshot (strings -> index , & snapshot -> index );
317
317
snapshot -> total = strings -> total ;
318
318
}
319
319
320
320
bool strings_restore (struct strings * strings ,
321
321
const struct strings_snapshot * snapshot ) {
322
- struct block * block = strings -> tree_nodes ;
323
- if (snapshot -> tree_nodes .count == block -> count &&
324
- snapshot -> tree_nodes .offset == block -> offsets [block -> count - 1 ]) {
322
+ struct block * block = strings -> index ;
323
+ if (snapshot -> index .count == block -> count &&
324
+ snapshot -> index .offset == block -> offsets [block -> count - 1 ]) {
325
325
return true;
326
326
}
327
327
328
328
if (!block_restore (strings -> strings , & snapshot -> strings ) ||
329
329
!block_restore (strings -> hashes , & snapshot -> hashes ) ||
330
- !block_restore (strings -> tree_nodes , & snapshot -> tree_nodes )) {
330
+ !block_restore (strings -> index , & snapshot -> index )) {
331
331
return false;
332
332
}
333
333
strings -> total = snapshot -> total ;
@@ -354,7 +354,7 @@ bool strings_restore(struct strings *strings,
354
354
size_t strings_allocated_bytes (const struct strings * strings ) {
355
355
return block_allocated_bytes (strings -> strings ) +
356
356
block_allocated_bytes (strings -> hashes ) +
357
- block_allocated_bytes (strings -> tree_nodes ) +
357
+ block_allocated_bytes (strings -> index ) +
358
358
sizeof (* strings );
359
359
}
360
360
0 commit comments