diff --git a/gmid.h b/gmid.h index da5a4e5..8fd974f 100644 --- a/gmid.h +++ b/gmid.h @@ -421,6 +421,5 @@ void *xcalloc(size_t, size_t); void gen_certificate(const char*, const char*, const char*); X509_STORE *load_ca(const char*); int validate_against_ca(X509_STORE*, const uint8_t*, size_t); -void dispatch_imsg(struct imsgbuf*, imsg_handlerfn**, size_t); #endif diff --git a/utils.c b/utils.c index 8b54dae..ff69a35 100644 --- a/utils.c +++ b/utils.c @@ -241,33 +241,3 @@ end: X509_STORE_CTX_free(ctx); return ret; } - -void -dispatch_imsg(struct imsgbuf *ibuf, imsg_handlerfn **handlers, size_t size) -{ - struct imsg imsg; - size_t datalen, i; - ssize_t n; - - if ((n = imsg_read(ibuf)) == -1) { - if (errno == EAGAIN || errno == EWOULDBLOCK) - return; - _exit(1); - } - - if (n == 0) - _exit(1); - - for (;;) { - if ((n = imsg_get(ibuf, &imsg)) == -1) - _exit(1); - if (n == 0) - return; - datalen = imsg.hdr.len - IMSG_HEADER_SIZE; - i = imsg.hdr.type; - if (i > (size / sizeof(imsg_handlerfn*)) || handlers[i] == NULL) - abort(); - handlers[i](ibuf, &imsg, datalen); - imsg_free(&imsg); - } -}