commit b1a7583533da1fe08085115051d1b0e33427f34c
parent 5e3c911e846e918637e325dbaa62253fbf0fdb65
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 2 Aug 2026 22:37:41 +0200
static asserts must be first to avoid mixing decl and code
Diffstat:
7 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_helper.c b/src/backend/taler-merchant-httpd_helper.c
@@ -739,10 +739,10 @@ TMH_uuid_from_string (const char *uuids,
{
struct GNUNET_HashCode hc;
+ GNUNET_static_assert (sizeof (hc) > sizeof (*uuid));
GNUNET_CRYPTO_hash (uuids,
strlen (uuids),
&hc);
- GNUNET_static_assert (sizeof (hc) > sizeof (*uuid));
GNUNET_memcpy (uuid,
&hc,
sizeof (*uuid));
diff --git a/src/backenddb/update_donau_instance.c b/src/backenddb/update_donau_instance.c
@@ -45,9 +45,9 @@ TALER_MERCHANTDB_update_donau_instance (
GNUNET_PQ_query_param_end
};
- GNUNET_assert (NULL != pg->current_merchant_id);
GNUNET_static_assert (sizeof (charity->charity_pub) ==
sizeof (pg->current_merchant_pub));
+ GNUNET_assert (NULL != pg->current_merchant_id);
GNUNET_assert (0 ==
memcmp (&charity->charity_pub,
&pg->current_merchant_pub,
diff --git a/src/include/platform.h b/src/include/platform.h
@@ -33,6 +33,12 @@
#endif
+#if HAVE_THREAD_LOCAL_GCC
+#define TALER_THREAD_LOCAL __thread
+#else
+#define TALER_THREAD_LOCAL
+#endif
+
#if (GNUNET_EXTRA_LOGGING >= 1)
#define VERBOSE(cmd) cmd
#else
diff --git a/src/lib/merchant_api_post-orders-ORDER_ID-abort.c b/src/lib/merchant_api_post-orders-ORDER_ID-abort.c
@@ -406,6 +406,9 @@ TALER_MERCHANT_post_orders_abort_create (
poah->coins,
coins,
num_coins * sizeof (struct TALER_MERCHANT_PostOrdersAbortCoin));
+ for (unsigned int i = 0; i<num_coins; i++)
+ poah->coins[i].exchange_url
+ = GNUNET_strdup (poah->coins[i].exchange_url);
return poah;
}
@@ -500,6 +503,8 @@ TALER_MERCHANT_post_orders_abort_cancel (
poah->job = NULL;
}
TALER_curl_easy_post_finished (&poah->post_ctx);
+ for (unsigned int i = 0; i < poah->num_coins; i++)
+ GNUNET_free_nz ((char *) poah->coins[i].exchange_url);
GNUNET_free (poah->coins);
GNUNET_free (poah->order_id);
GNUNET_free (poah->url);
diff --git a/src/util/mfa.c b/src/util/mfa.c
@@ -151,6 +151,7 @@ TALER_MERCHANT_mfa_body_hash (
struct GNUNET_HashCode hash;
struct GNUNET_HashContext *hc;
+ GNUNET_static_assert (sizeof (*h_body) <= sizeof (hash));
if (NULL == body)
{
json_str = NULL;
@@ -175,7 +176,6 @@ TALER_MERCHANT_mfa_body_hash (
GNUNET_CRYPTO_hash_context_finish (hc,
&hash);
- GNUNET_static_assert (sizeof (*h_body) <= sizeof (hash));
/* Truncate to short hash */
memcpy (&h_body->hash,
&hash,
diff --git a/src/util/product_sold_serialize.c b/src/util/product_sold_serialize.c
@@ -37,7 +37,7 @@
static const char *
quantity_to_string (const struct TALER_MERCHANT_ProductQuantity *q)
{
- static GNUNET_THREAD_LOCAL char res[64];
+ static TALER_THREAD_LOCAL char res[64];
TALER_MERCHANT_vk_format_fractional_string (TALER_MERCHANT_VK_QUANTITY,
q->integer,
diff --git a/src/util/value_kinds.c b/src/util/value_kinds.c
@@ -127,7 +127,7 @@ TALER_MERCHANT_vk_process_quantity_inputs (enum TALER_MERCHANT_ValueKind kind,
uint32_t *frac_out,
const char **error_param)
{
- static GNUNET_THREAD_LOCAL char errbuf[128];
+ static TALER_THREAD_LOCAL char errbuf[128];
int64_t parsed_int = 0;
uint32_t parsed_frac = 0;
const char *int_field = (TALER_MERCHANT_VK_STOCK == kind)