From 5cd2bc5de3abf5863ac1718043485a2a74a3d364 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 28 Dec 2021 15:36:26 +0100 Subject: [PATCH 1/2] -cleanup --- contrib/gana | 2 +- src/exchangedb/exchangedb_plugin.c | 11 ----------- src/include/taler_json_lib.h | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/contrib/gana b/contrib/gana index 560c1ac1d..b0dd85e81 160000 --- a/contrib/gana +++ b/contrib/gana @@ -1 +1 @@ -Subproject commit 560c1ac1d321f7da4fc43ef96858ac27b7eaa2bd +Subproject commit b0dd85e8187f33a1f92dd5eb31082050d333e168 diff --git a/src/exchangedb/exchangedb_plugin.c b/src/exchangedb/exchangedb_plugin.c index 21bb032f3..5dc41d988 100644 --- a/src/exchangedb/exchangedb_plugin.c +++ b/src/exchangedb/exchangedb_plugin.c @@ -24,12 +24,6 @@ #include -/** - * Initialize the plugin. - * - * @param cfg configuration to use - * @return #GNUNET_OK on success - */ struct TALER_EXCHANGEDB_Plugin * TALER_EXCHANGEDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg) { @@ -62,11 +56,6 @@ TALER_EXCHANGEDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg) } -/** - * Shutdown the plugin. - * - * @param plugin the plugin to unload - */ void TALER_EXCHANGEDB_plugin_unload (struct TALER_EXCHANGEDB_Plugin *plugin) { diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h index 888256385..ac8793ebc 100644 --- a/src/include/taler_json_lib.h +++ b/src/include/taler_json_lib.h @@ -547,7 +547,7 @@ TALER_deposit_extension_hash (const json_t *extensions, * * @param root is the json object * @param[out] mask on succes, will contain the age mask - * @return GNUNET_OK on success and GNUNET_SYSERR on failure. + * @return #GNUNET_OK on success and #GNUNET_SYSERR on failure. */ enum GNUNET_GenericReturnValue TALER_agemask_parse_json (const json_t *root, From b49fac3d5892f75a2eb7fbfbca0056965c6967c7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 31 Dec 2021 11:23:42 +0100 Subject: [PATCH 2/2] -introduce new convenience macro --- src/include/taler_mhd_lib.h | 11 +++++++++++ src/mhd/mhd_responses.c | 6 ++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h index 7f38ffcf5..b0012a645 100644 --- a/src/include/taler_mhd_lib.h +++ b/src/include/taler_mhd_lib.h @@ -249,6 +249,17 @@ TALER_MHD_make_json_pack (const char *fmt, TALER_MHD_make_json_steal (GNUNET_JSON_PACK (__VA_ARGS__)) +/** + * Pack Taler error code @a ec and associated hint into a + * JSON object. + * + * @param ec error code to pack + * @return packer array entries (two!) + */ +#define TALER_MHD_PACK_EC(ec) \ + GNUNET_JSON_pack_uint64 ("code", ec), \ + GNUNET_JSON_pack_string ("hint", TALER_ErrorCode_get_hint (ec)) + /** * Create a response indicating an internal error. * diff --git a/src/mhd/mhd_responses.c b/src/mhd/mhd_responses.c index 2918440a2..a639f4052 100644 --- a/src/mhd/mhd_responses.c +++ b/src/mhd/mhd_responses.c @@ -371,8 +371,7 @@ TALER_MHD_make_error (enum TALER_ErrorCode ec, const char *detail) { return TALER_MHD_MAKE_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("code", ec), - GNUNET_JSON_pack_string ("hint", TALER_ErrorCode_get_hint (ec)), + TALER_MHD_PACK_EC (ec), GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_string ("detail", detail))); } @@ -387,8 +386,7 @@ TALER_MHD_reply_with_error (struct MHD_Connection *connection, return TALER_MHD_REPLY_JSON_PACK ( connection, http_status, - GNUNET_JSON_pack_uint64 ("code", ec), - GNUNET_JSON_pack_string ("hint", TALER_ErrorCode_get_hint (ec)), + TALER_MHD_PACK_EC (ec), GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_string ("detail", detail))); }