]> git.ipfire.org Git - collecty.git/commitdiff
client: Use a helper function to send format
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 3 Oct 2025 09:48:13 +0000 (09:48 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 3 Oct 2025 09:48:13 +0000 (09:48 +0000)
No functional changes, just less code.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/client/main.c

index 304abdc6d281c09e6c7a71a1a104d88e25c3b354..b86edc755a77d7702cc155914eeb365e6c38478a 100644 (file)
@@ -154,21 +154,7 @@ static int render(collecty_client_ctx* ctx) {
 
        // Is available, add the desired output format
        if (ctx->format) {
-               r = sd_bus_message_open_container(m, 'e', "sv");
-               if (r < 0)
-                       goto ERROR;
-
-               // Add key
-               r = sd_bus_message_append(m, "s", "format");
-               if (r < 0)
-                       goto ERROR;
-
-               // Add the value
-               r = sd_bus_message_append(m, "v", "s", ctx->format);
-               if (r < 0)
-                       goto ERROR;
-
-               r = sd_bus_message_close_container(m);
+               r = sd_bus_message_append(m, "{sv}", "format", "s", ctx->format);
                if (r < 0)
                        goto ERROR;
        }