commit b92783238340214fac462c2fb4c5a87bce9a306e
parent 2ed154cad73b51ae38d2eb5ddda8e0cfb6140ca9
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 2 May 2026 22:09:30 +0200
improve type-safety by using the CLOSURE macros as intended
Diffstat:
4 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/src/backend/anastasis-httpd_policy-upload.c b/src/backend/anastasis-httpd_policy-upload.c
@@ -21,6 +21,11 @@
* @author Christian Grothoff
*/
#include "platform.h"
+struct PolicyUploadContext;
+#define TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE struct \
+ PolicyUploadContext
+#define TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE struct \
+ PolicyUploadContext
#include "anastasis-httpd.h"
#include "anastasis-httpd_policy.h"
#include "anastasis_service.h"
@@ -323,10 +328,9 @@ make_payment_request (struct PolicyUploadContext *puc)
* @param por response details
*/
static void
-proposal_cb (void *cls,
+proposal_cb (struct PolicyUploadContext *puc,
const struct TALER_MERCHANT_PostPrivateOrdersResponse *por)
{
- struct PolicyUploadContext *puc = cls;
enum GNUNET_DB_QueryStatus qs;
puc->po = NULL;
@@ -393,10 +397,9 @@ proposal_cb (void *cls,
* @param osr order status
*/
static void
-check_payment_cb (void *cls,
+check_payment_cb (struct PolicyUploadContext *puc,
const struct TALER_MERCHANT_GetPrivateOrderResponse *osr)
{
- struct PolicyUploadContext *puc = cls;
const struct TALER_MERCHANT_HttpResponse *hr = &osr->hr;
/* refunds are not supported, verify */
diff --git a/src/backend/anastasis-httpd_truth-challenge.c b/src/backend/anastasis-httpd_truth-challenge.c
@@ -21,6 +21,13 @@
* @author Christian Grothoff
*/
#include "platform.h"
+struct ChallengeContext;
+struct RefundEntry;
+#define TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE struct \
+ ChallengeContext
+#define TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE struct \
+ RefundEntry
+#define TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE struct ChallengeContext
#include "anastasis-httpd.h"
#include "anastasis_service.h"
#include "anastasis-httpd_truth.h"
@@ -367,10 +374,9 @@ AH_truth_challenge_shutdown (void)
*/
static void
refund_cb (
- void *cls,
+ struct RefundEntry *re,
const struct TALER_MERCHANT_PostPrivateOrdersRefundResponse *rr)
{
- struct RefundEntry *re = cls;
re->ro = NULL;
switch (rr->hr.http_status)
@@ -597,10 +603,9 @@ make_payment_request (struct ChallengeContext *gc)
* @param por response details
*/
static void
-proposal_cb (void *cls,
+proposal_cb (struct ChallengeContext *gc,
const struct TALER_MERCHANT_PostPrivateOrdersResponse *por)
{
- struct ChallengeContext *gc = cls;
enum GNUNET_DB_QueryStatus qs;
gc->po = NULL;
@@ -660,11 +665,10 @@ proposal_cb (void *cls,
* @param osr order status
*/
static void
-check_payment_cb (void *cls,
+check_payment_cb (struct ChallengeContext *gc,
const struct TALER_MERCHANT_GetPrivateOrderResponse *osr)
{
- struct ChallengeContext *gc = cls;
const struct TALER_MERCHANT_HttpResponse *hr = &osr->hr;
gc->cpo = NULL;
diff --git a/src/backend/anastasis-httpd_truth-solve.c b/src/backend/anastasis-httpd_truth-solve.c
@@ -21,6 +21,9 @@
* @author Christian Grothoff
*/
#include "platform.h"
+struct SolveContext;
+#define TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE struct SolveContext
+#define TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE struct SolveContext
#include "anastasis-httpd.h"
#include "anastasis_service.h"
#include "anastasis-httpd_truth.h"
@@ -435,10 +438,9 @@ make_payment_request (struct SolveContext *gc)
* @param por response details
*/
static void
-proposal_cb (void *cls,
+proposal_cb (struct SolveContext *gc,
const struct TALER_MERCHANT_PostPrivateOrdersResponse *por)
{
- struct SolveContext *gc = cls;
enum GNUNET_DB_QueryStatus qs;
gc->po = NULL;
@@ -498,11 +500,10 @@ proposal_cb (void *cls,
* @param osr order status
*/
static void
-check_payment_cb (void *cls,
+check_payment_cb (struct SolveContext *gc,
const struct TALER_MERCHANT_GetPrivateOrderResponse *osr)
{
- struct SolveContext *gc = cls;
const struct TALER_MERCHANT_HttpResponse *hr = &osr->hr;
gc->cpo = NULL;
diff --git a/src/backend/anastasis-httpd_truth-upload.c b/src/backend/anastasis-httpd_truth-upload.c
@@ -21,6 +21,11 @@
* @author Christian Grothoff
*/
#include "platform.h"
+struct TruthUploadContext;
+#define TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE struct \
+ TruthUploadContext
+#define TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE struct \
+ TruthUploadContext
#include "anastasis-httpd.h"
#include "anastasis_service.h"
#include "anastasis-httpd_truth.h"
@@ -249,10 +254,9 @@ make_payment_request (struct TruthUploadContext *tuc)
* @param por response details
*/
static void
-proposal_cb (void *cls,
+proposal_cb (struct TruthUploadContext *tuc,
const struct TALER_MERCHANT_PostPrivateOrdersResponse *por)
{
- struct TruthUploadContext *tuc = cls;
tuc->po = NULL;
GNUNET_CONTAINER_DLL_remove (tuc_head,
@@ -293,10 +297,9 @@ proposal_cb (void *cls,
* @param osr order status
*/
static void
-check_payment_cb (void *cls,
+check_payment_cb (struct TruthUploadContext *tuc,
const struct TALER_MERCHANT_GetPrivateOrderResponse *osr)
{
- struct TruthUploadContext *tuc = cls;
const struct TALER_MERCHANT_HttpResponse *hr = &osr->hr;
tuc->cpo = NULL;