diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-03-04 23:50:00 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-03-04 23:50:00 +0100 |
| commit | 76d0af5599554d11f104d582cdac8fbaa8569fcc (patch) | |
| tree | 0ed9889a86d52ebd208382f2fd49dad0570d1f8c /zahl.h | |
| parent | Clean up, fix a few bugs, and add a test (diff) | |
| download | libzahl-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 '')
| -rw-r--r-- | zahl.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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? */ |
