From 76d0af5599554d11f104d582cdac8fbaa8569fcc Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 4 Mar 2016 23:50:00 +0100 Subject: Clean up, add zerror and zperror, fix bugs and add more tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- zahl.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'zahl.h') 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? */ -- cgit v1.2.3-70-g09d2