diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-03-14 19:54:46 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-04-02 08:19:35 +0200 |
commit | 7dd1e315b2811fd9b2bdf26431b00998482bb173 (patch) | |
tree | 5252540da112a63c7dd7bd1d13c7d100e2f417e1 /src/core/dbus-timer.c | |
parent | build: install /etc/systemd/{system,user}-generators (diff) | |
download | systemd-7dd1e315b2811fd9b2bdf26431b00998482bb173.tar.xz systemd-7dd1e315b2811fd9b2bdf26431b00998482bb173.zip |
core: use more structured initialization
Diffstat (limited to '')
-rw-r--r-- | src/core/dbus-timer.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/core/dbus-timer.c b/src/core/dbus-timer.c index b9d2f3d07e..faed632e90 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); } |