diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-03-19 15:23:11 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-03-19 15:23:11 +0100 |
commit | 0d1eced630f4ed05ad95fdbb4354fd428c9cdbf6 (patch) | |
tree | 0ed4d6f189ed72287a0e003446c87a2b6db70c1a /src/exchange/taler-exchange-httpd_parsing.c | |
parent | d229f78da3b0b7f851d3541f59651b4f600c879d (diff) | |
download | exchange-0d1eced630f4ed05ad95fdbb4354fd428c9cdbf6.tar.gz exchange-0d1eced630f4ed05ad95fdbb4354fd428c9cdbf6.tar.bz2 exchange-0d1eced630f4ed05ad95fdbb4354fd428c9cdbf6.zip |
first refactoring of JSON logic to address #4150 and #4237
Diffstat (limited to 'src/exchange/taler-exchange-httpd_parsing.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_parsing.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/exchange/taler-exchange-httpd_parsing.c b/src/exchange/taler-exchange-httpd_parsing.c index 25539aeb7..3fd69ae50 100644 --- a/src/exchange/taler-exchange-httpd_parsing.c +++ b/src/exchange/taler-exchange-httpd_parsing.c @@ -24,6 +24,7 @@ #include "platform.h" #include <gnunet/gnunet_util_lib.h> +#include "taler_json_lib.h" #include "taler-exchange-httpd_parsing.h" #include "taler-exchange-httpd_responses.h" @@ -786,10 +787,15 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, case TMH_PARSE_JNC_RET_AMOUNT: { struct TALER_Amount *where = va_arg (argp, void *); + struct GNUNET_JSON_Specification spec[] = { + TALER_JSON_spec_amount (NULL, where), + GNUNET_JSON_spec_end () + }; if (GNUNET_OK != - TALER_json_to_amount ((json_t *) root, - where)) + GNUNET_JSON_parse ((json_t *) root, + spec, + NULL, NULL)) { GNUNET_break_op (0); ret = (MHD_YES != @@ -823,10 +829,15 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, case TMH_PARSE_JNC_RET_TIME_ABSOLUTE: { struct GNUNET_TIME_Absolute *where = va_arg (argp, void *); + struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_absolute_time (NULL, where), + GNUNET_JSON_spec_end () + }; if (GNUNET_OK != - TALER_json_to_abs ((json_t *) root, - where)) + GNUNET_JSON_parse ((json_t *) root, + spec, + NULL, NULL)) { GNUNET_break_op (0); ret = (MHD_YES != |