From a2611cdc3c6d7c615ac7057087b3060cb46f9400 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Thu, 22 Jun 2017 22:45:25 +0200 Subject: Rework constructors/destructors --- kike.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'kike.c') diff --git a/kike.c b/kike.c index 166b541..2c79d57 100644 --- a/kike.c +++ b/kike.c @@ -1739,16 +1739,14 @@ struct mode_processor struct strv *output_params; ///< Similarly for "*_params" }; -static void -mode_processor_init (struct mode_processor *self) +static struct mode_processor +mode_processor_make (void) { - memset (self, 0, sizeof *self); - - self->added = str_make (); - self->removed = str_make (); - - self->added_params = strv_make (); - self->removed_params = strv_make (); + return (struct mode_processor) + { + .added = str_make (), .added_params = strv_make (), + .removed = str_make (), .removed_params = strv_make (), + }; } static void @@ -1990,9 +1988,7 @@ static void irc_handle_chan_mode_change (struct client *c, struct channel *chan, char *params[]) { - struct mode_processor p; - mode_processor_init (&p); - + struct mode_processor p = mode_processor_make (); p.params = params; p.channel = chan; p.c = c; -- cgit v1.2.3-54-g00ecf