summaryrefslogtreecommitdiff
path: root/src/settings.h
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2023-02-25 21:37:48 +0100
committerAlbert Cervin <albert@acervin.com>2023-02-25 21:38:59 +0100
commit40db61eb7a2019ced97f09a9687139f35749f4e0 (patch)
tree9291e44eb82721732d04146b5042545e1b9e91f9 /src/settings.h
parent44fd8cde61e3e89e5f83c98900a403e922073727 (diff)
downloaddged-40db61eb7a2019ced97f09a9687139f35749f4e0.tar.gz
dged-40db61eb7a2019ced97f09a9687139f35749f4e0.tar.xz
dged-40db61eb7a2019ced97f09a9687139f35749f4e0.zip
Introduce vec and hashmap
Convenience macros for a hashmap and a growable vector.
Diffstat (limited to 'src/settings.h')
-rw-r--r--src/settings.h15
1 files changed, 4 insertions, 11 deletions
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 <stdbool.h>
#include <stdint.h>
@@ -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;
};
/**