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_withdraw.c | 51 +++------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) (limited to 'src/testing/testing_api_cmd_withdraw.c') diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c index a38233980..80f8402cf 100644 --- a/src/testing/testing_api_cmd_withdraw.c +++ b/src/testing/testing_api_cmd_withdraw.c @@ -332,50 +332,6 @@ reserve_withdraw_cb (void *cls, } -/** - * 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; -} - - /** * Run the command. */ @@ -434,9 +390,10 @@ withdraw_run (void *cls, unsigned int index; GNUNET_assert (GNUNET_OK == - parse_coin_reference (ws->reuse_coin_key_ref, - &cstr, - &index)); + TALER_TESTING_parse_coin_reference ( + ws->reuse_coin_key_ref, + &cstr, + &index)); cref = TALER_TESTING_interpreter_lookup_command (is, cstr); GNUNET_assert (NULL != cref); -- cgit v1.2.3