aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-07-07 22:59:54 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-07-07 22:59:54 +0200
commit55365b5dc3fe086e5dc3f1b9b9ec5d0da2a4ca5e (patch)
treeb84eaf4ca91ca5795d9698058fcfc6e4404b8d5e
parent3854053b3c533bf1e72bd21cd36f4c5fe3a1b74a (diff)
downloadblogc-55365b5dc3fe086e5dc3f1b9b9ec5d0da2a4ca5e.tar.gz
blogc-55365b5dc3fe086e5dc3f1b9b9ec5d0da2a4ca5e.tar.bz2
blogc-55365b5dc3fe086e5dc3f1b9b9ec5d0da2a4ca5e.zip
*: fixed includes
this refactoring was done with the help of the 'include-what-you-use' program. if this breaks the build for you, please report!
-rw-r--r--configure.ac2
-rw-r--r--src/blogc-git-receiver.c7
-rw-r--r--src/blogc-runserver.c6
-rw-r--r--src/blogc.c9
-rw-r--r--src/content-parser.c5
-rw-r--r--src/content-parser.h2
-rw-r--r--src/debug.c5
-rw-r--r--src/error.c5
-rw-r--r--src/error.h3
-rw-r--r--src/file.c6
-rw-r--r--src/file.h2
-rw-r--r--src/loader.c6
-rw-r--r--src/renderer.c8
-rw-r--r--src/source-parser.c6
-rw-r--r--src/source-parser.h2
-rw-r--r--src/template-parser.c5
-rw-r--r--src/template-parser.h1
-rw-r--r--src/utf8.c3
-rw-r--r--src/utf8.h3
-rw-r--r--src/utils.c6
-rw-r--r--src/utils.h2
-rw-r--r--tests/check_content_parser.c7
-rw-r--r--tests/check_datetime_parser.c7
-rw-r--r--tests/check_error.c5
-rw-r--r--tests/check_loader.c6
-rw-r--r--tests/check_renderer.c6
-rw-r--r--tests/check_source_parser.c4
-rw-r--r--tests/check_template_parser.c4
-rw-r--r--tests/check_utf8.c6
-rw-r--r--tests/check_utils.c3
30 files changed, 35 insertions, 107 deletions
diff --git a/configure.ac b/configure.ac
index 0e36070..11d2216 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,7 +152,7 @@ AS_IF([test "x$enable_runserver" = "xyes"], [
])
AM_CONDITIONAL([BUILD_RUNSERVER], [test "x$have_runserver" = "xyes"])
-AC_CHECK_HEADERS([sys/types.h sys/stat.h time.h])
+AC_CHECK_HEADERS([sys/stat.h time.h])
LT_LIB_M
diff --git a/src/blogc-git-receiver.c b/src/blogc-git-receiver.c
index e717259..820fce5 100644
--- a/src/blogc-git-receiver.c
+++ b/src/blogc-git-receiver.c
@@ -6,12 +6,8 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <stdarg.h>
#include <stdbool.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -19,7 +15,6 @@
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <dirent.h>
#include <time.h>
diff --git a/src/blogc-runserver.c b/src/blogc-runserver.c
index 81bd5f9..603946d 100644
--- a/src/blogc-runserver.c
+++ b/src/blogc-runserver.c
@@ -13,21 +13,21 @@
#include <event2/event.h>
#include <event2/http.h>
#include <event2/buffer.h>
-#include <event2/keyvalq_struct.h>
#include <magic.h>
#include <signal.h>
-#include <stdarg.h>
#include <stdbool.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "utils.h"
+struct evhttp_request;
+
/**
* this mapping is used to declare "supported" file types, that are forced over
diff --git a/src/blogc.c b/src/blogc.c
index 20e1756..c90070d 100644
--- a/src/blogc.c
+++ b/src/blogc.c
@@ -14,18 +14,15 @@
#include <sys/stat.h>
#endif /* HAVE_SYS_STAT_H */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif /* HAVE_SYS_TYPES_H */
-
#include <errno.h>
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
#include <string.h>
#include "debug.h"
-#include "source-parser.h"
#include "template-parser.h"
#include "loader.h"
#include "renderer.h"
@@ -78,7 +75,7 @@ blogc_mkdir_recursive(const char *filename)
for (char *tmp = fname; *tmp != '\0'; tmp++) {
if (*tmp != '/' && *tmp != '\\')
continue;
-#if defined(HAVE_SYS_STAT_H) && defined(HAVE_SYS_TYPES_H)
+#ifdef HAVE_SYS_STAT_H
char bkp = *tmp;
*tmp = '\0';
if ((strlen(fname) > 0) &&
diff --git a/src/content-parser.c b/src/content-parser.c
index b4bc790..ca0597b 100644
--- a/src/content-parser.c
+++ b/src/content-parser.c
@@ -6,11 +6,8 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdbool.h>
+#include <stdlib.h>
#include <string.h>
#include "content-parser.h"
diff --git a/src/content-parser.h b/src/content-parser.h
index 85bd063..37e38d7 100644
--- a/src/content-parser.h
+++ b/src/content-parser.h
@@ -9,7 +9,7 @@
#ifndef _CONTENT_PARSER_H
#define _CONTENT_PARSER_H
-#include <stdlib.h>
+#include <stddef.h>
#include <stdbool.h>
char* blogc_slugify(const char *str);
diff --git a/src/debug.c b/src/debug.c
index 7039608..9689028 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -6,15 +6,10 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdio.h>
#include "template-parser.h"
#include "utils.h"
-
#include "debug.h"
diff --git a/src/error.c b/src/error.c
index 0c297b9..c238f51 100644
--- a/src/error.c
+++ b/src/error.c
@@ -6,14 +6,9 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
-#include <string.h>
#include "error.h"
#include "utils.h"
diff --git a/src/error.h b/src/error.h
index acaf49e..31fbaf2 100644
--- a/src/error.h
+++ b/src/error.h
@@ -9,8 +9,7 @@
#ifndef _ERROR_H
#define _ERROR_H
-#include <stdlib.h>
-#include <stdarg.h>
+#include <stddef.h>
typedef enum {
BLOGC_ERROR_SOURCE_PARSER = 1,
diff --git a/src/file.c b/src/file.c
index 547f2f7..dc43056 100644
--- a/src/file.c
+++ b/src/file.c
@@ -6,12 +6,10 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <errno.h>
#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "file.h"
diff --git a/src/file.h b/src/file.h
index 97e5274..d2c4390 100644
--- a/src/file.h
+++ b/src/file.h
@@ -9,8 +9,8 @@
#ifndef _FILE_H
#define _FILE_H
+#include <stddef.h>
#include <stdio.h>
-#include <stdlib.h>
#include "error.h"
#define BLOGC_FILE_CHUNK_SIZE 1024
diff --git a/src/loader.c b/src/loader.c
index 5ca0aac..bd3251e 100644
--- a/src/loader.c
+++ b/src/loader.c
@@ -6,13 +6,11 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <math.h>
#include <stdbool.h>
+#include <stddef.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "file.h"
#include "source-parser.h"
diff --git a/src/renderer.c b/src/renderer.c
index c9cc15b..27e92bd 100644
--- a/src/renderer.c
+++ b/src/renderer.c
@@ -6,18 +6,14 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <errno.h>
#include <stdbool.h>
+#include <stddef.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "datetime-parser.h"
#include "error.h"
-#include "loader.h"
-#include "source-parser.h"
#include "template-parser.h"
#include "renderer.h"
#include "utils.h"
diff --git a/src/source-parser.c b/src/source-parser.c
index f250bd3..5d29213 100644
--- a/src/source-parser.c
+++ b/src/source-parser.c
@@ -6,11 +6,7 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <stdbool.h>
+#include <stdlib.h>
#include <string.h>
#include "content-parser.h"
diff --git a/src/source-parser.h b/src/source-parser.h
index 5cadf95..0d54742 100644
--- a/src/source-parser.h
+++ b/src/source-parser.h
@@ -9,7 +9,7 @@
#ifndef _SOURCE_PARSER_H
#define _SOURCE_PARSER_H
-#include <stdlib.h>
+#include <stddef.h>
#include "error.h"
#include "utils.h"
diff --git a/src/template-parser.c b/src/template-parser.c
index 7e9a444..6ca6eb7 100644
--- a/src/template-parser.c
+++ b/src/template-parser.c
@@ -6,11 +6,8 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdbool.h>
+#include <stdlib.h>
#include <string.h>
#include "template-parser.h"
diff --git a/src/template-parser.h b/src/template-parser.h
index fe2721e..19df6af 100644
--- a/src/template-parser.h
+++ b/src/template-parser.h
@@ -9,6 +9,7 @@
#ifndef _TEMPLATE_PARSER_H
#define _TEMPLATE_PARSER_H
+#include <stddef.h>
#include "error.h"
#include "utils.h"
diff --git a/src/utf8.c b/src/utf8.c
index 0c04d60..a2f4fdd 100644
--- a/src/utf8.c
+++ b/src/utf8.c
@@ -26,7 +26,8 @@
// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
#include <stdbool.h>
-#include <inttypes.h>
+#include <stddef.h>
+#include <stdint.h>
#include "utils.h"
#define UTF8_ACCEPT 0
diff --git a/src/utf8.h b/src/utf8.h
index 582ae1c..06fe07e 100644
--- a/src/utf8.h
+++ b/src/utf8.h
@@ -9,8 +9,9 @@
#ifndef _UTF_8_H
#define _UTF_8_H
-#include <inttypes.h>
#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
#include "utils.h"
bool blogc_utf8_validate(const uint8_t *str, size_t len);
diff --git a/src/utils.c b/src/utils.c
index 9a39c61..b42ae4e 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -6,17 +6,11 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#define SB_STRING_CHUNK_SIZE 128
-#include <ctype.h>
#include <string.h>
#include <stdarg.h>
#include <stdbool.h>
-#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/src/utils.h b/src/utils.h
index aefcbf3..aca02c0 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -12,8 +12,6 @@
#include <stddef.h>
#include <stdarg.h>
#include <stdbool.h>
-#include <stdarg.h>
-#include <stdlib.h>
// memory
diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c
index ca5a58d..79b31c3 100644
--- a/tests/check_content_parser.c
+++ b/tests/check_content_parser.c
@@ -6,17 +6,12 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
-#include <string.h>
+#include <stdlib.h>
#include "../src/content-parser.h"
-#include "../src/utils.h"
static void
diff --git a/tests/check_datetime_parser.c b/tests/check_datetime_parser.c
index ba5a79d..03f5a9a 100644
--- a/tests/check_datetime_parser.c
+++ b/tests/check_datetime_parser.c
@@ -6,16 +6,11 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
-#include <string.h>
-#include <stdio.h>
+#include <stdlib.h>
#include <locale.h>
#include "../src/error.h"
#include "../src/datetime-parser.h"
diff --git a/tests/check_error.c b/tests/check_error.c
index 8818b00..e844998 100644
--- a/tests/check_error.c
+++ b/tests/check_error.c
@@ -6,17 +6,12 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <string.h>
#include "../src/error.h"
-#include "../src/utils.h"
static void
diff --git a/tests/check_loader.c b/tests/check_loader.c
index 4a5dc32..44468c8 100644
--- a/tests/check_loader.c
+++ b/tests/check_loader.c
@@ -6,16 +6,14 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
+#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include "../src/error.h"
#include "../src/template-parser.h"
#include "../src/loader.h"
#include "../src/utils.h"
diff --git a/tests/check_renderer.c b/tests/check_renderer.c
index cbd4a8e..c2c5618 100644
--- a/tests/check_renderer.c
+++ b/tests/check_renderer.c
@@ -6,14 +6,12 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
+#include <stdbool.h>
+#include <stdlib.h>
#include <string.h>
#include "../src/error.h"
#include "../src/renderer.h"
diff --git a/tests/check_source_parser.c b/tests/check_source_parser.c
index d94dc70..bbd9ec6 100644
--- a/tests/check_source_parser.c
+++ b/tests/check_source_parser.c
@@ -6,10 +6,6 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
diff --git a/tests/check_template_parser.c b/tests/check_template_parser.c
index 2b34c6f..da6a184 100644
--- a/tests/check_template_parser.c
+++ b/tests/check_template_parser.c
@@ -6,10 +6,6 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
diff --git a/tests/check_utf8.c b/tests/check_utf8.c
index d9b6cd4..e7be61e 100644
--- a/tests/check_utf8.c
+++ b/tests/check_utf8.c
@@ -6,14 +6,12 @@
* See the file LICENSE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
+#include <stdbool.h>
+#include <stdint.h>
#include <string.h>
#include "../src/utf8.h"
#include "../src/utils.h"
diff --git a/tests/check_utils.c b/tests/check_utils.c
index b76d171..1750aa2 100644
--- a/tests/check_utils.c
+++ b/tests/check_utils.c
@@ -10,9 +10,8 @@
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
-
+#include <stdbool.h>
#include <stdlib.h>
-
#include "../src/utils.h"
#define SB_STRING_CHUNK_SIZE 128