aboutsummaryrefslogtreecommitdiffstats
path: root/zahl.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-03-04 23:50:00 +0100
committerMattias Andrée <maandree@kth.se>2016-03-04 23:50:00 +0100
commit76d0af5599554d11f104d582cdac8fbaa8569fcc (patch)
tree0ed9889a86d52ebd208382f2fd49dad0570d1f8c /zahl.h
parentClean up, fix a few bugs, and add a test (diff)
downloadlibzahl-76d0af5599554d11f104d582cdac8fbaa8569fcc.tar.gz
libzahl-76d0af5599554d11f104d582cdac8fbaa8569fcc.tar.bz2
libzahl-76d0af5599554d11f104d582cdac8fbaa8569fcc.tar.xz
Clean up, add zerror and zperror, fix bugs and add more tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'zahl.h')
-rw-r--r--zahl.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/zahl.h b/zahl.h
index 18c0d7a..993d7b1 100644
--- a/zahl.h
+++ b/zahl.h
@@ -25,6 +25,10 @@ enum zprimality { NONPRIME = 0, PROBABLY_PRIME, PRIME };
enum zranddev { FAST_RANDOM = 0, SECURE_RANDOM };
enum zranddist { QUASIUNIFORM = 0, UNIFORM };
+enum zerror {
+ ZERROR_ERRNO_SET = 0
+};
+
/* The parameters in the functions below are numbers a, b, c, ... */
@@ -128,6 +132,12 @@ int zsets(z_t, const char *); /* a := b */
size_t zstr_length(z_t, unsigned long long int);
+/* Error handling functions. */
+
+enum zerror zerror(const char **); /* Return the current error code, and unless a is 0, a description in *a. */
+void zperror(const char *); /* Identical to perror(3p) except it supports libzahl errors. */
+
+
/* Inline functions. */
static inline int zeven(z_t a) { return !a->sign || !(a->chars[0] & 1); } /* Is a even? */