network

low level network subjects
Log | Files | Refs | Submodules | README | git clone https://git.ne02ptzero.me/git/network

commit 851370013094aff16c61e61ffbf782118445dd85
parent c6d2d20f257097010afe494d301852fb9ce1cc5a
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Thu,  2 Mar 2017 19:43:26 +0100

Add(write_payload_resp_cat)

Diffstat:
Msrc/write_package.c | 19++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/write_package.c b/src/write_package.c @@ -229,6 +229,22 @@ static void *write_payload_resp_news(void *pkg, size_t *count) { return ret; } +static void *write_payload_resp_cat(void *pkg, size_t *count) { + resp_cat_t *resp = pkg; + void *ret; + + ret = malloc(sizeof(resp->id) + sizeof(resp->parent_id) + sizeof(resp->name_len) + + resp->name_len); + assert(ret != NULL); + + write_member(resp->id, ret, *count); + write_member(resp->parent_id, ret, *count); + write_member(resp->name_len, ret, *count); + write_string(resp->name, ret, resp->name_len, *count); + + return ret; +} + typedef void *(*write_callback)(void *, size_t *); static const write_callback arr[] = { &write_payload_auth, @@ -241,7 +257,8 @@ static const write_callback arr[] = { &write_payload_req_get_upd, &write_payload_resp_pkg, &write_payload_resp_file, - &write_payload_resp_news + &write_payload_resp_news, + &write_payload_resp_cat }; void *write_payload(package_t *pkg, size_t *count) {