#if !defined(LINKEDLIST_H)
#define LINKEDLIST_H

// A node in a linked list of (key, value) string pairs
typedef struct node {
    char *key;
    char *value;
    struct node *next;
} node;

// Create a new node with copies of key and value
node *create_node(const char *key, const char *value);

// Insert a (key, value) pair at the head of the list.
// If the key already exists, update the value.
// Return the new head of the list.
node *list_insert(node *head, const char *key, const char *value);

// Search for a key in the list.
// Return the value if found, NULL otherwise.
char *list_search(node *head, const char *key);

// Free the entire list
void list_destroy(node *head);

#endif
