diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-06-02 15:00:00 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-06-10 09:26:42 -0400 |
commit | c5a10d9ca017be6133154e09383c84c3d5b85f7c (patch) | |
tree | eeca1e7d79f9cbee14b819acf8c2e45df2096d99 /src/journal/sd-journal.c | |
parent | 696fee7d95194948f7f6a17eab93213b925a846d (diff) |
journal: simplify match_free_if_empty
Diffstat (limited to 'src/journal/sd-journal.c')
-rw-r--r-- | src/journal/sd-journal.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index cf60ebcee2..2bad243ea1 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; } |