gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: add long-time overdue convenienc


From: gnunet
Subject: [taler-exchange] branch master updated: add long-time overdue convenience function
Date: Wed, 01 Sep 2021 11:11:44 +0200

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 bf2ce985 add long-time overdue convenience function
bf2ce985 is described below

commit bf2ce9853e640384106f4dd7c242ea1e5e440871
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Sep 1 11:11:41 2021 +0200

    add long-time overdue convenience function
---
 src/include/taler_amount_lib.h | 11 +++++++++++
 src/util/amount.c              | 12 ++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/src/include/taler_amount_lib.h b/src/include/taler_amount_lib.h
index a1f6c7d3..c1f42e47 100644
--- a/src/include/taler_amount_lib.h
+++ b/src/include/taler_amount_lib.h
@@ -160,6 +160,17 @@ TALER_amount_set_zero (const char *cur,
                        struct TALER_Amount *amount);
 
 
+/**
+ * Test if the given @a amount is zero.
+ *
+ * @param amount amount to compare to zero
+ * @return true if the amount is zero,
+ *         false if it is non-zero or invalid
+ */
+bool
+TALER_amount_is_zero (const struct TALER_Amount *amount);
+
+
 /**
  * Test if the given amount is valid.
  *
diff --git a/src/util/amount.c b/src/util/amount.c
index 01f2a231..ae9ae652 100644
--- a/src/util/amount.c
+++ b/src/util/amount.c
@@ -241,6 +241,18 @@ TALER_amount_is_valid (const struct TALER_Amount *amount)
 }
 
 
+bool
+TALER_amount_is_zero (const struct TALER_Amount *amount)
+{
+  if (GNUNET_OK !=
+      TALER_amount_is_valid (amount))
+    return false;
+  return
+    (0 == amount->value) &&
+    (0 == amount->fraction);
+}
+
+
 /**
  * Test if @a a is valid, NBO variant.
  *

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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