From 26bb4f4a75d9561bd68a92fce7827a3c7cbae0d4 Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 15 Sep 2014 14:23:17 +0100 Subject: friendcreate() should return a pointer to the friend --- ratatox.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ratatox.c') diff --git a/ratatox.c b/ratatox.c index a3e6120..bd7aace 100644 --- a/ratatox.c +++ b/ratatox.c @@ -80,7 +80,7 @@ static int toxinit(void); static int toxconnect(void); static void id2str(uint8_t *, uint8_t *); static void str2id(uint8_t *, uint8_t *); -static void friendcreate(int32_t); +static struct friend *friendcreate(int32_t); static void friendload(void); static int cmdrun(void); static int doaccept(char *, size_t); @@ -223,7 +223,7 @@ cb_conn_status(Tox *tox, int32_t fid, uint8_t status, void *udata) } } - friendcreate(fid); + f = friendcreate(fid); blabla(f, "online", "w", status == 0 ? "0\n" : "1\n"); } @@ -467,7 +467,7 @@ str2id(uint8_t *idstr, uint8_t *id) sscanf(p, "%2hhx", &id[i]); } -static void +static struct friend * friendcreate(int32_t fid) { FILE *fp; @@ -519,6 +519,8 @@ friendcreate(int32_t fid) blabla(f, "online", "w", "0\n"); TAILQ_INSERT_TAIL(&friendhead, f, entry); + + return f; } static void -- cgit v1.2.3