gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: method can be static


From: gnunet
Subject: [taler-exchange] branch master updated: method can be static
Date: Mon, 16 Mar 2020 16:20:37 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 211ff7f0 method can be static
211ff7f0 is described below

commit 211ff7f0a282d798a55c3460cfc132bde5f90d55
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Mar 16 16:20:35 2020 +0100

    method can be static
---
 src/exchange/taler-exchange-httpd_wire.c | 192 +++++++++++++++----------------
 src/exchange/taler-exchange-httpd_wire.h |  10 --
 2 files changed, 96 insertions(+), 106 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_wire.c 
b/src/exchange/taler-exchange-httpd_wire.c
index 5694d61b..126c7cdf 100644
--- a/src/exchange/taler-exchange-httpd_wire.c
+++ b/src/exchange/taler-exchange-httpd_wire.c
@@ -43,6 +43,101 @@ static json_t *wire_accounts_array;
 static json_t *wire_fee_object;
 
 
+/**
+ * Convert fee structure to JSON result to be returned
+ * as part of a /wire response.
+ *
+ * @param af fee structure to convert
+ * @return NULL on error, otherwise json data structure for /wire.
+ */
+static json_t *
+fees_to_json (struct TALER_EXCHANGEDB_AggregateFees *af)
+{
+  json_t *a;
+
+  a = json_array ();
+  if (NULL == a)
+  {
+    GNUNET_break (0); /* out of memory? */
+    return NULL;
+  }
+  while (NULL != af)
+  {
+    if ( (GNUNET_NO == GNUNET_TIME_round_abs (&af->start_date)) ||
+         (GNUNET_NO == GNUNET_TIME_round_abs (&af->end_date)) )
+    {
+      GNUNET_break (0); /* bad timestamps, should not happen */
+      json_decref (a);
+      return NULL;
+    }
+    if (0 !=
+        json_array_append_new (a,
+                               json_pack ("{s:o, s:o, s:o, s:o, s:o}",
+                                          "wire_fee", TALER_JSON_from_amount (
+                                            &af->wire_fee),
+                                          "closing_fee",
+                                          TALER_JSON_from_amount (
+                                            &af->closing_fee),
+                                          "start_date",
+                                          GNUNET_JSON_from_time_abs (
+                                            af->start_date),
+                                          "end_date",
+                                          GNUNET_JSON_from_time_abs (
+                                            af->end_date),
+                                          "sig", GNUNET_JSON_from_data_auto (
+                                            &af->master_sig))))
+    {
+      GNUNET_break (0); /* out of memory? */
+      json_decref (a);
+      return NULL;
+    }
+    af = af->next;
+  }
+  return a;
+}
+
+
+/**
+ * Obtain fee structure for @a method wire transfers.
+ *
+ * @param method method to load fees for
+ * @return JSON object (to be freed by caller) with fee structure
+ */
+static json_t *
+get_fees (const char *method)
+{
+  struct TALER_EXCHANGEDB_AggregateFees *af;
+  struct GNUNET_TIME_Absolute now;
+
+  af = TALER_EXCHANGEDB_fees_read (TEH_cfg,
+                                   method);
+  now = GNUNET_TIME_absolute_get ();
+  while ( (NULL != af) &&
+          (af->end_date.abs_value_us < now.abs_value_us) )
+  {
+    struct TALER_EXCHANGEDB_AggregateFees *n = af->next;
+
+    GNUNET_free (af);
+    af = n;
+  }
+  if (NULL == af)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to find current wire transfer fees for `%s' at time 
%s\n",
+                method,
+                GNUNET_STRINGS_absolute_time_to_string (now));
+    return NULL;
+  }
+  {
+    json_t *j;
+
+    j = fees_to_json (af);
+    TALER_EXCHANGEDB_fees_free (af);
+    return j;
+  }
+}
+
+
 /**
  * Load wire fees for @a method.
  *
@@ -57,7 +152,7 @@ load_fee (const char *method)
   if (NULL != json_object_get (wire_fee_object,
                                method))
     return GNUNET_OK; /* already have them */
-  fees = TEH_WIRE_get_fees (method);
+  fees = get_fees (method);
   if (NULL == fees)
     return GNUNET_SYSERR;
   /* Add fees to #wire_fee_object */
@@ -188,101 +283,6 @@ load_account (void *cls,
 }
 
 
-/**
- * Convert fee structure to JSON result to be returned
- * as part of a /wire response.
- *
- * @param af fee structure to convert
- * @return NULL on error, otherwise json data structure for /wire.
- */
-static json_t *
-fees_to_json (struct TALER_EXCHANGEDB_AggregateFees *af)
-{
-  json_t *a;
-
-  a = json_array ();
-  if (NULL == a)
-  {
-    GNUNET_break (0); /* out of memory? */
-    return NULL;
-  }
-  while (NULL != af)
-  {
-    if ( (GNUNET_NO == GNUNET_TIME_round_abs (&af->start_date)) ||
-         (GNUNET_NO == GNUNET_TIME_round_abs (&af->end_date)) )
-    {
-      GNUNET_break (0); /* bad timestamps, should not happen */
-      json_decref (a);
-      return NULL;
-    }
-    if (0 !=
-        json_array_append_new (a,
-                               json_pack ("{s:o, s:o, s:o, s:o, s:o}",
-                                          "wire_fee", TALER_JSON_from_amount (
-                                            &af->wire_fee),
-                                          "closing_fee",
-                                          TALER_JSON_from_amount (
-                                            &af->closing_fee),
-                                          "start_date",
-                                          GNUNET_JSON_from_time_abs (
-                                            af->start_date),
-                                          "end_date",
-                                          GNUNET_JSON_from_time_abs (
-                                            af->end_date),
-                                          "sig", GNUNET_JSON_from_data_auto (
-                                            &af->master_sig))))
-    {
-      GNUNET_break (0); /* out of memory? */
-      json_decref (a);
-      return NULL;
-    }
-    af = af->next;
-  }
-  return a;
-}
-
-
-/**
- * Obtain fee structure for @a method wire transfers.
- *
- * @param method method to load fees for
- * @return JSON object (to be freed by caller) with fee structure
- */
-json_t *
-TEH_WIRE_get_fees (const char *method)
-{
-  struct TALER_EXCHANGEDB_AggregateFees *af;
-  struct GNUNET_TIME_Absolute now;
-
-  af = TALER_EXCHANGEDB_fees_read (TEH_cfg,
-                                   method);
-  now = GNUNET_TIME_absolute_get ();
-  while ( (NULL != af) &&
-          (af->end_date.abs_value_us < now.abs_value_us) )
-  {
-    struct TALER_EXCHANGEDB_AggregateFees *n = af->next;
-
-    GNUNET_free (af);
-    af = n;
-  }
-  if (NULL == af)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to find current wire transfer fees for `%s' at time 
%s\n",
-                method,
-                GNUNET_STRINGS_absolute_time_to_string (now));
-    return NULL;
-  }
-  {
-    json_t *j;
-
-    j = fees_to_json (af);
-    TALER_EXCHANGEDB_fees_free (af);
-    return j;
-  }
-}
-
-
 /**
  * Handle a "/wire" request.
  *
diff --git a/src/exchange/taler-exchange-httpd_wire.h 
b/src/exchange/taler-exchange-httpd_wire.h
index 09e6dd53..219f1711 100644
--- a/src/exchange/taler-exchange-httpd_wire.h
+++ b/src/exchange/taler-exchange-httpd_wire.h
@@ -44,16 +44,6 @@ void
 TEH_WIRE_done (void);
 
 
-/**
- * Obtain fee structure for @a wire_plugin_name wire transfers.
- *
- * @param method method to load fees for
- * @return JSON object (to be freed by caller) with fee structure
- */
-json_t *
-TEH_WIRE_get_fees (const char *method);
-
-
 /**
  * Handle a "/wire" request.
  *

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]