From: Lennart Poettering Date: Fri, 17 Nov 2017 09:32:48 +0000 (+0100) Subject: calendarspec: rework destructor to return its own type X-Git-Tag: v236~177^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c123d49fc215a87e29b28cc7f86d5197889c83f;p=platform%2Fupstream%2Fsystemd.git calendarspec: rework destructor to return its own type Let's make it more alike most of our other destructors. --- diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c index 8e406aa..6b3a9a4 100644 --- a/src/basic/calendarspec.c +++ b/src/basic/calendarspec.c @@ -51,10 +51,10 @@ static void free_chain(CalendarComponent *c) { } } -void calendar_spec_free(CalendarSpec *c) { +CalendarSpec* calendar_spec_free(CalendarSpec *c) { if (!c) - return; + return NULL; free_chain(c->year); free_chain(c->month); @@ -64,7 +64,7 @@ void calendar_spec_free(CalendarSpec *c) { free_chain(c->microsecond); free(c->timezone); - free(c); + return mfree(c); } static int component_compare(const void *_a, const void *_b) { diff --git a/src/basic/calendarspec.h b/src/basic/calendarspec.h index bd87794..d2a19dd 100644 --- a/src/basic/calendarspec.h +++ b/src/basic/calendarspec.h @@ -52,7 +52,7 @@ typedef struct CalendarSpec { CalendarComponent *microsecond; } CalendarSpec; -void calendar_spec_free(CalendarSpec *c); +CalendarSpec* calendar_spec_free(CalendarSpec *c); int calendar_spec_normalize(CalendarSpec *spec); bool calendar_spec_valid(CalendarSpec *spec);