summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_recoup_refresh.c
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2022-04-06 13:54:08 +0200
committerChristian Grothoff <grothoff@gnunet.org>2022-04-06 13:54:08 +0200
commit89431a41b795cfbd14d6ce08dc33272e4a9ab9e6 (patch)
tree76fa0ff047d923e9a73c68201ac4d40ab8819c44 /src/testing/testing_api_cmd_recoup_refresh.c
parent22cfc59d904c02b752547459d599e2e1cdce75a9 (diff)
downloadexchange-89431a41b795cfbd14d6ce08dc33272e4a9ab9e6.tar.gz
exchange-89431a41b795cfbd14d6ce08dc33272e4a9ab9e6.tar.bz2
exchange-89431a41b795cfbd14d6ce08dc33272e4a9ab9e6.zip
-complete va coin parser of purse_create_deposit CMD
Diffstat (limited to 'src/testing/testing_api_cmd_recoup_refresh.c')
-rw-r--r--src/testing/testing_api_cmd_recoup_refresh.c58
1 files changed, 8 insertions, 50 deletions
diff --git a/src/testing/testing_api_cmd_recoup_refresh.c b/src/testing/testing_api_cmd_recoup_refresh.c
index 1102fc757..6081a4ba1 100644
--- a/src/testing/testing_api_cmd_recoup_refresh.c
+++ b/src/testing/testing_api_cmd_recoup_refresh.c
@@ -68,50 +68,6 @@ struct RecoupRefreshState
/**
- * 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_refresh request: checks whether
* the HTTP response code is good, and that the coin that
* was paid back belonged to the right old coin.
@@ -150,9 +106,10 @@ recoup_refresh_cb (void *cls,
}
if (GNUNET_OK !=
- parse_coin_reference (rrs->coin_reference,
- &cref,
- &idx))
+ TALER_TESTING_parse_coin_reference (
+ rrs->coin_reference,
+ &cref,
+ &idx))
{
TALER_TESTING_interpreter_fail (is);
return;
@@ -242,9 +199,10 @@ recoup_refresh_run (void *cls,
rrs->is = is;
if (GNUNET_OK !=
- parse_coin_reference (rrs->coin_reference,
- &cref,
- &idx))
+ TALER_TESTING_parse_coin_reference (
+ rrs->coin_reference,
+ &cref,
+ &idx))
{
TALER_TESTING_interpreter_fail (is);
return;