diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2021-07-28 10:06:44 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2021-07-28 10:06:44 +0200 |
commit | 391794a460140192b3466765ebc63797cea44000 (patch) | |
tree | ee388d3a1fe64af460329fb455f057b7621c3498 /src/json | |
parent | 8175353f1f9966c0125b89a3cb3e3352de54a5ff (diff) | |
download | gnunet-391794a460140192b3466765ebc63797cea44000.tar.gz gnunet-391794a460140192b3466765ebc63797cea44000.zip |
-fix json pack bugs
Diffstat (limited to 'src/json')
-rw-r--r-- | src/json/json_pack.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/json/json_pack.c b/src/json/json_pack.c index e104ad602..20db47cd4 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c | |||
@@ -232,13 +232,13 @@ GNUNET_JSON_pack_data_varsize (const char *name, | |||
232 | const void *blob, | 232 | const void *blob, |
233 | size_t blob_size) | 233 | size_t blob_size) |
234 | { | 234 | { |
235 | json_t *json; | 235 | struct GNUNET_JSON_PackSpec ps = { |
236 | .field_name = name, | ||
237 | .object = GNUNET_JSON_from_data (blob, | ||
238 | blob_size) | ||
239 | }; | ||
236 | 240 | ||
237 | json = GNUNET_JSON_from_data (blob, | 241 | return ps; |
238 | blob_size); | ||
239 | GNUNET_assert (NULL != json); | ||
240 | return GNUNET_JSON_pack_object_steal (name, | ||
241 | json); | ||
242 | } | 242 | } |
243 | 243 | ||
244 | 244 | ||
@@ -290,12 +290,12 @@ struct GNUNET_JSON_PackSpec | |||
290 | GNUNET_JSON_pack_rsa_public_key (const char *name, | 290 | GNUNET_JSON_pack_rsa_public_key (const char *name, |
291 | const struct GNUNET_CRYPTO_RsaPublicKey *pk) | 291 | const struct GNUNET_CRYPTO_RsaPublicKey *pk) |
292 | { | 292 | { |
293 | json_t *json; | 293 | struct GNUNET_JSON_PackSpec ps = { |
294 | .field_name = name, | ||
295 | .object = GNUNET_JSON_from_rsa_public_key (pk) | ||
296 | }; | ||
294 | 297 | ||
295 | json = GNUNET_JSON_from_rsa_public_key (pk); | 298 | return ps; |
296 | GNUNET_assert (NULL != json); | ||
297 | return GNUNET_JSON_pack_object_steal (name, | ||
298 | json); | ||
299 | } | 299 | } |
300 | 300 | ||
301 | 301 | ||
@@ -303,12 +303,12 @@ struct GNUNET_JSON_PackSpec | |||
303 | GNUNET_JSON_pack_rsa_signature (const char *name, | 303 | GNUNET_JSON_pack_rsa_signature (const char *name, |
304 | const struct GNUNET_CRYPTO_RsaSignature *sig) | 304 | const struct GNUNET_CRYPTO_RsaSignature *sig) |
305 | { | 305 | { |
306 | json_t *json; | 306 | struct GNUNET_JSON_PackSpec ps = { |
307 | .field_name = name, | ||
308 | .object = GNUNET_JSON_from_rsa_signature (sig) | ||
309 | }; | ||
307 | 310 | ||
308 | json = GNUNET_JSON_from_rsa_signature (sig); | 311 | return ps; |
309 | GNUNET_assert (NULL != json); | ||
310 | return GNUNET_JSON_pack_object_steal (name, | ||
311 | json); | ||
312 | } | 312 | } |
313 | 313 | ||
314 | 314 | ||