diff options
Diffstat (limited to 'src/mds-colour.h')
-rw-r--r-- | src/mds-colour.h | 48 |
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 |