zygo

ncurses gopher client
Log | Files | Refs

commit 6ffd09cc2ae0778ef897aae7324d7032524625d6
parent 3f33776c6162cca7861da1d9e8ee3a27dd0fb1e4
Author: hhvn <dev@hhvn.uk>
Date:   Mon, 17 Jan 2022 13:20:34 +0000

zygo.c zygo.h: elem_create not needed

Diffstat:
Mzygo.c | 26++++++++++----------------
Mzygo.h | 1-
2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/zygo.c b/zygo.c @@ -114,30 +114,24 @@ elem_free(Elem *e) { } Elem * -elem_create(int tls, char type, char *desc, char *selector, char *server, char *port) { +elem_dup(Elem *e) { Elem *ret; + if (e) { #define DUP(str) str ? estrdup(str) : NULL - ret = emalloc(sizeof(Elem)); - ret->tls = tls; - ret->type = type; - ret->desc = DUP(desc); - ret->selector = DUP(selector); - ret->server = DUP(server); - ret->port = DUP(port); + ret = emalloc(sizeof(Elem)); + ret->tls = e->tls; + ret->type = e->type; + ret->desc = DUP(e->desc); + ret->selector = DUP(e->selector); + ret->server = DUP(e->server); + ret->port = DUP(e->port); #undef DUP + } else ret = NULL; return ret; } -Elem * -elem_dup(Elem *e) { - if (e) - return elem_create(e->tls, e->type, e->desc, e->selector, e->server, e->port); - else - return NULL; -} - char * elemtouri(Elem *e) { static char ret[BUFLEN]; diff --git a/zygo.h b/zygo.h @@ -75,7 +75,6 @@ char *estrdup(const char *str); /* Elem functions */ void elem_free(Elem *e); -Elem *elem_create(int tls, char type, char *desc, char *selector, char *server, char *port); Elem *elem_dup(Elem *e); Elem *uritoelem(const char *uri); Elem *gophertoelem(Elem *from, const char *line);