# HG changeset patch # User David Demelier # Date 1626116843 -7200 # Node ID 69602b51c6dfba3a607ffcf98ffbc051ac993c7d # Parent f8fc0d12853def0a8c223ea49a5f86142664e7db misc: remove usage of BSD sys/queue.h (hook) diff -r f8fc0d12853d -r 69602b51c6df irccd/jsapi-hook.c --- a/irccd/jsapi-hook.c Mon Jul 12 21:03:26 2021 +0200 +++ b/irccd/jsapi-hook.c Mon Jul 12 21:07:23 2021 +0200 @@ -18,6 +18,8 @@ #include +#include + #include #include @@ -45,7 +47,7 @@ duk_push_array(ctx); - LIST_FOREACH(h, &irc.hooks, link) { + LL_FOREACH(irc.hooks, h) { duk_push_object(ctx); duk_push_string(ctx, h->name); duk_put_prop_string(ctx, -2, "name"); diff -r f8fc0d12853d -r 69602b51c6df irccd/peer.c --- a/irccd/peer.c Mon Jul 12 21:03:26 2021 +0200 +++ b/irccd/peer.c Mon Jul 12 21:07:23 2021 +0200 @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -26,7 +27,7 @@ #include #include -#include +#include #include #include @@ -216,10 +217,10 @@ fprintf(fp, "OK "); - LIST_FOREACH(h, &irc.hooks, link) { + LL_FOREACH(irc.hooks, h) { fprintf(fp, "%s", h->name); - if (LIST_NEXT(h, link)) + if (h->next) fputc(' ', fp); } diff -r f8fc0d12853d -r 69602b51c6df lib/irccd/hook.h --- a/lib/irccd/hook.h Mon Jul 12 21:03:26 2021 +0200 +++ b/lib/irccd/hook.h Mon Jul 12 21:07:23 2021 +0200 @@ -19,7 +19,6 @@ #ifndef IRCCD_HOOK_H #define IRCCD_HOOK_H -#include #include #include "limits.h" @@ -33,11 +32,9 @@ struct irc_hook { char name[IRC_ID_LEN]; char path[PATH_MAX]; - LIST_ENTRY(irc_hook) link; + struct irc_hook *next; }; -LIST_HEAD(irc_hook_list, irc_hook); - struct irc_hook * irc_hook_new(const char *, const char *); diff -r f8fc0d12853d -r 69602b51c6df lib/irccd/irccd.c --- a/lib/irccd/irccd.c Mon Jul 12 21:03:26 2021 +0200 +++ b/lib/irccd/irccd.c Mon Jul 12 21:07:23 2021 +0200 @@ -27,6 +27,8 @@ #include #include +#include + #include "config.h" #include "event.h" #include "irccd.h" @@ -144,7 +146,7 @@ struct irc_plugin *p, *ptmp, *plgcmd = NULL; struct irc_hook *h, *htmp; - LIST_FOREACH_SAFE(h, &irc.hooks, link, htmp) + LL_FOREACH_SAFE(irc.hooks, h, htmp) irc_hook_invoke(h, ev); /* @@ -537,7 +539,7 @@ assert(h); assert(!irc_bot_hook_get(h->name)); - LIST_INSERT_HEAD(&irc.hooks, h, link); + LL_PREPEND(irc.hooks, h); } struct irc_hook * @@ -545,7 +547,7 @@ { struct irc_hook *h; - LIST_FOREACH(h, &irc.hooks, link) + LL_FOREACH(irc.hooks, h) if (strcmp(h->name, name) == 0) return h; @@ -560,7 +562,7 @@ struct irc_hook *h; if ((h = irc_bot_hook_get(name))) { - LIST_REMOVE(h, link); + LL_DELETE(irc.hooks, h); irc_hook_finish(h); } } @@ -570,9 +572,10 @@ { struct irc_hook *h, *tmp; - LIST_FOREACH_SAFE(h, &irc.hooks, link, tmp) + LL_FOREACH_SAFE(irc.hooks, h, tmp) irc_hook_finish(h); - LIST_INIT(&irc.hooks); + + irc.hooks = NULL; } size_t diff -r f8fc0d12853d -r 69602b51c6df lib/irccd/irccd.h --- a/lib/irccd/irccd.h Mon Jul 12 21:03:26 2021 +0200 +++ b/lib/irccd/irccd.h Mon Jul 12 21:07:23 2021 +0200 @@ -35,7 +35,7 @@ struct irc_plugin_list plugins; struct irc_plugin_loader_list plugin_loaders; struct irc_rule_list rules; - struct irc_hook_list hooks; + struct irc_hook *hooks; } irc; void