aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-06-16 13:39:03 +0600
committerGitea <gitea@fake.local>2022-06-28 21:28:06 +0200
commitb162aee497ef9be3730f59bb0c9d974171bfebee (patch)
tree9dd81766b59b6463cc23e698b3a8875a84e4e16c
parent6d5a04005dd1dff12ebfe2e3a56912ec26718f3f (diff)
sort and group includes
* includes are sorted alphabetically * their grouping and layout is the following: - nsxiv.h will be the first include - followed by any internal headers (e.g "commands.h" "config.h") - followed by system headers (<stdlib.h> etc) - followed by third party headers (X.h libwebp etc) * also add `llvm-include-order` check to clang-tidy so that it can catch unsorted includes during CI.
-rw-r--r--.woodpecker/clang-tidy-checks1
-rw-r--r--autoreload.c2
-rw-r--r--commands.c8
-rw-r--r--main.c19
-rw-r--r--nsxiv.h3
-rw-r--r--options.c2
-rw-r--r--util.c4
-rw-r--r--window.c5
8 files changed, 24 insertions, 20 deletions
diff --git a/.woodpecker/clang-tidy-checks b/.woodpecker/clang-tidy-checks
index 67394d4..3c6c62e 100644
--- a/.woodpecker/clang-tidy-checks
+++ b/.woodpecker/clang-tidy-checks
@@ -1,6 +1,7 @@
# checks
clang-analyzer-*,clang-diagnostic-*,bugprone-*,performance-*,modernize-*
misc-*,readability-*,android-cloexec-*,cert-*
+llvm-include-order
# silence
-misc-unused-parameters
diff --git a/autoreload.c b/autoreload.c
index 47751d5..c4b5665 100644
--- a/autoreload.c
+++ b/autoreload.c
@@ -23,8 +23,8 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <sys/inotify.h>
+#include <unistd.h>
static union {
char d[4096]; /* aligned buffer */
diff --git a/commands.c b/commands.c
index 8a73462..8741a26 100644
--- a/commands.c
+++ b/commands.c
@@ -19,13 +19,13 @@
#include "nsxiv.h"
-#include <stdlib.h>
+#include "commands.h"
+
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <sys/wait.h>
-
-#include "commands.h"
+#include <unistd.h>
extern img_t img;
extern tns_t tns;
diff --git a/main.c b/main.c
index 10f7440..a6c4187 100644
--- a/main.c
+++ b/main.c
@@ -22,22 +22,23 @@
#include "commands.h"
#include "config.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
#include <errno.h>
+#include <fcntl.h>
#include <locale.h>
-#include <signal.h>
#include <poll.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <sys/wait.h>
#include <time.h>
-#include <sys/time.h>
-#include <X11/keysym.h>
+#include <unistd.h>
+
#include <X11/XF86keysym.h>
+#include <X11/keysym.h>
#define MODMASK(mask) ((mask) & USED_MODMASK)
#define BAR_SEP " "
diff --git a/nsxiv.h b/nsxiv.h
index eb06328..7d81fff 100644
--- a/nsxiv.h
+++ b/nsxiv.h
@@ -20,8 +20,9 @@
#ifndef NSXIV_H
#define NSXIV_H
-#include <stddef.h>
#include <stdbool.h>
+#include <stddef.h>
+
#include <Imlib2.h>
#include <X11/Xlib.h>
diff --git a/options.c b/options.c
index 8fade87..69b45b9 100644
--- a/options.c
+++ b/options.c
@@ -20,8 +20,8 @@
#include "nsxiv.h"
#include "version.h"
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/util.c b/util.c
index 31ab4b8..65c39e5 100644
--- a/util.c
+++ b/util.c
@@ -20,13 +20,13 @@
#include "nsxiv.h"
#include <assert.h>
-#include <stdlib.h>
+#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <errno.h>
const char *progname;
diff --git a/window.c b/window.c
index 3cfa188..f472474 100644
--- a/window.c
+++ b/window.c
@@ -22,13 +22,14 @@
#include "config.h"
#include "icon/data.h"
+#include <locale.h>
#include <stdlib.h>
#include <string.h>
-#include <locale.h>
#include <unistd.h>
-#include <X11/cursorfont.h>
+
#include <X11/Xatom.h>
#include <X11/Xresource.h>
+#include <X11/cursorfont.h>
#if HAVE_LIBFONTS
#include "utf8.h"