Use a 64 bit off_t throughout the library and tests on POSIX Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
diff --git a/src/common.h b/src/common.h
index a73891d..5cb9d1b 100644
--- a/src/common.h
+++ b/src/common.h
@@ -1,6 +1,9 @@
#ifndef INCLUDE_common_h__
#define INCLUDE_common_h__
+/** Force 64 bit off_t size on POSIX. */
+#define _FILE_OFFSET_BITS 64
+
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
#define GIT_WIN32 1
#endif
diff --git a/src/fileops.h b/src/fileops.h
index 02e4e5b..98fffeb 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -6,9 +6,6 @@
#ifndef INCLUDE_fileops_h__
#define INCLUDE_fileops_h__
-/** Force 64 bit off_t size on POSIX. */
-#define _FILE_OFFSET_BITS 64
-
#include "common.h"
#include "map.h"
#include "dir.h"
diff --git a/tests/t0001-errno.c b/tests/t0001-errno.c
index dba81bc..01768b0 100644
--- a/tests/t0001-errno.c
+++ b/tests/t0001-errno.c
@@ -1,6 +1,5 @@
#include "test_lib.h"
#include "errors.h"
-#include <string.h>
BEGIN_TEST(errno_zero_on_init)
must_be_true(git_errno == 0);
diff --git a/tests/t0020-dirent.c b/tests/t0020-dirent.c
index 966f3c5..a2e130b 100644
--- a/tests/t0020-dirent.c
+++ b/tests/t0020-dirent.c
@@ -1,4 +1,3 @@
-#include <stdarg.h>
#include "test_lib.h"
#include "fileops.h"
diff --git a/tests/t0101-oid.c b/tests/t0101-oid.c
index 65654b6..4711d37 100644
--- a/tests/t0101-oid.c
+++ b/tests/t0101-oid.c
@@ -1,6 +1,5 @@
#include "test_lib.h"
#include <git/oid.h>
-#include <stdlib.h>
BEGIN_TEST(oid_szs)
git_oid out;
diff --git a/tests/t0201-existsloose.c b/tests/t0201-existsloose.c
index 004393e..76f2938 100644
--- a/tests/t0201-existsloose.c
+++ b/tests/t0201-existsloose.c
@@ -1,7 +1,6 @@
#include "test_lib.h"
#include "test_helpers.h"
#include <git/odb.h>
-#include "fileops.h"
static char *odb_dir = "test-objects";
diff --git a/tests/t0202-readloose.c b/tests/t0202-readloose.c
index e33a4bd..6e9fb9d 100644
--- a/tests/t0202-readloose.c
+++ b/tests/t0202-readloose.c
@@ -2,7 +2,6 @@
#include "test_lib.h"
#include "test_helpers.h"
#include <git/odb.h>
-#include "fileops.h"
/*
* read loose objects from the object directory. The objects are
diff --git a/tests/t0203-readloose.c b/tests/t0203-readloose.c
index 0bf364b..77bad85 100644
--- a/tests/t0203-readloose.c
+++ b/tests/t0203-readloose.c
@@ -2,7 +2,6 @@
#include "test_lib.h"
#include "test_helpers.h"
#include <git/odb.h>
-#include "fileops.h"
/*
* read loose objects from the object directory. The objects are
diff --git a/tests/test_helpers.c b/tests/test_helpers.c
index edc21d0..6829e2c 100644
--- a/tests/test_helpers.c
+++ b/tests/test_helpers.c
@@ -23,6 +23,7 @@
* Boston, MA 02110-1301, USA.
*/
+#include "common.h"
#include "test_helpers.h"
#include "fileops.h"
diff --git a/tests/test_lib.c b/tests/test_lib.c
index 06a1c29..9475785 100644
--- a/tests/test_lib.c
+++ b/tests/test_lib.c
@@ -23,10 +23,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
+#define GIT__NO_HIDE_MALLOC
#include "test_lib.h"
struct test_info
diff --git a/tests/test_lib.h b/tests/test_lib.h
index 8e9d2f9..f863bba 100644
--- a/tests/test_lib.h
+++ b/tests/test_lib.h
@@ -23,9 +23,14 @@
* Boston, MA 02110-1301, USA.
*/
-#include <stdio.h>
+#include "common.h"
#include <git/common.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+
/** Declare a function never returns to the caller. */
#ifdef __GNUC__
# define NORETURN __attribute__((__noreturn__))