mirror of https://github.com/omar-polo/gmid.git
drop now unused dispatch_imsg
This commit is contained in:
parent
2b4ef796d7
commit
e69e1151f6
1
gmid.h
1
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
|
||||
|
|
30
utils.c
30
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue