diff options
author | Simon McVittie <smcv@collabora.com> | 2018-11-16 17:30:47 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2018-11-20 12:01:12 +0000 |
commit | 3987f5a4bd75a7039e9da21d5dd01ffc1fda5063 (patch) | |
tree | add0eb68d8e1968a1d58f37cf25a8702239b92db /bus/desktop-file.h | |
parent | e1ad4e202d50cf32b93eced249cd751b78c6ce29 (diff) | |
download | dbus-3987f5a4bd75a7039e9da21d5dd01ffc1fda5063.tar.gz |
BusDesktopFile: Refactor logic to free the parser contents
Now that we have _DBUS_STRING_INIT_INVALID, we can initialize
parser.data to a value that is safe for _dbus_string_free(), which
means we can put all the cleanup through a single code path that
definitely frees everything.
(This is just refactoring, not a correctness fix.)
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'bus/desktop-file.h')
-rw-r--r-- | bus/desktop-file.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bus/desktop-file.h b/bus/desktop-file.h index 14477387..82c7e269 100644 --- a/bus/desktop-file.h +++ b/bus/desktop-file.h @@ -53,5 +53,10 @@ dbus_bool_t bus_desktop_file_get_string (BusDesktopFile *desktop_file, char **val, DBusError *error); +static inline void +bus_clear_desktop_file (BusDesktopFile **desktop_p) +{ + _dbus_clear_pointer_impl (BusDesktopFile, desktop_p, bus_desktop_file_free); +} #endif /* BUS_DESKTOP_FILE_H */ |