Static initializer for backend.

This commit is contained in:
Ian Gulliver
2016-02-15 18:44:26 +00:00
parent bb1e5cf2ff
commit 7986d40569

View File

@@ -45,6 +45,17 @@ struct peer {
struct client client;
};
};
#define PEER_BACKEND_INIT { \
.type = BACKEND, \
.backend = { \
.buf = { \
.start = 0, \
.length = 0, \
}, \
.parser_state = { 0 }, \
.parser = NULL, \
}, \
}
static int parse_opts(int argc, char *argv[], struct opts *opts) {
@@ -115,18 +126,8 @@ static int connect_backend(struct opts *opts) {
static int loop(int bfd) {
struct peer backend = {
.type = BACKEND,
.fd = bfd,
.backend = {
.buf = {
.start = 0,
.length = 0,
},
.parser_state = { 0 },
.parser = NULL,
},
};
struct peer backend = PEER_BACKEND_INIT;
backend.fd = bfd;
int efd = epoll_create1(0);
if (efd == -1) {