From: Yu Watanabe Date: Wed, 18 Sep 2024 16:21:42 +0000 (+0900) Subject: creds-util: make sd_json_dispatch_field table static X-Git-Tag: v257-rc1~399^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fae0b004343641dc0e304012fe631479a15b6677;p=thirdparty%2Fsystemd.git creds-util: make sd_json_dispatch_field table static --- diff --git a/src/shared/creds-util.c b/src/shared/creds-util.c index c7a50267374..180ab560fa7 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;