about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/skalibs/allreadwrite.h2
-rw-r--r--src/include/skalibs/bitarray.h5
-rw-r--r--src/include/skalibs/buffer.h2
-rw-r--r--src/include/skalibs/bytestr.h12
-rw-r--r--src/include/skalibs/cbuffer.h1
-rw-r--r--src/include/skalibs/djbunix.h2
-rw-r--r--src/include/skalibs/genalloc.h1
-rw-r--r--src/include/skalibs/iopause.h1
-rw-r--r--src/include/skalibs/netstring.h1
-rw-r--r--src/include/skalibs/nonposix.h2
-rw-r--r--src/include/skalibs/selfpipe.h2
-rw-r--r--src/include/skalibs/siovec.h1
-rw-r--r--src/include/skalibs/tai.h1
-rw-r--r--src/include/skalibs/unix-transactional.h4
-rw-r--r--src/include/skalibs/unixmessage.h1
-rw-r--r--src/libstddjb/bitarray_count.c5
-rw-r--r--src/libstddjb/buffer_get.c2
-rw-r--r--src/libstddjb/selfpipe_read.c4
18 files changed, 15 insertions, 34 deletions
diff --git a/src/include/skalibs/allreadwrite.h b/src/include/skalibs/allreadwrite.h
index 9e42c1c..254d766 100644
--- a/src/include/skalibs/allreadwrite.h
+++ b/src/include/skalibs/allreadwrite.h
@@ -3,10 +3,8 @@
 #ifndef ALLREADWRITE_H
 #define ALLREADWRITE_H
 
-#include <sys/types.h>
 #include <sys/uio.h>
 #include <skalibs/functypes.h>
-#include <skalibs/siovec.h>
 
 extern ssize_t sanitize_read (ssize_t) ;
 extern ssize_t unsanitize_read (ssize_t) ;
diff --git a/src/include/skalibs/bitarray.h b/src/include/skalibs/bitarray.h
index 7344492..b333425 100644
--- a/src/include/skalibs/bitarray.h
+++ b/src/include/skalibs/bitarray.h
@@ -3,9 +3,8 @@
 #ifndef BITARRAY_H
 #define BITARRAY_H
 
-#include <sys/types.h>
+#include <string.h>
 #include <skalibs/gccattributes.h>
-#include <skalibs/uint64.h>
 
 #define bitarray_div8(n) ((n) ? 1U + (((n) - 1) >> 3) : 0U)
 
@@ -31,7 +30,7 @@ extern size_t bitarray_firstclear_skip (unsigned char const *, size_t, size_t) g
 extern size_t bitarray_firstset_skip (unsigned char const *, size_t, size_t) gccattr_pure ;
 #define bitarray_first_skip(s, n, k, h) ((h) ? bitarray_firstset_skip(s, n, k) : bitarray_firstclear_skip(s, n, k))
 
-extern uint64_t bitarray_countones (unsigned char const *, size_t) gccattr_pure ;
+extern size_t bitarray_countones (unsigned char const *, size_t) gccattr_pure ;
 
 extern void bitarray_not (unsigned char *, size_t, size_t) ;
 extern void bitarray_and (unsigned char *, unsigned char const *, unsigned char const *, size_t) ;
diff --git a/src/include/skalibs/buffer.h b/src/include/skalibs/buffer.h
index 18db87e..a118a6d 100644
--- a/src/include/skalibs/buffer.h
+++ b/src/include/skalibs/buffer.h
@@ -3,9 +3,7 @@
 #ifndef BUFFER_H
 #define BUFFER_H
 
-#include <sys/types.h>
 #include <sys/uio.h>
-#include <string.h>
 #include <skalibs/gccattributes.h>
 #include <skalibs/allreadwrite.h>
 #include <skalibs/cbuffer.h>
diff --git a/src/include/skalibs/bytestr.h b/src/include/skalibs/bytestr.h
index 25f05d3..1f3942b 100644
--- a/src/include/skalibs/bytestr.h
+++ b/src/include/skalibs/bytestr.h
@@ -10,10 +10,8 @@
 #define T8(x)   ((x) & 0xffU)
 
 #include <skalibs/sysdeps.h>
-#include <sys/types.h>
 #include <string.h>
 #include <strings.h>
-#include <skalibs/uint64.h>
 
 #define byte_copy(to, n, from) memmove(to, (from), n)
 #define byte_copyr(to, n, from) memmove(to, (from), n)
@@ -36,14 +34,14 @@
 extern size_t byte_chr (char const *, size_t, int) gccattr_pure ;
 extern size_t byte_rchr (char const *, size_t, int) gccattr_pure ;
 extern size_t byte_in (char const *, size_t, char const *, size_t) gccattr_pure ;
-#define byte_equal(s, n, t) (!byte_diff((s), (n), (t)))
+#define byte_equal(s, n, t) (!memcmp(s, (t), n))
 extern size_t byte_count (char const *, size_t, char) gccattr_pure ;
 
