(wrong string) ée

From: <git_AT_suckless.org>
Date: Fri, 4 Mar 2016 09:28:30 +0100 (CET)

commit 0a7e36380717fe926d43ab30ef6162db9bd71723
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Fri Mar 4 09:28:01 2016 +0100
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Fri Mar 4 09:28:01 2016 +0100

    Add makefile and fix errors
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0670292
--- /dev/null
+++ b/Makefile
_AT_@ -0,0 +1,71 @@
+include config.mk
+
+HDR =\
+ zahl.h\
+ src/internals.h
+
+FUN =\
+ zabs\
+ zadd\
+ zand\
+ zbits\
+ zbset\
+ zbtest\
+ zcmp\
+ zcmpi\
+ zcmpmag\
+ zcmpu\
+ zdiv\
+ zdivmod\
+ zfree\
+ zgcd\
+ zinit\
+ zload\
+ zlsb\
+ zlsh\
+ zmod\
+ zmodmul\
+ zmodpow\
+ zmodpowu\
+ zmodsqr\
+ zmul\
+ zneg\
+ znot\
+ zor\
+ zpow\
+ zpowu\
+ zptest\
+ zrand\
+ zrsh\
+ zsave\
+ zset\
+ zseti\
+ zsets\
+ zsetu\
+ zsetup\
+ zsplit\
+ zsqr\
+ zstr\
+ zstr_length\
+ zsub\
+ zswap\
+ ztrunc\
+ zunsetup\
+ zxor
+
+OBJ = $(FUN:=.o)
+MAN = $(foreach F,$(FUN),man/$(F).3) man/libzahl.7
+
+all: libzahl.a
+
+%.o: src/%.c $(HDR) config.mk
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $_AT_ $<
+
+libzahl.a: $(OBJ)
+ $(AR) rc $_AT_ $?
+ $(RANLIB) $_AT_
+
+clean:
+ -rm -- *.o *.su *.a *.so 2>/dev/null
+
+.PHONY: all clean
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..7544d18
--- /dev/null
+++ b/config.mk
_AT_@ -0,0 +1,18 @@
+VERSION = 0.0
+
+PREFIX = /usr/local
+EXECPREFIX = $(PREFIX)
+MANPREFIX = $(PREFIX)/shared/man
+
+CC = cc
+AR = ar
+RANLIB = ranlib
+
+# Unless /dev/urandom exists and is a non-blocking random number generator,
+# you have to add -DFAST_RANDOM_PATHNAME=... to CPPFLAGS, and
+# unless /dev/random exists and is a blocking secure random number generator
+# you have to add -DSECURE_RANDOM_PATHNAME=... to CPPFLAGS.
+
+CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
+CFLAGS = -std=c99 -Wall -pedantic
+LDFLAGS = -s
diff --git a/src/internals.h b/src/internals.h
index 873adbb..77ea29b 100644
--- a/src/internals.h
+++ b/src/internals.h
_AT_@ -3,6 +3,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <errno.h>
 
 #define BITS_PER_CHAR 32
 #define LB_BITS_PER_CHAR 5
_AT_@ -61,13 +62,13 @@ extern int libzahl_set_up;
 #define zmemcmp(a, b, n) memcmp(a, b, (n) * sizeof(zahl_char_t))
 
 #define SET_SIGNUM(a, signum) ((a)->sign = (signum))
-#define SET(a, b) do { if (a != b) zset(a, b)} while (0)
+#define SET(a, b) do { if (a != b) zset(a, b); } while (0)
 
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 
 static inline void
-zahl_realloc(z_t *p, size_t n)
+zahl_realloc(z_t p, size_t n)
 {
         p->chars = realloc(p->chars, n * sizeof(zahl_char_t));
         if (!p->chars)
diff --git a/src/zabs.c b/src/zabs.c
index 6c7914b..d4de6c4 100644
--- a/src/zabs.c
+++ b/src/zabs.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zadd.c b/src/zadd.c
index c108e18..2aa7e38 100644
--- a/src/zadd.c
+++ b/src/zadd.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
_AT_@ -37,7 +37,7 @@ zadd_unsigned(z_t a, z_t b, z_t c)
                 a->used = b->used;
                 addend = c->chars;
         } else {
- zmemcpy(a->chars, c->chars, c->used));
+ zmemcpy(a->chars, c->chars, c->used);
                 a->used = c->used;
                 addend = b->chars;
         }
