chiark / gitweb /
journal: simplify match_free_if_empty
[elogind.git] / src / journal / coredumpctl.c
index 0bbfff2ecdc30aec0afac4c0eb7590822b7ac048..e1bd8621e32c9023f26ff0d59f392305fd9c7599 100644 (file)
@@ -68,10 +68,9 @@ static Set *new_matches(void) {
                 return NULL;
         }
 
-        r = set_put(set, tmp);
+        r = set_consume(set, tmp);
         if (r < 0) {
                 log_error("failed to add to set: %s", strerror(-r));
-                free(tmp);
                 set_free(set);
                 return NULL;
         }
@@ -85,6 +84,7 @@ static int help(void) {
                "Flags:\n"
                "  -o --output=FILE  Write output to FILE\n"
                "     --no-pager     Do not pipe output into a pager\n"
+               "     --no-legend    Do not print the column headers.\n\n"
 
                "Commands:\n"
                "  -h --help         Show this help\n"
@@ -125,18 +125,17 @@ static int add_match(Set *set, const char *match) {
         if (!pattern)
                 goto fail;
 
-        r = set_put(set, pattern);
+        log_debug("Adding pattern: %s", pattern);
+        r = set_consume(set, pattern);
         if (r < 0) {
-                log_error("failed to add pattern '%s': %s",
+                log_error("Failed to add pattern '%s': %s",
                           pattern, strerror(-r));
                 goto fail;
         }
-        log_debug("Added pattern: %s", pattern);
 
         return 0;
 fail:
-        free(pattern);
-        log_error("failed to add match: %s", strerror(-r));
+        log_error("Failed to add match: %s", strerror(-r));
         return r;
 }