aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common.c7
-rw-r--r--src/kike.c7
-rw-r--r--src/zyklonb.c4
3 files changed, 7 insertions, 11 deletions
diff --git a/src/common.c b/src/common.c
index 4b72e39..96548d9 100644
--- a/src/common.c
+++ b/src/common.c
@@ -254,7 +254,9 @@ xstrndup (const char *s, size_t n)
// --- Double-linked list helpers ----------------------------------------------
-// The links of the list need to have the members `prev' and `next'.
+#define LIST_HEADER(type) \
+ struct type *next; \
+ struct type *prev;
#define LIST_PREPEND(head, link) \
BLOCK_START \
@@ -562,8 +564,7 @@ error_propagate (struct error **destination, struct error *source)
struct str_map_link
{
- struct str_map_link *next; ///< The next link in a chain
- struct str_map_link *prev; ///< The previous link in a chain
+ LIST_HEADER (str_map_link)
void *data; ///< Payload
size_t key_length; ///< Length of the key without '\0'
diff --git a/src/kike.c b/src/kike.c
index 7278363..1ca6b0c 100644
--- a/src/kike.c
+++ b/src/kike.c
@@ -215,9 +215,7 @@ enum
struct client
{
- struct client *next; ///< The next link in a chain
- struct client *prev; ///< The previous link in a chain
-
+ LIST_HEADER (client)
struct server_context *ctx; ///< Server context
int socket_fd; ///< The TCP socket
@@ -310,8 +308,7 @@ enum
struct channel_user
{
- struct channel_user *prev;
- struct channel_user *next;
+ LIST_HEADER (channel_user)
unsigned modes;
char nickname[];
diff --git a/src/zyklonb.c b/src/zyklonb.c
index b2584de..e5e8749 100644
--- a/src/zyklonb.c
+++ b/src/zyklonb.c
@@ -52,9 +52,7 @@ static struct config_item g_config_table[] =
struct plugin_data
{
- struct plugin_data *next; ///< The next link in a chain
- struct plugin_data *prev; ///< The previous link in a chain
-
+ LIST_HEADER (plugin_data)
struct bot_context *ctx; ///< Parent context
pid_t pid; ///< PID of the plugin process