commit 48a89e0e110907a7a60ed8f5a0977e3b34661259
Author:     Mattias Andrée <[email protected]>
AuthorDate: Sat Mar 5 20:59:03 2016 +0100
Commit:     Mattias Andrée <[email protected]>
CommitDate: Sat Mar 5 20:59:03 2016 +0100

    zinit is now an inline function
    
    Signed-off-by: Mattias Andrée <[email protected]>

diff --git a/Makefile b/Makefile
index 9f664a4..d9ecce5 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,6 @@ FUN =\
        zerror\
        zfree\
        zgcd\
-       zinit\
        zload\
        zlsb\
        zlsh\
@@ -55,8 +54,17 @@ FUN =\
        zunsetup\
        zxor
 
+INLINE_FUN =\
+       zinit\
+       zeven\
+       zodd\
+       zeven_nonzero\
+       zodd_nonzero\
+       zzero\
+       zsignum
+
 OBJ = $(FUN:=.o)
-MAN = $(foreach F,$(FUN),man/$(F).3) man/libzahl.7
+MAN = $(foreach F,$(FUN) $(INLINE_FUN),man/$(F).3) man/libzahl.7
 
 all: libzahl.a
 
diff --git a/src/zinit.c b/src/zinit.c
deleted file mode 100644
index fc6d9fc..0000000
--- a/src/zinit.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#include "internals.h"
-
-
-void
-zinit(z_t a)
-{
-       a->alloced = 0;
-       a->chars = 0;
-}
diff --git a/zahl.h b/zahl.h
index a5946fc..39d08a2 100644
--- a/zahl.h
+++ b/zahl.h
@@ -42,7 +42,6 @@ void zunsetup(void);                   /* Free resources used 
by libzahl */
 
 /* Memory functions. */
 
-void zinit(z_t);                       /* Prepare a for use. */
 void zfree(z_t);                       /* Free resources in a. */
 void zswap(z_t, z_t);                  /* (a, b) := (b, a) */
 size_t zsave(z_t, void *);             /* Store a into b (if !!b), and return 
number of written bytes. */
@@ -140,9 +139,10 @@ void zperror(const char *);            /* Identical to 
perror(3p) except it supp
 
 /* Inline functions. */
 
+static inline void zinit(z_t a)        { a->alloced = 0; a->chars = 0; }       
   /* Prepare a for use. */
 static inline int zeven(z_t a)         { return !a->sign || !(a->chars[0] & 
1); } /* Is a even? */
 static inline int zodd(z_t a)          { return a->sign && (a->chars[0] & 1); 
}   /* Is a odd? */
 static inline int zeven_nonzero(z_t a) { return !(a->chars[0] & 1); }          
   /* Is a even? Assumes a ≠ 0. */
 static inline int zodd_nonzero(z_t a)  { return (a->chars[0] & 1); }           
   /* Is a odd? Assumes a ≠ 0. */
 static inline int zzero(z_t a)         { return !a->sign; }                    
   /* Is a zero? */
-static inline int zsignum(z_t a)       { return a->sign; }                     
   /* a/|a|, 0 if a is zero */
+static inline int zsignum(z_t a)       { return a->sign; }                     
   /* a/|a|, 0 if a is zero. */

Reply via email to