aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-21 18:35:39 +0200
committerChristian Grothoff <christian@grothoff.org>2016-05-21 18:35:39 +0200
commit0d27e60be0446209d5d2af89ad1160464500d2ff (patch)
treedfa759ba14776dfd90ad1bccf98124b3a694ba17 /src/backend
parent13eb40e3bcc935dc39a03d071f8ab2391c8c085e (diff)
make use of GNUNET_JSON_from_data_auto where possible
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd_auditors.c3
-rw-r--r--src/backend/taler-merchant-httpd_contract.c12
-rw-r--r--src/backend/taler-merchant-httpd_exchanges.c5
-rw-r--r--src/backend/taler-merchant-httpd_pay.c5
-rw-r--r--src/backend/taler-merchant-httpd_util.c3
5 files changed, 10 insertions, 18 deletions
diff --git a/src/backend/taler-merchant-httpd_auditors.c b/src/backend/taler-merchant-httpd_auditors.c
index 0b583fd4..4b4bd646 100644
--- a/src/backend/taler-merchant-httpd_auditors.c
+++ b/src/backend/taler-merchant-httpd_auditors.c
@@ -210,8 +210,7 @@ TMH_AUDITORS_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
json_array_append_new (j_auditors,
json_pack ("{s:s, s:o, s:s}",
"name", auditors[cnt].name,
- "auditor_pub", GNUNET_JSON_from_data (&auditors[cnt].public_key,
- sizeof (struct TALER_AuditorPublicKeyP)),
+ "auditor_pub", GNUNET_JSON_from_data_auto (&auditors[cnt].public_key),
"uri", auditors[cnt].uri));
return nauditors;
}
diff --git a/src/backend/taler-merchant-httpd_contract.c b/src/backend/taler-merchant-httpd_contract.c
index 9d159583..af18ce11 100644
--- a/src/backend/taler-merchant-httpd_contract.c
+++ b/src/backend/taler-merchant-httpd_contract.c
@@ -220,12 +220,10 @@ MH_handler_contract (struct TMH_RequestHandler *rh,
j_auditors);
json_object_set_new (jcontract,
"H_wire",
- GNUNET_JSON_from_data (&h_wire,
- sizeof (h_wire)));
+ GNUNET_JSON_from_data_auto (&h_wire));
json_object_set_new (jcontract,
"merchant_pub",
- GNUNET_JSON_from_data (&pubkey,
- sizeof (pubkey)));
+ GNUNET_JSON_from_data_auto (&pubkey));
/* create contract signature */
contract.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_CONTRACT);
@@ -247,10 +245,8 @@ MH_handler_contract (struct TMH_RequestHandler *rh,
MHD_HTTP_OK,
"{s:O, s:O, s:O}",
"contract", jcontract,
- "merchant_sig", GNUNET_JSON_from_data (&contract_sig,
- sizeof (contract_sig)),
- "H_contract", GNUNET_JSON_from_data (&contract.h_contract,
- sizeof (contract.h_contract)));
+ "merchant_sig", GNUNET_JSON_from_data_auto (&contract_sig),
+ "H_contract", GNUNET_JSON_from_data_auto (&contract.h_contract));
GNUNET_JSON_parse_free (spec);
json_decref (root);
return res;
diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c
index 9a292365..0501784a 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -534,9 +534,8 @@ TMH_EXCHANGES_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
if (GNUNET_YES != exchange->trusted)
continue;
j_exchange = json_pack ("{s:s, s:o}",
- "url", exchange->uri,
- "master_pub", GNUNET_JSON_from_data (&exchange->master_pub,
- sizeof (struct TALER_MasterPublicKeyP)));
+ "url", exchange->uri,
+ "master_pub", GNUNET_JSON_from_data_auto (&exchange->master_pub));
json_array_append_new (trusted_exchanges,
j_exchange);
}
diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c
index eb9fd506..bd8dc742 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -234,7 +234,7 @@ resume_pay_with_response (struct PayContext *pc,
/**
* Convert denomination key to its base32 representation
- *
+ *
* @param dk denomination key to convert
* @return 0-terminated base32 encoding of @a dk, to be deallocated
*/
@@ -325,8 +325,7 @@ deposit_cb (void *cls,
eproof = json_copy ((json_t *) proof);
json_object_set (eproof,
"coin_pub",
- GNUNET_JSON_from_data (&dc->coin_pub,
- sizeof (struct TALER_CoinSpendPublicKeyP)));
+ GNUNET_JSON_from_data_auto (&dc->coin_pub));
resume_pay_with_response (pc,
http_status,
TMH_RESPONSE_make_json (eproof));
diff --git a/src/backend/taler-merchant-httpd_util.c b/src/backend/taler-merchant-httpd_util.c
index 800e41ab..9d62722c 100644
--- a/src/backend/taler-merchant-httpd_util.c
+++ b/src/backend/taler-merchant-httpd_util.c
@@ -99,8 +99,7 @@ MH_handler_hash_contract (struct TMH_RequestHandler *rh,
res = TMH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_OK,
"{s:O}",
- "hash", GNUNET_JSON_from_data (&hc,
- sizeof (hc)));
+ "hash", GNUNET_JSON_from_data_auto (&hc));
json_decref (root);
return res;
}