aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/hash-table.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmdsserver/hash-table.c')
-rw-r--r--src/libmdsserver/hash-table.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libmdsserver/hash-table.c b/src/libmdsserver/hash-table.c
index 78d5d49..2dbf8ad 100644
--- a/src/libmdsserver/hash-table.c
+++ b/src/libmdsserver/hash-table.c
@@ -388,7 +388,7 @@ size_t hash_table_marshal_size(const hash_table_t* restrict this)
}
}
- return rc + m * 3 * sizeof(size_t);
+ return rc + m * 3 * sizeof(size_t) + sizeof(int);
}
@@ -402,6 +402,9 @@ void hash_table_marshal(const hash_table_t* restrict this, char* restrict data)
{
size_t i, n = this->capacity;
+ ((int*)data)[0] = HASH_TABLE_T_VERSION;
+ data += sizeof(int) / sizeof(char);
+
((size_t*)data)[0] = this->capacity;
data += 1 * sizeof(size_t) / sizeof(char);
((float*)data)[0] = this->load_factor;
@@ -441,6 +444,9 @@ int hash_table_unmarshal(hash_table_t* restrict this, char* restrict data, remap
{
size_t i, n;
+ /* ((int*)data)[0] == HASH_TABLE_T_VERSION */
+ data += sizeof(int) / sizeof(char);
+
this->value_comparator = NULL;
this->key_comparator = NULL;
this->hasher = NULL;