-#define str_diffb(a, n, b) str_diffn(a, (b), n)
+#define str_diffb(a, n, b) strncmp(a, (b), n)
 extern size_t str_chr (char const *, int) gccattr_pure ;
 extern size_t str_rchr (char const *, int) gccattr_pure ;
 extern int str_start (char const *, char const *) gccattr_pure ;
-#define str_equal(s, t) (!str_diff(s, t))
+#define str_equal(s, t) (!strcmp(s, t))
 extern size_t str_strn (char const *, size_t, char const *, size_t) gccattr_pure ;
 
 extern void case_lowers (char *) ;
@@ -51,8 +49,8 @@ extern void case_lowerb (char *, size_t) ;
 extern void case_uppers (char *) ;
 extern void case_upperb (char *, size_t) ;
 #define case_diffb(a, n, b) case_diffn(a, (b), n)
-#define case_equals(a, b) (!case_diffs(a, b))
-#define case_equalb(a, n, b) (!case_diffb(a, n, b))
+#define case_equals(a, b) (!strcasecmp(a, b))
+#define case_equalb(a, n, b) (!strcasecmp(a, (b), n))
 #define case_starts(s, t) case_startb(s, strlen(s), t)
 extern int case_startb (char const *, size_t, char const *) gccattr_pure ;
 extern size_t case_str (char const *, char const *) gccattr_pure ;
diff --git a/src/include/skalibs/cbuffer.h b/src/include/skalibs/cbuffer.h
index 19b3078..c29af5d 100644
--- a/src/include/skalibs/cbuffer.h
+++ b/src/include/skalibs/cbuffer.h
@@ -3,7 +3,6 @@
 #ifndef CBUFFER_H
 #define CBUFFER_H
 
-#include <sys/types.h>
 #include <sys/uio.h>
 #include <string.h>
 #include <skalibs/gccattributes.h>
diff --git a/src/include/skalibs/djbunix.h b/src/include/skalibs/djbunix.h
index af76ec4..fb08658 100644
--- a/src/include/skalibs/djbunix.h
+++ b/src/include/skalibs/djbunix.h
@@ -6,8 +6,6 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <sys/wait.h>
-#include <sys/stat.h>
-#include <unistd.h>
 #include <skalibs/gccattributes.h>
 #include <skalibs/stralloc.h>
 #include <skalibs/envalloc.h>
diff --git a/src/include/skalibs/genalloc.h b/src/include/skalibs/genalloc.h
index 9c81acd..da83c2f 100644
--- a/src/include/skalibs/genalloc.h
+++ b/src/include/skalibs/genalloc.h
@@ -3,7 +3,6 @@
 #ifndef GENALLOC_H
 #define GENALLOC_H
 
-#include <sys/types.h>
 #include <skalibs/stralloc.h>
 #include <skalibs/functypes.h>
 
diff --git a/src/include/skalibs/iopause.h b/src/include/skalibs/iopause.h
index d8f5e1c..8c8fddc 100644
--- a/src/include/skalibs/iopause.h
+++ b/src/include/skalibs/iopause.h
@@ -3,7 +3,6 @@
 #ifndef IOPAUSE_H
 #define IOPAUSE_H
 
-#include <sys/types.h>
 #include <poll.h>
 #include <skalibs/tai.h>
 
diff --git a/src/include/skalibs/netstring.h b/src/include/skalibs/netstring.h
index 941011a..d41d1dd 100644
--- a/src/include/skalibs/netstring.h
+++ b/src/include/skalibs/netstring.h
@@ -3,7 +3,6 @@
 #ifndef NETSTRING_H
 #define NETSTRING_H
 
-#include <sys/types.h>
 #include <sys/uio.h>
 #include <string.h>
 #include <skalibs/buffer.h>
diff --git a/src/include/skalibs/nonposix.h b/src/include/skalibs/nonposix.h
index 26af211..ebce175 100644
--- a/src/include/skalibs/nonposix.h
+++ b/src/include/skalibs/nonposix.h
@@ -51,7 +51,7 @@
 
 
  /* old versions of BSD: system headers are not self-contained,
-      starting with sys/types.h is the usual workaround */
+      starting with sys/types.h normally always works. */
 
 #include <sys/types.h>
 
diff --git a/src/include/skalibs/selfpipe.h b/src/include/skalibs/selfpipe.h
index c587f93..849db4a 100644
--- a/src/include/skalibs/selfpipe.h
+++ b/src/include/skalibs/selfpipe.h
@@ -1,7 +1,5 @@
 /* ISC license. */
 
-/* MT-unsafe */
-
 #ifndef SELFPIPE_H
 #define SELFPIPE_H
 
diff --git a/src/include/skalibs/siovec.h b/src/include/skalibs/siovec.h
index a543d93..2fb987f 100644
--- a/src/include/skalibs/siovec.h
+++ b/src/include/skalibs/siovec.h
@@ -3,7 +3,6 @@
 #ifndef SIOVEC_H
 #define SIOVEC_H
 
-#include <sys/types.h>
 #include <sys/uio.h>
 #include <skalibs/gccattributes.h>
 
