From 89431a41b795cfbd14d6ce08dc33272e4a9ab9e6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 6 Apr 2022 13:54:08 +0200 Subject: -complete va coin parser of purse_create_deposit CMD --- src/testing/testing_api_cmd_recoup.c | 58 +++++------------------------------- 1 file changed, 8 insertions(+), 50 deletions(-) (limited to 'src/testing/testing_api_cmd_recoup.c') diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c index ef2716226..1a8290206 100644 --- a/src/testing/testing_api_cmd_recoup.c +++ b/src/testing/testing_api_cmd_recoup.c @@ -67,50 +67,6 @@ struct RecoupState }; -/** - * Parser reference to a coin. - * - * @param coin_reference of format $LABEL['#' $INDEX]? - * @param[out] cref where we return a copy of $LABEL - * @param[out] idx where we set $INDEX - * @return #GNUNET_SYSERR if $INDEX is present but not numeric - */ -static enum GNUNET_GenericReturnValue -parse_coin_reference (const char *coin_reference, - char **cref, - unsigned int *idx) -{ - const char *index; - - /* We allow command references of the form "$LABEL#$INDEX" or - just "$LABEL", which implies the index is 0. Figure out - which one it is. */ - index = strchr (coin_reference, '#'); - if (NULL == index) - { - *idx = 0; - *cref = GNUNET_strdup (coin_reference); - return GNUNET_OK; - } - *cref = GNUNET_strndup (coin_reference, - index - coin_reference); - if (1 != sscanf (index + 1, - "%u", - idx)) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Numeric index (not `%s') required after `#' in command reference of command in %s:%u\n", - index, - __FILE__, - __LINE__); - GNUNET_free (*cref); - *cref = NULL; - return GNUNET_SYSERR; - } - return GNUNET_OK; -} - - /** * Check the result of the recoup request: checks whether * the HTTP response code is good, and that the coin that @@ -151,9 +107,10 @@ recoup_cb (void *cls, } if (GNUNET_OK != - parse_coin_reference (ps->coin_reference, - &cref, - &idx)) + TALER_TESTING_parse_coin_reference ( + ps->coin_reference, + &cref, + &idx)) { TALER_TESTING_interpreter_fail (is); return; @@ -246,9 +203,10 @@ recoup_run (void *cls, ps->is = is; if (GNUNET_OK != - parse_coin_reference (ps->coin_reference, - &cref, - &idx)) + TALER_TESTING_parse_coin_reference ( + ps->coin_reference, + &cref, + &idx)) { TALER_TESTING_interpreter_fail (is); return; -- cgit v1.2.3