summaryrefslogtreecommitdiffstats
path: root/src/home/homectl-recovery-key.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-11-25 10:25:03 +0100
committerLennart Poettering <lennart@poettering.net>2021-11-25 14:22:31 +0100
commit0cdf6b14a5389fdeb75d67dde42c88de75962956 (patch)
treed9b3053975fd55469eb8954be7537fe911d2ad6c /src/home/homectl-recovery-key.c
parentjson: don't assert() if we add a NULL element via json_variant_set_field() (diff)
downloadsystemd-0cdf6b14a5389fdeb75d67dde42c88de75962956.tar.xz
systemd-0cdf6b14a5389fdeb75d67dde42c88de75962956.zip
json: add new JSON_BUILD_CONST_STRING() macro
This macro is like JSON_BUILD_STRING() but uses our json library's ability to use literal strings directly as JsonVariant objects. The changes all our codebase to use this new macro whenever we build JSON objects from literal strings. (I tried to make this automatic, i.e. to detect in JSON_BUILD_STRING() whether something is a literal string nicely and thus do this stuff automatically, but I couldn't find a way.) This should reduce memory usage of our JSON code a bit. Constant strings we use very often will now be shared and mapped directly from the ELF image.
Diffstat (limited to 'src/home/homectl-recovery-key.c')
-rw-r--r--src/home/homectl-recovery-key.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/home/homectl-recovery-key.c b/src/home/homectl-recovery-key.c
index da1899ae14..ff1ab6820d 100644
--- a/src/home/homectl-recovery-key.c
+++ b/src/home/homectl-recovery-key.c
@@ -19,7 +19,7 @@ static int add_privileged(JsonVariant **v, const char *hashed) {
assert(hashed);
r = json_build(&e, JSON_BUILD_OBJECT(
- JSON_BUILD_PAIR("type", JSON_BUILD_STRING("modhex64")),
+ JSON_BUILD_PAIR("type", JSON_BUILD_CONST_STRING("modhex64")),
JSON_BUILD_PAIR("hashedPassword", JSON_BUILD_STRING(hashed))));
if (r < 0)
return log_error_errno(r, "Failed to build recover key JSON object: %m");