summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-07-05 13:48:35 +0200
committerChristian Grothoff <christian@grothoff.org>2015-07-05 13:48:35 +0200
commitac8420a66140aa850b1573a3503ed3a7f3cc974c (patch)
tree9a88a19c29a27f1a47da1487c04871a8f667ca61
parenta104914e4d209d9c2d94a8f4e943dd29e739158a (diff)
downloadexchange-ac8420a66140aa850b1573a3503ed3a7f3cc974c.tar.gz
exchange-ac8420a66140aa850b1573a3503ed3a7f3cc974c.tar.bz2
exchange-ac8420a66140aa850b1573a3503ed3a7f3cc974c.zip
add cov for mint build
-rw-r--r--src/mint/Makefile.am5
-rw-r--r--src/mint/taler-mint-httpd_parsing.c17
-rw-r--r--src/mint/taler-mint-httpd_parsing.h8
-rw-r--r--src/mint/taler-mint-httpd_refresh.c14
4 files changed, 35 insertions, 9 deletions
diff --git a/src/mint/Makefile.am b/src/mint/Makefile.am
index 112dbbf18..71b4ce63a 100644
--- a/src/mint/Makefile.am
+++ b/src/mint/Makefile.am
@@ -1,6 +1,11 @@
# This Makefile.am is in the public domain
AM_CPPFLAGS = -I$(top_srcdir)/src/include
+if USE_COVERAGE
+ AM_CFLAGS = --coverage -O0
+ XLIB = -lgcov
+endif
+
bin_PROGRAMS = \
taler-mint-httpd
diff --git a/src/mint/taler-mint-httpd_parsing.c b/src/mint/taler-mint-httpd_parsing.c
index 43667caa5..1a4215ba0 100644
--- a/src/mint/taler-mint-httpd_parsing.c
+++ b/src/mint/taler-mint-httpd_parsing.c
@@ -1065,6 +1065,23 @@ TMH_PARSE_member_object (const char *field,
/**
+ * Generate line in parser specification for JSON array value.
+ *
+ * @param field name of the field
+ * @param jsonp address of JSON pointer to initialize
+ * @return corresponding field spec
+ */
+struct TMH_PARSE_FieldSpecification
+TMH_PARSE_member_array (const char *field,
+ json_t **jsonp)
+{
+ struct TMH_PARSE_FieldSpecification ret =
+ { field, jsonp, 0, 0, TMH_PARSE_JNC_RET_TYPED_JSON, JSON_ARRAY };
+ return ret;
+}
+
+
+/**
* Generate line in parser specification for an absolute time.
*
* @param field name of the field
diff --git a/src/mint/taler-mint-httpd_parsing.h b/src/mint/taler-mint-httpd_parsing.h
index ea4eddb22..44e74d27c 100644
--- a/src/mint/taler-mint-httpd_parsing.h
+++ b/src/mint/taler-mint-httpd_parsing.h
@@ -252,13 +252,17 @@ TMH_PARSE_release_data (struct TMH_PARSE_FieldSpecification *spec);
*/
#define TMH_PARSE_MEMBER_VARIABLE(field) { field, NULL, 0, 0, TMH_PARSE_JNC_RET_DATA_VAR, 0 }
+
/**
* Generate line in parser specification for JSON array value.
*
* @param field name of the field
- * @param ptraddr address of pointer to initialize (a `void **`)
+ * @param ptraddr address of JSON pointer to initialize
+ * @return corresponding field spec
*/
-#define TMH_PARSE_MEMBER_ARRAY(field,ptraddr) { field, ptraddr, 0, 0, TMH_PARSE_JNC_RET_TYPED_JSON, JSON_ARRAY }
+struct TMH_PARSE_FieldSpecification
+TMH_PARSE_member_array (const char *field,
+ json_t **jsonp);
/**
diff --git a/src/mint/taler-mint-httpd_refresh.c b/src/mint/taler-mint-httpd_refresh.c
index 28670b98d..4fc923759 100644
--- a/src/mint/taler-mint-httpd_refresh.c
+++ b/src/mint/taler-mint-httpd_refresh.c
@@ -653,12 +653,12 @@ TMH_REFRESH_handler_refresh_melt (struct TMH_RequestHandler *rh,
json_t *coin_detail;
int res;
struct TMH_PARSE_FieldSpecification spec[] = {
- TMH_PARSE_MEMBER_ARRAY ("new_denoms", &new_denoms),
- TMH_PARSE_MEMBER_ARRAY ("melt_coins", &melt_coins),
- TMH_PARSE_MEMBER_ARRAY ("coin_evs", &coin_evs),
- TMH_PARSE_MEMBER_ARRAY ("link_encs", &link_encs),
- TMH_PARSE_MEMBER_ARRAY ("transfer_pubs", &transfer_pubs),
- TMH_PARSE_MEMBER_ARRAY ("secret_encs", &secret_encs),
+ TMH_PARSE_member_array ("new_denoms", &new_denoms),
+ TMH_PARSE_member_array ("melt_coins", &melt_coins),
+ TMH_PARSE_member_array ("coin_evs", &coin_evs),
+ TMH_PARSE_member_array ("link_encs", &link_encs),
+ TMH_PARSE_member_array ("transfer_pubs", &transfer_pubs),
+ TMH_PARSE_member_array ("secret_encs", &secret_encs),
TMH_PARSE_MEMBER_END
};
@@ -820,7 +820,7 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh,
json_t *transfer_privs;
struct TMH_PARSE_FieldSpecification spec[] = {
TMH_PARSE_MEMBER_FIXED ("session_hash", &session_hash),
- TMH_PARSE_MEMBER_ARRAY ("transfer_privs", &transfer_privs),
+ TMH_PARSE_member_array ("transfer_privs", &transfer_privs),
TMH_PARSE_MEMBER_END
};