diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-18 18:21:42 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-18 18:34:57 +0200 |
commit | fae0b004343641dc0e304012fe631479a15b6677 (patch) | |
tree | 6b65be5d21a802e901f87e0fb558c7e6628483a4 /src/shared/creds-util.c | |
parent | resolve: make sd_json_dispatch_field table static (diff) | |
download | systemd-fae0b004343641dc0e304012fe631479a15b6677.tar.xz systemd-fae0b004343641dc0e304012fe631479a15b6677.zip |
creds-util: make sd_json_dispatch_field table static
Diffstat (limited to '')
-rw-r--r-- | src/shared/creds-util.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/shared/creds-util.c b/src/shared/creds-util.c index c7a5026737..180ab560fa 100644 --- a/src/shared/creds-util.c +++ b/src/shared/creds-util.c @@ -1582,14 +1582,12 @@ int ipc_encrypt_credential(const char *name, usec_t timestamp, usec_t not_after, return log_error_errno(sd_varlink_error_to_errno(error_id, reply), "Failed to encrypt: %s", error_id); } - r = sd_json_dispatch( - reply, - (const sd_json_dispatch_field[]) { - { "blob", SD_JSON_VARIANT_STRING, json_dispatch_unbase64_iovec, PTR_TO_SIZE(ret), SD_JSON_MANDATORY }, - {}, - }, - SD_JSON_LOG|SD_JSON_ALLOW_EXTENSIONS, - /* userdata= */ NULL); + static const sd_json_dispatch_field dispatch_table[] = { + { "blob", SD_JSON_VARIANT_STRING, json_dispatch_unbase64_iovec, 0, SD_JSON_MANDATORY }, + {}, + }; + + r = sd_json_dispatch(reply, dispatch_table, SD_JSON_LOG|SD_JSON_ALLOW_EXTENSIONS, ret); if (r < 0) return r; @@ -1649,14 +1647,12 @@ int ipc_decrypt_credential(const char *validate_name, usec_t validate_timestamp, return log_error_errno(sd_varlink_error_to_errno(error_id, reply), "Failed to decrypt: %s", error_id); } - r = sd_json_dispatch( - reply, - (const sd_json_dispatch_field[]) { - { "data", SD_JSON_VARIANT_STRING, json_dispatch_unbase64_iovec, PTR_TO_SIZE(ret), SD_JSON_MANDATORY }, - {}, - }, - SD_JSON_LOG|SD_JSON_ALLOW_EXTENSIONS, - /* userdata= */ NULL); + static const sd_json_dispatch_field dispatch_table[] = { + { "data", SD_JSON_VARIANT_STRING, json_dispatch_unbase64_iovec, 0, SD_JSON_MANDATORY }, + {}, + }; + + r = sd_json_dispatch(reply, dispatch_table, SD_JSON_LOG|SD_JSON_ALLOW_EXTENSIONS, ret); if (r < 0) return r; |