[systemd-devel] [PATCH 01/17] journal: simplify match_free_if_empty
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Fri Jun 7 21:22:33 PDT 2013
---
src/journal/sd-journal.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index cf60ebc..2bad243 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -197,9 +197,7 @@ static void match_free(Match *m) {
}
static void match_free_if_empty(Match *m) {
- assert(m);
-
- if (m->matches)
+ if (!m || m->matches)
return;
match_free(m);
@@ -296,17 +294,10 @@ _public_ int sd_journal_add_match(sd_journal *j, const void *data, size_t size)
return 0;
fail:
- if (add_here)
- match_free_if_empty(add_here);
-
- if (j->level2)
- match_free_if_empty(j->level2);
-
- if (j->level1)
- match_free_if_empty(j->level1);
-
- if (j->level0)
- match_free_if_empty(j->level0);
+ match_free_if_empty(add_here);
+ match_free_if_empty(j->level2);
+ match_free_if_empty(j->level1);
+ match_free_if_empty(j->level0);
return -ENOMEM;
}
--
1.8.2.562.g931e949
More information about the systemd-devel
mailing list