uthash library

uthash (opens in a new tab) is a C library for manipulation of common data structures such as a list, array or hash. Library mostly works with macros which use custom defined data structures. For example, one can define a struct and use predefined uthash macros to create and manipulate a list of those structures.

The most common data structure used in the plugins is the list (opens in a new tab) data structure.

Example of list usage:

// define own data structure to create a list
typedef struct person {
    const char *name;
    unsigned int age;
} person_t;
 
// define list element
typedef struct person_element {
    person_t person;
    struct person_element *next; /* needed for singly- or doubly-linked lists */
    struct person_element *prev; /* needed for a doubly-linked list only */
} person_element_t;

Once the list element is defined, the list head can be initialized:

person_element_t *person_head = NULL;

When the list head is defined, macros provided on the utlist documentation site (opens in a new tab) can be used to manipulate list content and to add/remove elements to/from the list.