diff --git a/src/include/skalibs/tai.h b/src/include/skalibs/tai.h
index 6ff8be7..53aad92 100644
--- a/src/include/skalibs/tai.h
+++ b/src/include/skalibs/tai.h
@@ -3,7 +3,6 @@
 #ifndef TAI_H
 #define TAI_H
 
-#include <sys/types.h>
 #include <stdint.h>
 #include <time.h>
 #include <sys/time.h>
diff --git a/src/include/skalibs/unix-transactional.h b/src/include/skalibs/unix-transactional.h
index b1decb5..41b31b7 100644
--- a/src/include/skalibs/unix-transactional.h
+++ b/src/include/skalibs/unix-transactional.h
@@ -4,8 +4,8 @@
 #define UNIX_TRANSACTIONAL_H
 
 #include <sys/types.h>
-#include <sys/uio.h>
 #include <sys/stat.h>
+#include <sys/uio.h>
 #include <skalibs/uint64.h>
 #include <skalibs/stralloc.h>
 
@@ -59,7 +59,7 @@ extern int dd_open_write (dirdescriptor_t *, char const *, unsigned int) ;
 extern int dd_close (dirdescriptor_t *) ;  /* after dd_open_read */
 extern void dd_cancel (dirdescriptor_t *) ; /* after dd_open_write */
 extern int dd_commit (dirdescriptor_t *) ; /* after dd_open_write */
-extern int dd_commit_devino (dirdescriptor_t *, uint64 *, uint64 *) ; /* after dd_open_write */
+extern int dd_commit_devino (dirdescriptor_t *, dev_t *, ino_t *) ; /* after dd_open_write */
 
 #define dd_openreadnclose(blah, file, s, len) openreadnclose_at((blah)->fd, file, s, len)
 #define dd_openslurpclose(blah, file, sa) openslurpclose_at((blah)->fd, file, sa)
diff --git a/src/include/skalibs/unixmessage.h b/src/include/skalibs/unixmessage.h
index 4c98ed6..34386c3 100644
--- a/src/include/skalibs/unixmessage.h
+++ b/src/include/skalibs/unixmessage.h
@@ -3,7 +3,6 @@
 #ifndef UNIXMESSAGE_H
 #define UNIXMESSAGE_H
 
-#include <sys/types.h>
 #include <sys/uio.h>
 #include <stdint.h>
 #include <skalibs/gccattributes.h>
diff --git a/src/libstddjb/bitarray_count.c b/src/libstddjb/bitarray_count.c
index 8f4ab50..19ed09e 100644
--- a/src/libstddjb/bitarray_count.c
+++ b/src/libstddjb/bitarray_count.c
@@ -1,7 +1,6 @@
 /* ISC license. */
 
 #include <sys/types.h>
-#include <skalibs/uint64.h>
 #include <skalibs/bitarray.h>
 
 #define B0(n) n, n+1, n+1, n+2
@@ -9,11 +8,11 @@
 #define B2(n) B1(n), B1(n+1), B1(n+1), B1(n+2)
 #define B3(n) B2(n), B2(n+1), B2(n+1), B2(n+2)
 
-uint64_t bitarray_countones (unsigned char const *c, size_t n)
+size_t bitarray_countones (unsigned char const *c, size_t n)
 {
   static unsigned char const table[256] = { B3(0) } ;
   size_t len = bitarray_div8(n) ;
-  uint64_t total = 0 ;
+  size_t total = 0 ;
   size_t i = 0 ;
   if (n & 7) len-- ;
   for (; i < len ; i++) total += table[c[i]] ;
diff --git a/src/libstddjb/buffer_get.c b/src/libstddjb/buffer_get.c
index 0d689ef..bf01012 100644
--- a/src/libstddjb/buffer_get.c
+++ b/src/libstddjb/buffer_get.c
@@ -8,6 +8,6 @@ ssize_t buffer_get (buffer *b, char *s, size_t len)
 {
   size_t w = 0 ;
   int r = buffer_getall(b, s, len, &w) ;
-  return r == -1 ? errno == EPIPE ? (errno = 0, (ssize_t)w) : -1 :
+  return r == -1 ? errno == EPIPE ? (errno = 0, w) : -1 :
          !r ? (errno = EWOULDBLOCK, -1) : w ;
 }
diff --git a/src/libstddjb/selfpipe_read.c b/src/libstddjb/selfpipe_read.c
index b31c6bd..92adf02 100644
--- a/src/libstddjb/selfpipe_read.c
+++ b/src/libstddjb/selfpipe_read.c
@@ -16,7 +16,7 @@ int selfpipe_read (void)
 {
   struct signalfd_siginfo buf ;
   ssize_t r = sanitize_read(fd_read(selfpipe_fd, (char *)&buf, sizeof(struct signalfd_siginfo))) ;
-  return (r <= 0) ? r : (int)buf.ssi_signo ;
+  return (r <= 0) ? r : buf.ssi_signo ;
 }
       
 #else
@@ -25,7 +25,7 @@ int selfpipe_read (void)
 {
   char c ;
   ssize_t r = sanitize_read((fd_read(selfpipe_fd, &c, 1))) ;
-  return (r <= 0) ? r : (int)c ;
+  return (r <= 0) ? r : c ;
 }
 
 #endif