From: Lennart Poettering Date: Thu, 14 Mar 2019 18:54:46 +0000 (+0100) Subject: core: use more structured initialization X-Git-Tag: v242-rc1~14^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7dd1e315b2811fd9b2bdf26431b00998482bb173;p=thirdparty%2Fsystemd.git core: use more structured initialization --- diff --git a/src/core/dbus-timer.c b/src/core/dbus-timer.c index b9d2f3d07ee..faed632e908 100644 --- a/src/core/dbus-timer.c +++ b/src/core/dbus-timer.c @@ -194,12 +194,14 @@ static int bus_timer_set_transient_property( unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "%s=%s", base_name, format_timespan(ts, sizeof(ts), usec, USEC_PER_MSEC)); - v = new0(TimerValue, 1); + v = new(TimerValue, 1); if (!v) return -ENOMEM; - v->base = b; - v->value = usec; + *v = (TimerValue) { + .base = b, + .value = usec, + }; LIST_PREPEND(value, t->values, v); } @@ -247,12 +249,14 @@ static int bus_timer_set_transient_property( unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "%s=%s", base_name, str); - v = new0(TimerValue, 1); + v = new(TimerValue, 1); if (!v) return -ENOMEM; - v->base = b; - v->calendar_spec = TAKE_PTR(c); + *v = (TimerValue) { + .base = b, + .calendar_spec = TAKE_PTR(c), + }; LIST_PREPEND(value, t->values, v); } @@ -300,12 +304,14 @@ static int bus_timer_set_transient_property( unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "%s=%s", name, format_timespan(time, sizeof(time), usec, USEC_PER_MSEC)); - v = new0(TimerValue, 1); + v = new(TimerValue, 1); if (!v) return -ENOMEM; - v->base = b; - v->value = usec; + *v = (TimerValue) { + .base = b, + .value = usec, + }; LIST_PREPEND(value, t->values, v); } @@ -333,12 +339,14 @@ static int bus_timer_set_transient_property( unit_write_settingf(u, flags|UNIT_ESCAPE_SPECIFIERS, name, "%s=%s", name, str); - v = new0(TimerValue, 1); + v = new(TimerValue, 1); if (!v) return -ENOMEM; - v->base = TIMER_CALENDAR; - v->calendar_spec = TAKE_PTR(c); + *v = (TimerValue) { + .base = TIMER_CALENDAR, + .calendar_spec = TAKE_PTR(c), + }; LIST_PREPEND(value, t->values, v); }