From 7275453d856070e018ebb91ad6d4af39c8c746e5 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 18 May 2014 23:58:59 +0200 Subject: reduce code complexity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libmdsserver/mds-message.c | 19 +++++++++++++++++++ src/libmdsserver/mds-message.h | 7 +++++++ 2 files changed, 26 insertions(+) (limited to 'src/libmdsserver') diff --git a/src/libmdsserver/mds-message.c b/src/libmdsserver/mds-message.c index bc71ca6..5051cb1 100644 --- a/src/libmdsserver/mds-message.c +++ b/src/libmdsserver/mds-message.c @@ -50,6 +50,25 @@ int mds_message_initialise(mds_message_t* restrict this) } +/** + * Zero initialise a message slot + * + * @param this Memory slot in which to store the new message + */ +void mds_message_zero_initialise(mds_message_t* restrict this) +{ + this->headers = NULL; + this->header_count = 0; + this->payload = NULL; + this->payload_size = 0; + this->payload_ptr = 0; + this->buffer = NULL; + this->buffer_size = 0; + this->buffer_ptr = 0; + this->stage = 0; +} + + /** * Release all resources in a message, should * be done even if initialisation fails diff --git a/src/libmdsserver/mds-message.h b/src/libmdsserver/mds-message.h index 6f0a61d..c6086c5 100644 --- a/src/libmdsserver/mds-message.h +++ b/src/libmdsserver/mds-message.h @@ -92,6 +92,13 @@ typedef struct mds_message */ int mds_message_initialise(mds_message_t* restrict this); +/** + * Zero initialise a message slot + * + * @param this Memory slot in which to store the new message + */ +void mds_message_zero_initialise(mds_message_t* restrict this); + /** * Release all resources in a message, should * be done even if initialisation fails -- cgit v1.2.3-70-g09d2