summaryrefslogtreecommitdiff
path: root/src/libskabus/skabus_pub_end.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libskabus/skabus_pub_end.c')
-rw-r--r--src/libskabus/skabus_pub_end.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libskabus/skabus_pub_end.c b/src/libskabus/skabus_pub_end.c
new file mode 100644
index 0000000..579e83e
--- /dev/null
+++ b/src/libskabus/skabus_pub_end.c
@@ -0,0 +1,25 @@
+/* ISC license. */
+
+#include <skalibs/alloc.h>
+#include <skalibs/djbunix.h>
+#include <skalibs/genalloc.h>
+#include <skalibs/skaclient.h>
+
+#include <skabus/pub.h>
+
+static void skabus_pub_cltinfo_free (skabus_pub_cltinfo_t *p)
+{
+ fd_close(p->fd) ;
+ if (p->nfds)
+ {
+ for (size_t i = 0 ; i < p->nfds ; i++) fd_close(p->fds[i]) ;
+ alloc_free(p->fds) ;
+ }
+}
+
+void skabus_pub_end (skabus_pub_t *a)
+{
+ skaclient_end(&a->connection) ;
+ genalloc_deepfree(skabus_pub_cltinfo_t, &a->info, &skabus_pub_cltinfo_free) ;
+ a->head = 0 ;
+}