diff --git a/simap.h b/simap.h index 9ccd852..9107abd 100644 --- a/simap.h +++ b/simap.h @@ -140,6 +140,8 @@ static inline unsigned int get_size_padding(unsigned int size, unsigned int alig static inline uint32_t simap_elem_storage_size(const char *key) { uint32_t keysize = strlen(key); uint32_t padding = get_size_padding(keysize, 8); + /* XXX: The exactly 8byte keys need a zero terminator too (would be overridden without this) */ + padding += (keysize == 8) ? 8 : 0; return keysize + sizeof(simap_ptr64) + @@ -193,6 +195,7 @@ static inline void *simap_force_add_internal(simap_instance *map, const char *ke char *rem_str = (char *)(start_str + 1); strcpy(rem_str, key + 8); } + /* XXX: The "padding" gets automagically added by the movement of the arena here(by junk bytes)! */ /* Update previous with linkage */ if(previ != (uint32_t)-1) {