diff options
author | David Härdeman <david@hardeman.nu> | 2020-07-12 23:58:21 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-07-12 23:58:21 +0200 |
commit | 01eb1fe238371c3a29b22f1d06147f527285539e (patch) | |
tree | cc0301f776226dc12a109066c29a3a940c831a29 /shared | |
parent | 708f431db8dab6779dd090a1117e556340eca9cc (diff) |
Diffstat (limited to 'shared')
-rw-r--r-- | shared/utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/shared/utils.h b/shared/utils.h index b6bf51c..2bf7aae 100644 --- a/shared/utils.h +++ b/shared/utils.h @@ -188,4 +188,10 @@ static inline void fclosep(FILE **f) { } #define _cleanup_fclose_ _cleanup_(fclosep) +static inline void closedirp(DIR **d) { + if (d && *d) + closedir(*d); +} +#define _cleanup_closedir_ _cleanup_(closedirp) + #endif |