]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use JSON_BUILD_PAIR_ENUM() more often
authorLennart Poettering <lennart@amutable.com>
Tue, 14 Apr 2026 10:29:52 +0000 (12:29 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 14 Apr 2026 11:58:36 +0000 (13:58 +0200)
src/import/import-generator.c
src/import/importd.c
src/login/logind-varlink.c
src/login/pam_systemd.c
src/repart/repart.c

index 9803ad284140e87ebdc0dc9708c7a3dd862ce0a9..f176492a54c93996349ce069040f45cdb1bb9999 100644 (file)
@@ -211,10 +211,10 @@ static int parse_pull_expression(const char *v) {
                         &j,
                         SD_JSON_BUILD_PAIR_STRING("remote", remote),
                         SD_JSON_BUILD_PAIR_STRING("local", local),
-                        SD_JSON_BUILD_PAIR("class", JSON_BUILD_STRING_UNDERSCORIFY(image_class_to_string(class))),
-                        SD_JSON_BUILD_PAIR("type", JSON_BUILD_STRING_UNDERSCORIFY(import_type_to_string(type))),
+                        JSON_BUILD_PAIR_ENUM("class", image_class_to_string(class)),
+                        JSON_BUILD_PAIR_ENUM("type", import_type_to_string(type)),
                         SD_JSON_BUILD_PAIR_BOOLEAN("readOnly", ro),
-                        SD_JSON_BUILD_PAIR("verify", JSON_BUILD_STRING_UNDERSCORIFY(import_verify_to_string(verify))),
+                        JSON_BUILD_PAIR_ENUM("verify", import_verify_to_string(verify)),
                         SD_JSON_BUILD_PAIR_STRING("imageRoot", image_root));
         if (r < 0)
                 return log_error_errno(r, "Failed to build import JSON object: %m");
index 5e733f757ab07eba5becebf6711e256cfd1bd155..c329491386cf08139868c3c6e63116d04a95afa7 100644 (file)
@@ -1804,10 +1804,10 @@ static int make_transfer_json(Transfer *t, sd_json_variant **ret) {
 
         r = sd_json_buildo(ret,
                            SD_JSON_BUILD_PAIR_UNSIGNED("id", t->id),
-                           SD_JSON_BUILD_PAIR("type", JSON_BUILD_STRING_UNDERSCORIFY(transfer_type_to_string(t->type))),
+                           JSON_BUILD_PAIR_ENUM("type", transfer_type_to_string(t->type)),
                            SD_JSON_BUILD_PAIR_STRING("remote", t->remote),
                            SD_JSON_BUILD_PAIR_STRING("local", t->local),
-                           SD_JSON_BUILD_PAIR("class", JSON_BUILD_STRING_UNDERSCORIFY(image_class_to_string(t->class))),
+                           JSON_BUILD_PAIR_ENUM("class", image_class_to_string(t->class)),
                            SD_JSON_BUILD_PAIR_REAL("percent", transfer_percent_as_double(t)));
         if (r < 0)
                 return log_error_errno(r, "Failed to build transfer JSON data: %m");
index 40dee113c4292d7d43aa432340e613bf9c6f8ffb..56b02b4eb2eee86b1f4859bee9de7b0998bc8b4b 100644 (file)
@@ -130,8 +130,8 @@ int session_send_create_reply_varlink(Session *s, const sd_bus_error *error) {
                         SD_JSON_BUILD_PAIR_UNSIGNED("UID", s->user->user_record->uid),
                         SD_JSON_BUILD_PAIR_CONDITION(!!s->seat, "Seat", SD_JSON_BUILD_STRING(s->seat ? s->seat->id : NULL)),
                         SD_JSON_BUILD_PAIR_CONDITION(s->vtnr > 0, "VTNr", SD_JSON_BUILD_UNSIGNED(s->vtnr)),
-                        SD_JSON_BUILD_PAIR("Class", JSON_BUILD_STRING_UNDERSCORIFY(session_class_to_string(s->class))),
-                        SD_JSON_BUILD_PAIR("Type", JSON_BUILD_STRING_UNDERSCORIFY(session_type_to_string(s->type))));
+                        JSON_BUILD_PAIR_ENUM("Class", session_class_to_string(s->class)),
+                        JSON_BUILD_PAIR_ENUM("Type", session_type_to_string(s->type)));
 }
 
 static JSON_DISPATCH_ENUM_DEFINE(json_dispatch_session_class, SessionClass, session_class_from_string);
index ec862e7d4fd21255b137b501600bc41917542002..6c70b8b1af158d91b0fa17d88a54581b67144d12 100644 (file)
@@ -1144,8 +1144,8 @@ static int register_session(
                                         SD_JSON_BUILD_PAIR_UNSIGNED("UID", ur->uid),
                                         JSON_BUILD_PAIR_PIDREF("PID", &pidref),
                                         JSON_BUILD_PAIR_STRING_NON_EMPTY("Service", c->service),
-                                        SD_JSON_BUILD_PAIR("Type", JSON_BUILD_STRING_UNDERSCORIFY(c->type)),
-                                        SD_JSON_BUILD_PAIR("Class", JSON_BUILD_STRING_UNDERSCORIFY(c->class)),
+                                        JSON_BUILD_PAIR_ENUM("Type", c->type),
+                                        JSON_BUILD_PAIR_ENUM("Class", c->class),
                                         JSON_BUILD_PAIR_STRING_NON_EMPTY("Desktop", c->desktop),
                                         JSON_BUILD_PAIR_STRING_NON_EMPTY("Seat", c->seat),
                                         SD_JSON_BUILD_PAIR_CONDITION(c->vtnr > 0, "VTNr", SD_JSON_BUILD_UNSIGNED(c->vtnr)),
index 0c708278542c360e335c0568e2496d0b0cd001c0..b0b92ba2ae0753c59694f7a975efd0a3aecdf540 100644 (file)
@@ -2837,7 +2837,7 @@ static int context_notify(
         if (c->link) {
                 r = sd_varlink_notifybo(
                                 c->link,
-                                SD_JSON_BUILD_PAIR("phase", JSON_BUILD_STRING_UNDERSCORIFY(progress_phase_to_string(phase))),
+                                JSON_BUILD_PAIR_ENUM("phase", progress_phase_to_string(phase)),
                                 JSON_BUILD_PAIR_STRING_NON_EMPTY("object", object),
                                 JSON_BUILD_PAIR_UNSIGNED_NOT_EQUAL("progress", percent, UINT_MAX));
                 if (r < 0)