diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-10-08 12:26:49 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-10-08 12:26:49 +0200 |
commit | 5388a30a7c783196e06ae646a9f6fc07dfabb1b0 (patch) | |
tree | 3e6a5dc0bffa9762b91c2f07e6d3ca89631f43b8 /src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c | |
parent | 40dc7814728d7d142d18bce93434523d584b3e9d (diff) |
fix more compiler warnings and memory leaks
Diffstat (limited to 'src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c')
-rw-r--r-- | src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c b/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c index 39d13b2d6..1ac351b57 100644 --- a/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c +++ b/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c @@ -13,8 +13,6 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - - #include "platform.h" #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_json_lib.h> @@ -26,14 +24,15 @@ #include "taler-auditor-httpd.h" #include "taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h" + /** -* Add reserve-balance-summary-wrong-inconsistency to the list. -* -* @param[in,out] cls a `json_t *` array to extend -* @param serial_id location of the @a dc in the database -* @param dc struct of inconsistencies -* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating -*/ + * Add reserve-balance-summary-wrong-inconsistency to the list. + * + * @param[in,out] cls a `json_t *` array to extend + * @param serial_id location of the @a dc in the database + * @param dc struct of inconsistencies + * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating + */ static enum GNUNET_GenericReturnValue process_reserve_balance_summary_wrong_inconsistency ( void *cls, @@ -44,20 +43,15 @@ process_reserve_balance_summary_wrong_inconsistency ( json_t *obj; obj = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_int64 ("row_id", serial_id), GNUNET_JSON_pack_data_auto ("reserve_pub", &dc->reserve_pub), TALER_JSON_pack_amount ("exchange_amount", &dc->exchange_amount), TALER_JSON_pack_amount ("auditor_amount", &dc->auditor_amount), GNUNET_JSON_pack_bool ("suppressed", dc->suppressed) - - ); GNUNET_break (0 == json_array_append_new (list, obj)); - - return GNUNET_OK; } @@ -73,6 +67,9 @@ TAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_handler_get ( { json_t *ja; enum GNUNET_DB_QueryStatus qs; + int64_t limit = -20; + uint64_t offset; + bool return_suppressed = false; (void) rh; (void) connection_cls; @@ -87,35 +84,28 @@ TAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_handler_get ( TALER_EC_GENERIC_DB_SETUP_FAILED, NULL); } - ja = json_array (); - GNUNET_break (NULL != ja); - - int64_t limit = -20; - uint64_t offset; - TALER_MHD_parse_request_snumber (connection, "limit", &limit); - if (limit < 0) offset = INT64_MAX; else offset = 0; - TALER_MHD_parse_request_number (connection, "offset", &offset); - - bool return_suppressed = false; - const char *ret_s = MHD_lookup_connection_value (connection, - MHD_GET_ARGUMENT_KIND, - "return_suppressed"); - - if (ret_s != NULL && strcmp (ret_s, "true") == 0) { - return_suppressed = true; + const char *ret_s = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, + "return_suppressed"); + + if (ret_s != NULL && strcmp (ret_s, "true") == 0) + { + return_suppressed = true; + } } - + ja = json_array (); + GNUNET_break (NULL != ja); qs = TAH_plugin->get_reserve_balance_summary_wrong_inconsistency ( TAH_plugin->cls, limit, @@ -130,10 +120,11 @@ TAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_handler_get ( json_decref (ja); TALER_LOG_WARNING ( "Failed to handle GET /reserve-balance-summary-wrong-inconsistency"); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "reserve-balance-summary-wrong-inconsistency"); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + "reserve-balance-summary-wrong-inconsistency"); } return TALER_MHD_REPLY_JSON_PACK ( connection, |