From f5a3dbf8d652dbf87f9ff27b50d11f6364551a61 Mon Sep 17 00:00:00 2001 From: default Date: Thu, 3 Aug 2023 09:02:08 +0200 Subject: Use xs_json_dump_pp() wherever possible. --- utils.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'utils.c') diff --git a/utils.c b/utils.c index 1c9a5aa..086fdf2 100644 --- a/utils.c +++ b/utils.c @@ -194,8 +194,7 @@ int snac_init(const char *basedir) return 1; } - xs *j = xs_json_dumps_pp(srv_config, 4); - fwrite(j, strlen(j), 1, f); + xs_json_dump_pp(srv_config, 4, f); fclose(f); printf("Done.\n"); @@ -276,8 +275,7 @@ int adduser(const char *uid) return 1; } else { - xs *j = xs_json_dumps_pp(config, 4); - fwrite(j, strlen(j), 1, f); + xs_json_dump_pp(config, 4, f); fclose(f); } @@ -292,8 +290,7 @@ int adduser(const char *uid) return 1; } else { - xs *j = xs_json_dumps_pp(key, 4); - fwrite(j, strlen(j), 1, f); + xs_json_dump_pp(key, 4, f); fclose(f); } @@ -319,8 +316,7 @@ int resetpwd(snac *snac) snac->config = xs_dict_set(snac->config, "passwd", hashed_pwd); if ((f = fopen(fn, "w")) != NULL) { - xs *j = xs_json_dumps_pp(snac->config, 4); - fwrite(j, strlen(j), 1, f); + xs_json_dump_pp(snac->config, 4, f); fclose(f); printf("New password for user %s is %s\n", snac->uid, clear_pwd); -- cgit v1.2.3