]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
string-util: rename strdash_if_empty() to empty_to_dash() 8953/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 10 May 2018 16:55:46 +0000 (01:55 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 10 May 2018 16:55:46 +0000 (01:55 +0900)
src/basic/string-util.h
src/busctl/busctl.c
src/machine/machinectl.c

index 3004b924bd44f45a86709c2671821ba2be66e0e8..5a10eeabfe90371f1fbd4a2ed13b32dfcb900dd3 100644 (file)
@@ -58,7 +58,7 @@ static inline const char *empty_to_null(const char *p) {
         return isempty(p) ? NULL : p;
 }
 
-static inline const char *strdash_if_empty(const char *str) {
+static inline const char *empty_to_dash(const char *str) {
         return isempty(str) ? "-" : str;
 }
 
index f19edfd987428e1e2925351c28d885269d5b6ae8..5c65147caca84ad4ef6135486e6687c2f92777cb 100644 (file)
@@ -914,10 +914,6 @@ static int on_property(const char *interface, const char *name, const char *sign
         return 0;
 }
 
-static const char *strdash(const char *x) {
-        return isempty(x) ? "-" : x;
-}
-
 static int introspect(int argc, char **argv, void *userdata) {
         static const struct hash_ops member_hash_ops = {
                 .hash = member_hash_func,
@@ -1104,15 +1100,15 @@ static int introspect(int argc, char **argv, void *userdata) {
 
                         rv = ellipsized;
                 } else
-                        rv = strdash(m->result);
+                        rv = empty_to_dash(m->result);
 
                 printf("%s%s%-*s%s %-*s %-*s %-*s%s%s%s%s%s%s\n",
                        is_interface ? ansi_highlight() : "",
                        is_interface ? "" : ".",
-                       - !is_interface + (int) name_width, strdash(streq_ptr(m->type, "interface") ? m->interface : m->name),
+                       - !is_interface + (int) name_width, empty_to_dash(streq_ptr(m->type, "interface") ? m->interface : m->name),
                        is_interface ? ansi_normal() : "",
-                       (int) type_width, strdash(m->type),
-                       (int) signature_width, strdash(m->signature),
+                       (int) type_width, empty_to_dash(m->type),
+                       (int) signature_width, empty_to_dash(m->signature),
                        (int) result_width, rv,
                        (m->flags & SD_BUS_VTABLE_DEPRECATED) ? " deprecated" : (m->flags || m->writable ? "" : " -"),
                        (m->flags & SD_BUS_VTABLE_METHOD_NO_REPLY) ? " no-reply" : "",
index c16f54c283285e320468d7c8da9707e998524ce6..54860bd1a5b115e6480019958960069304e6c94f 100644 (file)
@@ -335,10 +335,10 @@ static int list_machines(int argc, char *argv[], void *userdata) {
                 r = table_add_many(table,
                                    TABLE_STRING, name,
                                    TABLE_STRING, class,
-                                   TABLE_STRING, strdash_if_empty(service),
-                                   TABLE_STRING, strdash_if_empty(os),
-                                   TABLE_STRING, strdash_if_empty(version_id),
-                                   TABLE_STRING, strdash_if_empty(addresses));
+                                   TABLE_STRING, empty_to_dash(service),
+                                   TABLE_STRING, empty_to_dash(os),
+                                   TABLE_STRING, empty_to_dash(version_id),
+                                   TABLE_STRING, empty_to_dash(addresses));
                 if (r < 0)
                         return log_error_errno(r, "Failed to add table row: %m");
         }