-eliminate more format-string packs

This commit is contained in:
Christian Grothoff 2021-07-31 08:26:32 +02:00
parent 85a3a24ca7
commit 7a09886737
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -716,14 +716,16 @@ output_operation (const char *op_name,
GNUNET_break (NULL != op_value); GNUNET_break (NULL != op_value);
if (NULL == out) if (NULL == out)
{
out = json_array (); out = json_array ();
action = json_pack ("{ s:s, s:o }", GNUNET_assert (NULL != out);
"operation", }
op_name, action = GNUNET_JSON_PACK (
"arguments", GNUNET_JSON_pack_string ("operation",
op_value); op_name),
GNUNET_break (NULL != action); GNUNET_JSON_pack_object_steal ("arguments",
GNUNET_break (0 == op_value));
GNUNET_assert (0 ==
json_array_append_new (out, json_array_append_new (out,
action)); action));
} }
@ -1757,8 +1759,6 @@ trigger_upload (const char *exchange_url)
static void static void
do_upload (char *const *args) do_upload (char *const *args)
{ {
char *exchange_url;
if (NULL != in) if (NULL != in)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -1855,11 +1855,11 @@ do_revoke_denomination_key (char *const *args)
&master_priv, &master_priv,
&master_sig); &master_sig);
output_operation (OP_REVOKE_DENOMINATION, output_operation (OP_REVOKE_DENOMINATION,
json_pack ("{s:o, s:o}", GNUNET_JSON_PACK (
"h_denom_pub", GNUNET_JSON_pack_data_auto ("h_denom_pub",
GNUNET_JSON_from_data_auto (&h_denom_pub), &h_denom_pub),
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (&master_sig))); &master_sig)));
next (args + 1); next (args + 1);
} }
@ -1904,11 +1904,11 @@ do_revoke_signkey (char *const *args)
&master_priv, &master_priv,
&master_sig); &master_sig);
output_operation (OP_REVOKE_SIGNKEY, output_operation (OP_REVOKE_SIGNKEY,
json_pack ("{s:o, s:o}", GNUNET_JSON_PACK (
"exchange_pub", GNUNET_JSON_pack_data_auto ("exchange_pub",
GNUNET_JSON_from_data_auto (&exchange_pub), &exchange_pub),
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (&master_sig))); &master_sig)));
next (args + 1); next (args + 1);
} }
@ -1972,17 +1972,17 @@ do_add_auditor (char *const *args)
&master_priv, &master_priv,
&master_sig); &master_sig);
output_operation (OP_ENABLE_AUDITOR, output_operation (OP_ENABLE_AUDITOR,
json_pack ("{s:s, s:s, s:o, s:o, s:o}", GNUNET_JSON_PACK (
"auditor_url", GNUNET_JSON_pack_string ("auditor_url",
args[1], args[1]),
"auditor_name", GNUNET_JSON_pack_string ("auditor_name",
args[2], args[2]),
"validity_start", GNUNET_JSON_pack_time_abs ("validity_start",
GNUNET_JSON_from_time_abs (now), now),
"auditor_pub", GNUNET_JSON_pack_data_auto ("auditor_pub",
GNUNET_JSON_from_data_auto (&auditor_pub), &auditor_pub),
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (&master_sig))); &master_sig)));
next (args + 3); next (args + 3);
} }
@ -2032,13 +2032,13 @@ do_del_auditor (char *const *args)
&master_priv, &master_priv,
&master_sig); &master_sig);
output_operation (OP_DISABLE_AUDITOR, output_operation (OP_DISABLE_AUDITOR,
json_pack ("{s:o, s:o, s:o}", GNUNET_JSON_PACK (
"auditor_pub", GNUNET_JSON_pack_data_auto ("auditor_pub",
GNUNET_JSON_from_data_auto (&auditor_pub), &auditor_pub),
"validity_end", GNUNET_JSON_pack_time_abs ("validity_end",
GNUNET_JSON_from_time_abs (now), now),
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (&master_sig))); &master_sig)));
next (args + 1); next (args + 1);
} }
@ -2101,15 +2101,15 @@ do_add_wire (char *const *args)
&master_priv, &master_priv,
&master_sig_wire); &master_sig_wire);
output_operation (OP_ENABLE_WIRE, output_operation (OP_ENABLE_WIRE,
json_pack ("{s:s, s:o, s:o, s:o}", GNUNET_JSON_PACK (
"payto_uri", GNUNET_JSON_pack_string ("payto_uri",
args[0], args[0]),
"validity_start", GNUNET_JSON_pack_time_abs ("validity_start",
GNUNET_JSON_from_time_abs (now), now),
"master_sig_add", GNUNET_JSON_pack_data_auto ("master_sig_add",
GNUNET_JSON_from_data_auto (&master_sig_add), &master_sig_add),
"master_sig_wire", GNUNET_JSON_pack_data_auto ("master_sig_wire",
GNUNET_JSON_from_data_auto (&master_sig_wire))); &master_sig_wire)));
next (args + 1); next (args + 1);
} }
@ -2153,13 +2153,13 @@ do_del_wire (char *const *args)
&master_priv, &master_priv,
&master_sig); &master_sig);
output_operation (OP_DISABLE_WIRE, output_operation (OP_DISABLE_WIRE,
json_pack ("{s:s, s:o, s:o}", GNUNET_JSON_PACK (
"payto_uri", GNUNET_JSON_pack_string ("payto_uri",
args[0], args[0]),
"validity_end", GNUNET_JSON_pack_time_abs ("validity_end",
GNUNET_JSON_from_time_abs (now), now),
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (&master_sig))); &master_sig)));
next (args + 1); next (args + 1);
} }
@ -2230,19 +2230,19 @@ do_set_wire_fee (char *const *args)
&master_priv, &master_priv,
&master_sig); &master_sig);
output_operation (OP_SET_WIRE_FEE, output_operation (OP_SET_WIRE_FEE,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", GNUNET_JSON_PACK (
"wire_method", GNUNET_JSON_pack_string ("wire_method",
args[1], args[1]),
"start_time", GNUNET_JSON_pack_time_abs ("start_time",
GNUNET_JSON_from_time_abs (start_time), start_time),
"end_time", GNUNET_JSON_pack_time_abs ("end_time",
GNUNET_JSON_from_time_abs (end_time), end_time),
"wire_fee", TALER_JSON_pack_amount ("wire_fee",
TALER_JSON_from_amount (&wire_fee), &wire_fee),
"closing_fee", TALER_JSON_pack_amount ("closing_fee",
TALER_JSON_from_amount (&closing_fee), &closing_fee),
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (&master_sig))); &master_sig)));
next (args + 4); next (args + 4);
} }
@ -2285,11 +2285,11 @@ download_cb (void *cls,
global_ret = EXIT_FAILURE; global_ret = EXIT_FAILURE;
return; return;
} }
in = json_pack ("{s:s,s:O}", in = GNUNET_JSON_PACK (
"operation", GNUNET_JSON_pack_string ("operation",
OP_INPUT_KEYS, OP_INPUT_KEYS),
"arguments", GNUNET_JSON_pack_object_incref ("arguments",
hr->reply); (json_t *) hr->reply));
if (NULL == args[0]) if (NULL == args[0])
{ {
json_dumpf (in, json_dumpf (in,
@ -2977,11 +2977,11 @@ sign_signkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_assert (0 == GNUNET_assert (0 ==
json_array_append_new ( json_array_append_new (
result, result,
json_pack ("{s:o,s:o}", GNUNET_JSON_PACK (
"exchange_pub", GNUNET_JSON_pack_data_auto ("exchange_pub",
GNUNET_JSON_from_data_auto (&exchange_pub), &exchange_pub),
"master_sig", GNUNET_JSON_pack_data_auto ("master_sig",
GNUNET_JSON_from_data_auto (&master_sig)))); &master_sig))));
} }
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
} }
@ -3113,12 +3113,11 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub,
GNUNET_assert (0 == GNUNET_assert (0 ==
json_array_append_new ( json_array_append_new (
result, result,
json_pack ( GNUNET_JSON_PACK (
"{s:o,s:o}", GNUNET_JSON_pack_data_auto ("h_denom_pub",
"h_denom_pub", &h_denom_pub),
GNUNET_JSON_from_data_auto (&h_denom_pub), GNUNET_JSON_pack_data_auto ("master_sig",
"master_sig", &master_sig))));
GNUNET_JSON_from_data_auto (&master_sig))));
} }
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
} }
@ -3230,11 +3229,11 @@ do_sign (char *const *args)
} }
output_operation (OP_UPLOAD_SIGS, output_operation (OP_UPLOAD_SIGS,
json_pack ("{s:o,s:o}", GNUNET_JSON_PACK (
"denom_sigs", GNUNET_JSON_pack_array_steal ("denom_sigs",
denomkey_sig_array, denomkey_sig_array),
"signkey_sigs", GNUNET_JSON_pack_array_steal ("signkey_sigs",
signkey_sig_array)); signkey_sig_array)));
} }
GNUNET_JSON_parse_free (spec); GNUNET_JSON_parse_free (spec);
json_decref (keys); json_decref (keys);
@ -3259,9 +3258,9 @@ do_setup (char *const *args)
if (NULL != *args) if (NULL != *args)
{ {
output_operation (OP_SETUP, output_operation (OP_SETUP,
json_pack ("{s:o}", GNUNET_JSON_PACK (
"exchange_offline_pub", GNUNET_JSON_pack_data_auto ("exchange_offline_pub",
GNUNET_JSON_from_data_auto (&master_pub))); &master_pub)));
} }
else else