aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-colour.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-20 15:59:29 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-20 15:59:29 +0200
commit55bff1c4e022a609068a14430a1390a2be2e4ca1 (patch)
treec46dfd394de0787f744ba627fb7fba18c580afca /src/mds-colour.h
parentwork on mds-colour and list alternative to hash table (diff)
downloadmds-55bff1c4e022a609068a14430a1390a2be2e4ca1.tar.gz
mds-55bff1c4e022a609068a14430a1390a2be2e4ca1.tar.bz2
mds-55bff1c4e022a609068a14430a1390a2be2e4ca1.tar.xz
m + info: hash list
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-colour.h48
1 files changed, 13 insertions, 35 deletions
diff --git a/src/mds-colour.h b/src/mds-colour.h
index 49b07ec..c833c53 100644
--- a/src/mds-colour.h
+++ b/src/mds-colour.h
@@ -21,6 +21,8 @@
#include "mds-base.h"
+#include <libmdsserver/hash-list.h>
+
#include <stdint.h>
@@ -54,41 +56,6 @@ typedef struct colour
} colour_t;
-/**
- * Slot for a colour in a list of colours
- */
-typedef struct colour_slot
-{
- /**
- * The name of the colour, `NULL` if the slot is unused
- */
- char* name;
-
- /**
- * The index of the next unused slot,
- * only used on unused slot
- */
- size_t next_unused;
-
- /**
- * The index of the previous unused slot,
- * only used on unused slot
- */
- size_t prev_unused;
-
- /**
- * The hash of `name`
- */
- size_t name_hash;
-
- /**
- * The value of the colour
- */
- colour_t colour;
-
-} colour_slot_t;
-
-
/**
* Handle the received message
@@ -136,5 +103,16 @@ int handle_set_colour(const char* recv_name, const char* recv_remove, const char
const char* recv_red, const char* recv_green, const char* recv_blue);
+CREATE_HASH_LIST_SUBCLASS(colour_list, char* restrict, const char* restrict, colour_t)
+
+
+/**
+ * Free the key and value of an entry in a colour list
+ *
+ * @param entry The entry
+ */
+void colour_list_entry_free(colour_list_entry_t* entry);
+
+
#endif