diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-04-25 12:31:45 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-04-25 12:31:45 +0200 |
commit | 8e766630f006fcb17ad575bd4f3000e2d2dc890f (patch) | |
tree | 5b80e86c17142add180769d82db29e2627874304 /src/shared/install.c | |
parent | Merge pull request #8807 from ChrisLesiak/systemd-update-done-mtime-fix (diff) | |
download | systemd-8e766630f006fcb17ad575bd4f3000e2d2dc890f.tar.xz systemd-8e766630f006fcb17ad575bd4f3000e2d2dc890f.zip |
tree-wide: drop redundant _cleanup_ macros (#8810)
This drops a good number of type-specific _cleanup_ macros, and patches
all users to just use the generic ones.
In most recent code we abstained from defining type-specific macros, and
this basically removes all those added already, with the exception of
the really low-level ones.
Having explicit macros for this is not too useful, as the expression
without the extra macro is generally just 2ch wider. We should generally
emphesize generic code, unless there are really good reasons for
specific code, hence let's follow this in this case too.
Note that _cleanup_free_ and similar really low-level, libc'ish, Linux
API'ish macros continue to be defined, only the really high-level OO
ones are dropped. From now on this should really be the rule: for really
low-level stuff, such as memory allocation, fd handling and so one, go
ahead and define explicit per-type macros, but for high-level, specific
program code, just use the generic _cleanup_() macro directly, in order
to keep things simple and as readable as possible for the uninitiated.
Note that before this patch some of the APIs (notable libudev ones) were
already used with the high-level macros at some places and with the
generic _cleanup_ macro at others. With this patch we hence unify on the
latter.
Diffstat (limited to 'src/shared/install.c')
-rw-r--r-- | src/shared/install.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index db4366526c..98a289cc65 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1992,7 +1992,7 @@ int unit_file_mask( UnitFileChange **changes, unsigned *n_changes) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; const char *config_path; char **i; int r; @@ -2038,7 +2038,7 @@ int unit_file_unmask( UnitFileChange **changes, unsigned *n_changes) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_set_free_free_ Set *remove_symlinks_to = NULL; _cleanup_strv_free_ char **todo = NULL; size_t n_todo = 0, n_allocated = 0; @@ -2132,7 +2132,7 @@ int unit_file_link( UnitFileChange **changes, unsigned *n_changes) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_strv_free_ char **todo = NULL; size_t n_todo = 0, n_allocated = 0; const char *config_path; @@ -2233,7 +2233,7 @@ int unit_file_revert( unsigned *n_changes) { _cleanup_set_free_free_ Set *remove_symlinks_to = NULL; - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_strv_free_ char **todo = NULL; size_t n_todo = 0, n_allocated = 0; char **i; @@ -2389,7 +2389,7 @@ int unit_file_add_dependency( UnitFileChange **changes, unsigned *n_changes) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_(install_context_done) InstallContext c = {}; UnitFileInstallInfo *i, *target_info; const char *config_path; @@ -2463,7 +2463,7 @@ int unit_file_enable( UnitFileChange **changes, unsigned *n_changes) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_(install_context_done) InstallContext c = {}; const char *config_path; UnitFileInstallInfo *i; @@ -2509,7 +2509,7 @@ int unit_file_disable( UnitFileChange **changes, unsigned *n_changes) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_(install_context_done) InstallContext c = {}; _cleanup_set_free_free_ Set *remove_symlinks_to = NULL; const char *config_path; @@ -2578,7 +2578,7 @@ int unit_file_set_default( UnitFileChange **changes, unsigned *n_changes) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_(install_context_done) InstallContext c = {}; UnitFileInstallInfo *i; const char *new_path; @@ -2613,7 +2613,7 @@ int unit_file_get_default( const char *root_dir, char **name) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_(install_context_done) InstallContext c = {}; UnitFileInstallInfo *i; char *n; @@ -2737,7 +2737,7 @@ int unit_file_get_state( const char *name, UnitFileState *ret) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; int r; assert(scope >= 0); @@ -3020,7 +3020,7 @@ int unit_file_preset( unsigned *n_changes) { _cleanup_(install_context_done) InstallContext plus = {}, minus = {}; - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_(presets_freep) Presets presets = {}; const char *config_path; char **i; @@ -3060,7 +3060,7 @@ int unit_file_preset_all( unsigned *n_changes) { _cleanup_(install_context_done) InstallContext plus = {}, minus = {}; - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; _cleanup_(presets_freep) Presets presets = {}; const char *config_path = NULL; char **i; @@ -3143,7 +3143,7 @@ int unit_file_get_list( char **states, char **patterns) { - _cleanup_lookup_paths_free_ LookupPaths paths = {}; + _cleanup_(lookup_paths_free) LookupPaths paths = {}; char **i; int r; |