|
|
@ -91,15 +91,19 @@ bool hash_index_set( const char* index, const char* key, int value )
|
|
|
|
};
|
|
|
|
};
|
|
|
|
struct hash_index_entry* ptr = &new_entry;
|
|
|
|
struct hash_index_entry* ptr = &new_entry;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// Overwrite existing entries
|
|
|
|
for( int i = 0; i < ari.entries.count; ++i ) {
|
|
|
|
for( int i = 0; i < hi.entries.count; ++i ) {
|
|
|
|
struct reverse_index_entry* entry = ari.entries.items[i];
|
|
|
|
struct hash_index_entry* entry = hi.entries.items[i];
|
|
|
|
printf( "\tentry[%d] = { .uri = %s, .account_id = %d }\n", i, entry->uri, entry->account_id );
|
|
|
|
//printf( "\tentry[%d] = { .key = %s, .value = %d }\n", i, entry->key, entry->value );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( 0 == strcmp( entry->key, key ) ) {
|
|
|
|
|
|
|
|
entry->value = value;
|
|
|
|
|
|
|
|
goto exists;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
array_append( &hi.entries, sizeof(struct hash_index_entry), &ptr );
|
|
|
|
array_append( &hi.entries, sizeof(struct hash_index_entry), &ptr );
|
|
|
|
|
|
|
|
exists:
|
|
|
|
json_write_object_layout_to_file( filename, "\t", hash_index_layout, &hi );
|
|
|
|
json_write_object_layout_to_file( filename, "\t", hash_index_layout, &hi );
|
|
|
|
|
|
|
|
|
|
|
|
for( int i = 0; i < hi.entries.count-1; ++i ) {
|
|
|
|
for( int i = 0; i < hi.entries.count-1; ++i ) {
|
|
|
|