From 40db61eb7a2019ced97f09a9687139f35749f4e0 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Sat, 25 Feb 2023 21:37:48 +0100 Subject: Introduce vec and hashmap Convenience macros for a hashmap and a growable vector. --- src/settings.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/settings.h') diff --git a/src/settings.h b/src/settings.h index 8d6f1f2..a2387ed 100644 --- a/src/settings.h +++ b/src/settings.h @@ -1,4 +1,5 @@ #include "command.h" +#include "hashmap.h" #include #include @@ -48,25 +49,17 @@ struct setting { /** Path of the setting. */ char path[128]; - /** Hashed path that can be used for equality checks. */ - uint32_t hash; - /** Value of the setting. */ struct setting_value value; }; +HASHMAP_ENTRY_TYPE(setting_entry, struct setting); + /** * A collection of settings. */ struct settings { - /** Settings */ - struct setting *settings; - - /** Number of settings currently in collection. */ - uint32_t nsettings; - - /** Current capacity of collection. */ - uint32_t capacity; + HASHMAP(struct setting_entry) settings; }; /** -- cgit v1.2.3