diff --git a/src/zand.c b/src/zand.c
index a75abc5..6b8dc4a 100644
--- a/src/zand.c
+++ b/src/zand.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zbits.c b/src/zbits.c
index f0c15c9..0bee579 100644
--- a/src/zbits.c
+++ b/src/zbits.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 size_t
diff --git a/src/zbset.c b/src/zbset.c
index 526309a..d7b7784 100644
--- a/src/zbset.c
+++ b/src/zbset.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zbtest.c b/src/zbtest.c
index 8ad0d94..a97e714 100644
--- a/src/zbtest.c
+++ b/src/zbtest.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 int
diff --git a/src/zcmp.c b/src/zcmp.c
index 2a51d5e..55caa6b 100644
--- a/src/zcmp.c
+++ b/src/zcmp.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 int
diff --git a/src/zcmpi.c b/src/zcmpi.c
index 640e340..e7a6158 100644
--- a/src/zcmpi.c
+++ b/src/zcmpi.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 int
_AT_@ -9,6 +9,6 @@ zcmpi(z_t a, long long int b)
                 return zsignum(a);
         if (zzero(a))
                 return b > 0 ? -1 : b < 0;
- zseti(zahl_tmp_cmp, b);
- return zcmp(a, zahl_tmp_cmp);
+ zseti(libzahl_tmp_cmp, b);
+ return zcmp(a, libzahl_tmp_cmp);
 }
diff --git a/src/zcmpmag.c b/src/zcmpmag.c
index 7e4ab38..95668d3 100644
--- a/src/zcmpmag.c
+++ b/src/zcmpmag.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 int
diff --git a/src/zcmpu.c b/src/zcmpu.c
index 577a0f4..0c7d68e 100644
--- a/src/zcmpu.c
+++ b/src/zcmpu.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 int
_AT_@ -9,6 +9,6 @@ zcmpu(z_t a, unsigned long long int b)
                 return zsignum(a);
         if (zsignum(a) <= 0)
                 return -1;
- zsetu(zahl_tmp_cmp, b);
- return zcmp(a, zahl_tmp_cmp);
+ zsetu(libzahl_tmp_cmp, b);
+ return zcmp(a, libzahl_tmp_cmp);
 }
diff --git a/src/zdiv.c b/src/zdiv.c
index 3316c8c..5566bb1 100644
--- a/src/zdiv.c
+++ b/src/zdiv.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zdivmod.c b/src/zdivmod.c
index 70b1f5c..9340810 100644
--- a/src/zdivmod.c
+++ b/src/zdivmod.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 #define ta libzahl_tmp_divmod_a
 #define tb libzahl_tmp_divmod_b
