summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-02-16 11:28:53 +0000
committerPatrick Steinhardt <ps@pks.im>2018-02-16 11:42:28 +0000
commit92324d84921721035458ba8d128dea48436525ec (patch)
treef7129297c67e1c7df12b32a149a50750b7b21f55
parent06b8a40f8b5eb1188a326d90705945b3a9b6a19f (diff)
downloadlibgit2-92324d84921721035458ba8d128dea48436525ec.tar.gz
util: clean up header includes
While "util.h" declares the macro `git__tolower`, which simply resorts to tolower(3P) on Unix-like systems, the <ctype.h> header is only being included in "util.c". Thus, anybody who has included "util.h" without having <ctype.h> included will fail to compile as soon as the macro is in use. Furthermore, we can clean up additional includes in "util.c" and simply replace them with an include for "common.h".
-rw-r--r--src/util.c5
-rw-r--r--src/util.h8
2 files changed, 7 insertions, 6 deletions
diff --git a/src/util.c b/src/util.c
index b984b99ee..34841df4f 100644
--- a/src/util.c
+++ b/src/util.c
@@ -7,10 +7,7 @@
#include "util.h"
-#include "git2.h"
-#include <stdio.h>
-#include <ctype.h>
-#include "posix.h"
+#include "common.h"
#ifdef GIT_WIN32
# include "win32/w32_buffer.h"
diff --git a/src/util.h b/src/util.h
index 63ffa134e..f6d19cfde 100644
--- a/src/util.h
+++ b/src/util.h
@@ -9,12 +9,16 @@
#include "common.h"
+#ifndef GIT_WIN32
+# include <ctype.h>
+#endif
+
#include "git2/buffer.h"
-#include "buffer.h"
-#include "thread-utils.h"
+#include "buffer.h"
#include "common.h"
#include "strnlen.h"
+#include "thread-utils.h"
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define bitsizeof(x) (CHAR_BIT * sizeof(x))