summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-03-13 10:31:14 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-03-13 10:31:14 +0000
commite450f6efc39e55e32264d2daded6c757af0f7527 (patch)
tree7f03bd312b8e589cc494ca9776dc81b815ef14cd /src/include
parent04905aaeffba2bc77866a4056dc3f2020a86bb26 (diff)
downloadskalibs-e450f6efc39e55e32264d2daded6c757af0f7527.tar.xz
Cleanups - mostly removing superfluous includes in headers
Diffstat (limited to 'src/include')
-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
15 files changed, 10 insertions, 28 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>