From ac8420a66140aa850b1573a3503ed3a7f3cc974c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Jul 2015 13:48:35 +0200 Subject: add cov for mint build --- src/mint/Makefile.am | 5 +++++ src/mint/taler-mint-httpd_parsing.c | 17 +++++++++++++++++ src/mint/taler-mint-httpd_parsing.h | 8 ++++++-- src/mint/taler-mint-httpd_refresh.c | 14 +++++++------- 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 @@ -1064,6 +1064,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. * 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 }; -- cgit v1.2.3