aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/taler_pq_lib.h2
-rw-r--r--src/pq/db_pq.c33
-rw-r--r--src/pq/pq_helper.c12
-rw-r--r--src/pq/test_pq.c1
4 files changed, 29 insertions, 19 deletions
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h
index 148385c8b..6570cb956 100644
--- a/src/include/taler_pq_lib.h
+++ b/src/include/taler_pq_lib.h
@@ -297,7 +297,7 @@ struct TALER_PQ_ResultSpec
* @param dst point to where to store the result, type fits expected result size
* @return array entry for the result specification to use
*/
-#define TALER_PQ_RESULT_SPEC(name, dst) { TALER_PQ_RF_VARSIZE_BLOB, (void *) dst, sizeof (*(dst)), name, NULL }
+#define TALER_PQ_RESULT_SPEC(name, dst) { TALER_PQ_RF_FIXED_BLOB, (void *) (dst), sizeof (*(dst)), name, NULL }
/**
diff --git a/src/pq/db_pq.c b/src/pq/db_pq.c
index 220ce9f94..3b39645a7 100644
--- a/src/pq/db_pq.c
+++ b/src/pq/db_pq.c
@@ -225,25 +225,34 @@ TALER_PQ_cleanup_result (struct TALER_PQ_ResultSpec *rs)
switch (rs[i].format)
{
case TALER_PQ_RF_VARSIZE_BLOB:
- if (NULL != rs[i].dst)
{
- GNUNET_free (rs[i].dst);
- rs[i].dst = NULL;
- *rs[i].result_size = 0;
+ void **dst = rs[i].dst;
+ if (NULL != *dst)
+ {
+ GNUNET_free (*dst);
+ *dst = NULL;
+ *rs[i].result_size = 0;
+ }
+ break;
}
- break;
case TALER_PQ_RF_RSA_PUBLIC_KEY:
- if (NULL != rs[i].dst)
{
- GNUNET_CRYPTO_rsa_public_key_free (rs[i].dst);
- rs[i].dst = NULL;
+ void **dst = rs[i].dst;
+ if (NULL != *dst)
+ {
+ GNUNET_CRYPTO_rsa_public_key_free (*dst);
+ *dst = NULL;
+ }
+ break;
}
- break;
case TALER_PQ_RF_RSA_SIGNATURE:
- if (NULL != rs[i].dst)
{
- GNUNET_CRYPTO_rsa_signature_free (rs[i].dst);
- rs[i].dst = NULL;
+ void **dst = rs[i].dst;
+ if (NULL != *dst)
+ {
+ GNUNET_CRYPTO_rsa_signature_free (*dst);
+ *dst = NULL;
+ }
}
break;
default:
diff --git a/src/pq/pq_helper.c b/src/pq/pq_helper.c
index 5baab5a1c..9cbdc54b7 100644
--- a/src/pq/pq_helper.c
+++ b/src/pq/pq_helper.c
@@ -121,7 +121,7 @@ TALER_PQ_RESULT_SPEC_VAR (const char *name,
size_t *sptr)
{
struct TALER_PQ_ResultSpec res =
- { TALER_PQ_RF_VARSIZE_BLOB, (void *) (dst), 0, (name), sptr };
+ { TALER_PQ_RF_VARSIZE_BLOB, (void *) (dst), 0, name, sptr };
return res;
}
@@ -138,7 +138,7 @@ TALER_PQ_RESULT_SPEC_AMOUNT_NBO (const char *name,
struct TALER_AmountNBO *amount)
{
struct TALER_PQ_ResultSpec res =
- {TALER_PQ_RF_AMOUNT_NBO, (void *) (&amount), sizeof (*amount), (name), NULL };
+ {TALER_PQ_RF_AMOUNT_NBO, (void *) amount, sizeof (*amount), name, NULL };
return res;
}
@@ -155,7 +155,7 @@ TALER_PQ_RESULT_SPEC_AMOUNT (const char *name,
struct TALER_Amount *amount)
{
struct TALER_PQ_ResultSpec res =
- {TALER_PQ_RF_AMOUNT, (void *) (&amount), sizeof (*amount), (name), NULL };
+ {TALER_PQ_RF_AMOUNT, (void *) amount, sizeof (*amount), name, NULL };
return res;
}
@@ -172,7 +172,7 @@ TALER_PQ_RESULT_SPEC_RSA_PUBLIC_KEY (const char *name,
struct GNUNET_CRYPTO_rsa_PublicKey **rsa)
{
struct TALER_PQ_ResultSpec res =
- {TALER_PQ_RF_RSA_PUBLIC_KEY, (void *) &(rsa), 0, (name), NULL };
+ {TALER_PQ_RF_RSA_PUBLIC_KEY, (void *) rsa, 0, name, NULL };
return res;
}
@@ -189,7 +189,7 @@ TALER_PQ_RESULT_SPEC_RSA_SIGNATURE (const char *name,
struct GNUNET_CRYPTO_rsa_Signature **sig)
{
struct TALER_PQ_ResultSpec res =
- {TALER_PQ_RF_RSA_SIGNATURE, (void *) &(sig), 0, (name), NULL };
+ {TALER_PQ_RF_RSA_SIGNATURE, (void *) sig, 0, (name), NULL };
return res;
}
@@ -206,7 +206,7 @@ TALER_PQ_RESULT_SPEC_ABSOLUTE_TIME (const char *name,
struct GNUNET_TIME_Absolute *at)
{
struct TALER_PQ_ResultSpec res =
- {TALER_PQ_RF_TIME_ABSOLUTE, (void *) (&at), sizeof (at), (name), NULL };
+ {TALER_PQ_RF_TIME_ABSOLUTE, (void *) at, sizeof (*at), (name), NULL };
return res;
}
diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c
index dfae86125..7146281ed 100644
--- a/src/pq/test_pq.c
+++ b/src/pq/test_pq.c
@@ -124,6 +124,7 @@ run_queries (PGconn *conn)
&hamount);
TALER_string_to_amount ("EUR:4.4",
&hamount);
+ /* FIXME: test TALER_PQ_RESULT_SPEC_VAR */
{
struct TALER_PQ_QueryParam params_insert[] = {
TALER_PQ_QUERY_PARAM_RSA_PUBLIC_KEY (pub),