_AT_@ -74,13 +74,13 @@ zdivmod(z_t a, z_t b, z_t c, z_t d)
                         zrsh(tds[i], td, i);
                 for (;;) {
                         for (i = 0; i < BITS_PER_CHAR; i++) {
- if (zcmpmag(td[i], tb) <= 0) {
- zsub(tb, tb, td[i]);
+ if (zcmpmag(tds[i], tb) <= 0) {
+ zsub(tb, tb, tds[i]);
                                         zbset(ta, ta, bit, 1);
                                 }
                                 if (!bit--)
                                         goto done;
- zrsh(td[i], td[i], 1);
+ zrsh(tds[i], tds[i], 1);
                         }
                         for (i = MIN(bit, BITS_PER_CHAR); i--;)
                                 zrsh(tds[i], tds[i], BITS_PER_CHAR);
diff --git a/src/zfree.c b/src/zfree.c
index 622faae..95eb084 100644
--- a/src/zfree.c
+++ b/src/zfree.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zgcd.c b/src/zgcd.c
index ec4ad62..70bce64 100644
--- a/src/zgcd.c
+++ b/src/zgcd.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 #define u libzahl_tmp_gcd_u
 #define v libzahl_tmp_gcd_v
_AT_@ -35,7 +35,7 @@ zgcd(z_t a, z_t b, z_t c)
 
         min = MIN(u->used, v->used);
         for (; i < min; i++) {
- uv = u->chars[i] | v->used[i];
+ uv = u->chars[i] | v->chars[i];
                 for (bit = 1; bit; bit <<= 1, shifts++)
                         if (uv & bit)
                                 goto loop_done;
diff --git a/src/zinit.c b/src/zinit.c
index 144534e..fc6d9fc 100644
--- a/src/zinit.c
+++ b/src/zinit.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zload.c b/src/zload.c
index 0f5d35b..c708453 100644
--- a/src/zload.c
+++ b/src/zload.c
_AT_@ -1,14 +1,14 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 size_t
 zload(z_t a, const void *buffer)
 {
         const char *buf = buffer;
- a->sign = *((int *)buf), buf += sizeof(int);
- a->used = *((size_t *)buf), buf += sizeof(size_t);
- a->alloced = *((size_t *)buf), buf += sizeof(size_t);
+ a->sign = *((const int *)buf), buf += sizeof(int);
+ a->used = *((const size_t *)buf), buf += sizeof(size_t);
+ a->alloced = *((const size_t *)buf), buf += sizeof(size_t);
         if (a->alloced)
                 zahl_realloc(a, a->alloced);
         else
diff --git a/src/zlsb.c b/src/zlsb.c
index 6c0ae6e..17012f8 100644
--- a/src/zlsb.c
+++ b/src/zlsb.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 size_t
diff --git a/src/zlsh.c b/src/zlsh.c
index 387120e..e301d44 100644
--- a/src/zlsh.c
+++ b/src/zlsh.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
_AT_@ -18,7 +18,7 @@ zlsh(z_t a, z_t b, size_t bits)
         }
 
         chars = FLOOR_BITS_TO_CHARS(bits);
- bits = BITS_IN_LAST_CHAR(bits)
+ bits = BITS_IN_LAST_CHAR(bits);
         cbits = BITS_PER_CHAR - 1 - bits;
 
         a->used = b->used + chars;
diff --git a/src/zmod.c b/src/zmod.c
index 7b54748..5807e00 100644
--- a/src/zmod.c
+++ b/src/zmod.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zmodmul.c b/src/zmodmul.c
index 5b10c6e..6b04909 100644
--- a/src/zmodmul.c
+++ b/src/zmodmul.c
_AT_@ -1,9 +1,9 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
-zmodmul(z_t a, z_t b, z_t c)
+zmodmul(z_t a, z_t b, z_t c, z_t d)
 {
         /* TODO Montgomery modular multiplication */
         if (a == d) {
diff --git a/src/zmodpow.c b/src/zmodpow.c
index c92ca18..fe18060 100644
--- a/src/zmodpow.c
+++ b/src/zmodpow.c
_AT_@ -1,7 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
-
-#include <errno.h>
+#include "internals.h"
 
 #define tb libzahl_tmp_pow_b
 #define tc libzahl_tmp_pow_c
diff --git a/src/zmodpowu.c b/src/zmodpowu.c
index 56ef7da..8a94379 100644
--- a/src/zmodpowu.c
+++ b/src/zmodpowu.c
_AT_@ -1,7 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
-
-#include <errno.h>
+#include "internals.h"
 
 #define tb libzahl_tmp_pow_b
 #define td libzahl_tmp_pow_d
_AT_@ -10,8 +8,6 @@
 void
 zmodpowu(z_t a, z_t b, unsigned long long int c, z_t d)
 {
- size_t i, n;
-
         if (!c) {
                 if (zzero(b)) {
                         errno = EDOM; /* Indeterminate form: 0:th power of 0 */
_AT_@ -31,8 +27,6 @@ zmodpowu(z_t a, z_t b, unsigned long long int c, z_t d)
                 return;
         }
 
- n = zbits(c);
-
         zmod(tb, b, d);
         zset(td, d);
         zsetu(a, 1);
diff --git a/src/zmodsqr.c b/src/zmodsqr.c
index 36e9ed1..8a1442d 100644
--- a/src/zmodsqr.c
+++ b/src/zmodsqr.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zmul.c b/src/zmul.c
index 7e413c5..578d8a5 100644
--- a/src/zmul.c
+++ b/src/zmul.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zneg.c b/src/zneg.c
index b21618c..484d610 100644
--- a/src/zneg.c
+++ b/src/zneg.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/znot.c b/src/znot.c
index 8504933..bcb17e2 100644
--- a/src/znot.c
+++ b/src/znot.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
_AT_@ -8,7 +8,7 @@ znot(z_t a, z_t b)
         size_t bits, n;
 
         if (zzero(b)) {
- SET_SIGNUM(a, 0)
+ SET_SIGNUM(a, 0);
                 return;
         }
 
_AT_@ -21,7 +21,7 @@ znot(z_t a, z_t b)
         bits &= BITS_PER_CHAR - 1;
         a->chars[a->used - 1] &= ((zahl_char_t)1 << bits) - 1;
 
- while (; a->used; a->used--)
+ for (; a->used; a->used--)
                 if (a->chars[a->used - 1])
                         break;
         if (!a->used)
diff --git a/src/zor.c b/src/zor.c
index 1c78c86..1d3952d 100644
--- a/src/zor.c
+++ b/src/zor.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zpow.c b/src/zpow.c
index c359ac3..16988f7 100644
--- a/src/zpow.c
+++ b/src/zpow.c
_AT_@ -1,7 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
-
-#include <errno.h>
+#include "internals.h"
 
 #define tb libzahl_tmp_pow_b
 #define tc libzahl_tmp_pow_c
_AT_@ -41,7 +39,7 @@ zpow(z_t a, z_t b, z_t c)
 
         for (i = 0; i < n; i++) {
                 x = tc->chars[i];
- for (j = BITS_PER_CHAR; j--; x >>= 1, j) {
+ for (j = BITS_PER_CHAR; j--; x >>= 1) {
                         if (x & 1)
                                 zmul(a, a, tb);
                         zsqr(tb, tb);
diff --git a/src/zpowu.c b/src/zpowu.c
index bc0c6dd..d83a7ac 100644
--- a/src/zpowu.c
+++ b/src/zpowu.c
_AT_@ -1,7 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
-
-#include <errno.h>
+#include "internals.h"
 
 #define tb libzahl_tmp_pow_b
 
diff --git a/src/zptest.c b/src/zptest.c
index db40527..a1d112c 100644
--- a/src/zptest.c
+++ b/src/zptest.c
_AT_@ -1,11 +1,11 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 #define x libzahl_tmp_ptest_x
 #define a libzahl_tmp_ptest_a
 #define d libzahl_tmp_ptest_d
 #define n1 libzahl_tmp_ptest_n1
-#define n2 libzahl_tmp_ptest_n4
+#define n4 libzahl_tmp_ptest_n4
 
 
 enum zprimality
_AT_@ -39,16 +39,16 @@ zptest(z_t witness, z_t n, int t)
         zrsh(d, n1, r);
 
         while (t--) {
- zrand(a, n4, FAST_RANDOM, UNIFORM);
+ zrand(a, FAST_RANDOM, UNIFORM, n4);
                 zadd_unsigned(a, a, libzahl_const_2);
- zmodpow(x, a, d, tn);
+ zmodpow(x, a, d, n);
 
                 if (!zcmp(x, libzahl_const_1) || !zcmp(x, n1))
                         continue;
 
                 for (i = 1; i < r; i++) {
                         zsqr(x, x);
- zmod(x, x, tn);
+ zmod(x, x, n);
                         if (!zcmp(x, libzahl_const_1)) {
                                 if (witness)
                                         zswap(witness, a);
diff --git a/src/zrand.c b/src/zrand.c
index fa1bdfa..c5c8e8a 100644
--- a/src/zrand.c
+++ b/src/zrand.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 #include <fcntl.h>
 #include <unistd.h>
_AT_@ -27,12 +27,12 @@ zrand_get_random_bits(z_t r, size_t bits, int fd)
                 read_just = read(fd, (char *)(r->chars) + read_total, n);
                 if (read_just < 0)
                         FAILURE_JUMP();
- read_total += read_just;
- n -= read_just;
+ read_total += (size_t)read_just;
+ n -= (size_t)read_just;
         }
 
- bit = BITS_IN_LAST_CHAR(bit)
- mask <<= bit;
+ bits = BITS_IN_LAST_CHAR(bits);
+ mask <<= bits;
         mask -= 1;
 
         r->chars[chars - 1] &= mask;
_AT_@ -70,6 +70,8 @@ zrand(z_t r, enum zranddev dev, enum zranddist dist, z_t n)
         }
 
         fd = open(pathname, O_RDONLY);
+ if (fd < 0)
+ FAILURE_JUMP();
 
         switch (dist) {
         case QUASIUNIFORM:
diff --git a/src/zrsh.c b/src/zrsh.c
index ebc00d7..c3bd63e 100644
--- a/src/zrsh.c
+++ b/src/zrsh.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
_AT_@ -19,7 +19,7 @@ zrsh(z_t a, z_t b, size_t bits)
                 return;
         }
 
- bits = BITS_IN_LAST_CHAR(bits)
+ bits = BITS_IN_LAST_CHAR(bits);
         cbits = BITS_PER_CHAR - 1 - bits;
 
         if (chars && a == b) {
_AT_@ -28,7 +28,7 @@ zrsh(z_t a, z_t b, size_t bits)
         } else if (a != b) {
                 a->used = b->used - chars;
                 if (a->alloced < a->used)
- zahl_realloc(a->chars, a->used);
+ zahl_realloc(a, a->used);
                 zmemcpy(a->chars, b->chars + chars, a->used);
         }
 
diff --git a/src/zsave.c b/src/zsave.c
index 405e7af..bb788d3 100644
--- a/src/zsave.c
+++ b/src/zsave.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 size_t
diff --git a/src/zset.c b/src/zset.c
index 10ceb18..989bb1c 100644
--- a/src/zset.c
+++ b/src/zset.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zseti.c b/src/zseti.c
index c42ffd6..81a7a13 100644
--- a/src/zseti.c
+++ b/src/zseti.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zsets.c b/src/zsets.c
index bae34c1..24cdd48 100644
--- a/src/zsets.c
+++ b/src/zsets.c
_AT_@ -1,7 +1,7 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
-#include <errno.h>
+#include <ctype.h>
 
 
 int
_AT_@ -30,7 +30,7 @@ zsets(z_t a, const char *str)
                 while (*str) {
 #define X(n)\
                 case n:\
- temp *= 10, temp += *str++ & 15;\
+ temp *= 10, temp += *str++ & 15;
                 X(0) X(18) X(17) X(16) X(15) X(14) X(13) X(12) X(11)
                 X(10) X(9) X(8) X(7) X(6) X(5) X(4) X(3) X(2) X(1)
 #undef X
diff --git a/src/zsetu.c b/src/zsetu.c
index 2e60c28..f37be7e 100644
--- a/src/zsetu.c
+++ b/src/zsetu.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 #define SIZE_MULTIPLE(fit, in) ((sizeof(fit) + sizeof(in) - 1) / sizeof(in))
 
_AT_@ -12,7 +12,7 @@ zsetu(z_t a, unsigned long long int b)
                 return;
         }
         if (a->alloced < SIZE_MULTIPLE(b, *(a->chars)))
- zahl_realloc(a, SIZE_MULTIPLE(b, *(a->chars)))
+ zahl_realloc(a, SIZE_MULTIPLE(b, *(a->chars)));
         SET_SIGNUM(a, 1);
         a->used = 0;
         while (b) {
diff --git a/src/zsetup.c b/src/zsetup.c
index 78cfa3b..8d1cc19 100644
--- a/src/zsetup.c
+++ b/src/zsetup.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 #define X(x) z_t x;
 LIST_TEMPS
_AT_@ -17,7 +17,7 @@ void
 zsetup(jmp_buf env)
 {
         size_t i;
- libzahl_jmp_buf = jmp_buf;
+ *libzahl_jmp_buf = *env;
 
         if (!libzahl_set_up) {
                 libzahl_set_up = 1;
diff --git a/src/zsplit.c b/src/zsplit.c
index 3e7940b..384c5d7 100644
--- a/src/zsplit.c
+++ b/src/zsplit.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zsqr.c b/src/zsqr.c
index ea840b4..be89c37 100644
--- a/src/zsqr.c
+++ b/src/zsqr.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zstr.c b/src/zstr.c
index 07b1377..1b89118 100644
--- a/src/zstr.c
+++ b/src/zstr.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 #include <stdio.h>
 
_AT_@ -39,7 +39,7 @@ zstr(z_t a, char *b)
 
         neg = zsignum(a) < 0;
         zabs(num, a);
- n -= neg;
+ n -= (size_t)neg;
         n = n > 9 ? (n - 9) : 0;
         b[0] = '-';
         b += neg;
_AT_@ -53,7 +53,7 @@ zstr(z_t a, char *b)
                         overridden = b[n + (9 - 1)];
                         n = n > 9 ? (n - 9) : 0;
                 } else {
- n += sprintf(b + n, "%lu", (unsigned long)(rem->chars[0]));
+ n += (size_t)sprintf(b + n, "%lu", (unsigned long)(rem->chars[0]));
                         b[n] = overridden;
                         break;
                 }
diff --git a/src/zstr_length.c b/src/zstr_length.c
index f959ea3..16638e6 100644
--- a/src/zstr_length.c
+++ b/src/zstr_length.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 #define num libzahl_tmp_str_num
 #define mag libzahl_tmp_str_mag
diff --git a/src/zsub.c b/src/zsub.c
index d1c54f6..1e2fe79 100644
--- a/src/zsub.c
+++ b/src/zsub.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zswap.c b/src/zswap.c
index b9a1325..452d712 100644
--- a/src/zswap.c
+++ b/src/zswap.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
_AT_@ -8,5 +8,5 @@ zswap(z_t a, z_t b)
         z_t t;
         *t = *a;
         *a = *b;
- *b = t;
+ *b = *t;
 }
diff --git a/src/ztrunc.c b/src/ztrunc.c
index 074edc3..ffbbbe0 100644
--- a/src/ztrunc.c
+++ b/src/ztrunc.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
diff --git a/src/zunsetup.c b/src/zunsetup.c
index 3f3ccf6..184f96f 100644
--- a/src/zunsetup.c
+++ b/src/zunsetup.c
_AT_@ -1,9 +1,9 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
-zunsetup(jmp_buf env)
+zunsetup(void)
 {
         size_t i;
         if (libzahl_set_up) {
diff --git a/src/zxor.c b/src/zxor.c
index 74cda0c..f570fdf 100644
--- a/src/zxor.c
+++ b/src/zxor.c
_AT_@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
-#include "internals"
+#include "internals.h"
 
 
 void
_AT_@ -47,5 +47,5 @@ zxor(z_t a, z_t b, z_t c)
                         a->chars[n] ^= b->chars[n];
         }
 
- SET_SIGNUM(a, 1 - 2 * ((zsignum(b) ^ zsignum(c)) < 0);
+ SET_SIGNUM(a, 1 - 2 * ((zsignum(b) ^ zsignum(c)) < 0));
 }
diff --git a/zahl.h b/zahl.h
index 8f91809..18c0d7a 100644
--- a/zahl.h
+++ b/zahl.h
_AT_@ -79,7 +79,7 @@ void zabs(z_t, z_t); /* a := |b| */
 void zpow(z_t, z_t, z_t); /* a := b ↑ c */
 void zmodpow(z_t, z_t, z_t, z_t); /* a := (b ↑ c) % d */
 void zpowu(z_t, z_t, unsigned long long int);
-void zmodpowu(z_t, z_t, z_t, unsigned long long int);
+void zmodpowu(z_t, z_t, unsigned long long int, z_t);
 
 /* These are used internally and may be removed in a future version. */
 void zadd_unsigned(z_t, z_t, z_t); /* a := |b| + |c|, b and c must not be the same reference. */
Received on Fri Mar 04 2016 - 09:28:30 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 04 2016 - 09:36:19 CET