From 1588ab5d0b96301b893d63aa342faad0e37a02ff Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Thu, 18 Feb 2016 12:27:00 +0200 Subject: throttle: Use throttle_config_init() to initialize ThrottleConfig We can currently initialize ThrottleConfig by zeroing all its fields, but this will change with the new fields to define the length of the burst periods. This patch introduces a new throttle_config_init() function and uses it to replace all memset() calls that initialize ThrottleConfig directly. Signed-off-by: Alberto Garcia Reviewed-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- util/throttle.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'util') diff --git a/util/throttle.c b/util/throttle.c index f8bf03c2e9..6a01cee892 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -171,10 +171,20 @@ void throttle_timers_attach_aio_context(ThrottleTimers *tt, tt->write_timer_cb, tt->timer_opaque); } +/* + * Initialize the ThrottleConfig structure to a valid state + * @cfg: the config to initialize + */ +void throttle_config_init(ThrottleConfig *cfg) +{ + memset(cfg, 0, sizeof(*cfg)); +} + /* To be called first on the ThrottleState */ void throttle_init(ThrottleState *ts) { memset(ts, 0, sizeof(ThrottleState)); + throttle_config_init(&ts->cfg); } /* To be called first on the ThrottleTimers */ -- cgit v1.2.1