summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2013-03-06 14:44:51 +0100
committerMichal Schmidt <mschmidt@redhat.com>2013-03-08 10:09:31 +0100
commita740c14c59907f370a6b3a3ba5a86fada88cb07e (patch)
tree6626ba3154af9ac3f050a53149586f0bf305befa /src/shared/util.h
parent5f1be48b264e4d556f688062cc6f4a1e03f9f455 (diff)
shared: inline trivial auto-cleanup functions
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 27b21f97cc..04c9fcd71e 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -519,12 +519,17 @@ void warn_melody(void);
int get_shell(char **ret);
int get_home_dir(char **ret);
-void freep(void *p);
+static inline void freep(void *p) {
+ free(*(void**) p);
+}
+
void fclosep(FILE **f);
void pclosep(FILE **f);
void closep(int *fd);
void closedirp(DIR **d);
-void umaskp(mode_t *u);
+static inline void umaskp(mode_t *u) {
+ umask(*u);
+}
_malloc_ static inline void *malloc_multiply(size_t a, size_t b) {
if (_unlikely_(b == 0 || a > ((size_t) -1) / b))