summaryrefslogtreecommitdiff
path: root/src/journal-remote
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-04-25 12:31:45 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-04-25 12:31:45 +0200
commit8e766630f006fcb17ad575bd4f3000e2d2dc890f (patch)
tree5b80e86c17142add180769d82db29e2627874304 /src/journal-remote
parent0d6f0ea6c1994a5769704d2150ce907a1132a8c8 (diff)
downloadsystemd-8e766630f006fcb17ad575bd4f3000e2d2dc890f.tar.gz
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/journal-remote')
-rw-r--r--src/journal-remote/journal-remote-write.h1
-rw-r--r--src/journal-remote/journal-remote.c5
2 files changed, 2 insertions, 4 deletions
diff --git a/src/journal-remote/journal-remote-write.h b/src/journal-remote/journal-remote-write.h
index 0a53788d28..6cd5e66562 100644
--- a/src/journal-remote/journal-remote-write.h
+++ b/src/journal-remote/journal-remote-write.h
@@ -32,7 +32,6 @@ Writer* writer_ref(Writer *w);
Writer* writer_unref(Writer *w);
DEFINE_TRIVIAL_CLEANUP_FUNC(Writer*, writer_unref);
-#define _cleanup_writer_unref_ _cleanup_(writer_unrefp)
int writer_write(Writer *s,
struct iovec_wrapper *iovw,
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index 995083655a..81f30748e7 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -203,10 +203,9 @@ static int init_writer_hashmap(RemoteServer *s) {
return 0;
}
-static int get_writer(RemoteServer *s, const char *host,
- Writer **writer) {
+static int get_writer(RemoteServer *s, const char *host, Writer **writer) {
+ _cleanup_(writer_unrefp) Writer *w = NULL;
const void *key;
- _cleanup_writer_unref_ Writer *w = NULL;
int r;
switch(arg_split_mode) {