Krolyxon
Commit b162aee

Branches

Refs →

nsxivb162aee

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.
Author
NRK
Date
2022-06-16 13:39 +0600
Committer
Gitea · 2022-06-28 21:28 +0200
Parent
6d5a040
Commit
b162aee497ef9be3730f59bb0c9d974171bfebee

+24 −20

8 files changed

  1. M .woodpecker/clang-tidy-checks +1 −0
  2. M autoreload.c +1 −1
  3. M commands.c +4 −4
  4. M main.c +10 −9
  5. M nsxiv.h +2 −1
  6. M options.c +1 −1
  7. M util.c +2 −2
  8. M window.c +3 −2
M .woodpecker/clang-tidy-checks View
@@ -1,6 +1,7 @@
11 # checks
22 clang-analyzer-*,clang-diagnostic-*,bugprone-*,performance-*,modernize-*
33 misc-*,readability-*,android-cloexec-*,cert-*
4+llvm-include-order
45
56 # silence
67 -misc-unused-parameters
M autoreload.c View
@@ -23,8 +23,8 @@
2323 #include <errno.h>
2424 #include <stdlib.h>
2525 #include <string.h>
26−#include <unistd.h>
2726 #include <sys/inotify.h>
27+#include <unistd.h>
2828
2929 static union {
3030 char d[4096]; /* aligned buffer */
M commands.c View
@@ -19,13 +19,13 @@
1919
2020 #include "nsxiv.h"
2121
22−#include <stdlib.h>
22+#include "commands.h"
23+
2324 #include <stdio.h>
25+#include <stdlib.h>
2426 #include <string.h>
25−#include <unistd.h>
2627 #include <sys/wait.h>
27−
28−#include "commands.h"
28+#include <unistd.h>
2929
3030 extern img_t img;
3131 extern tns_t tns;
M main.c View
@@ -22,22 +22,23 @@
2222 #include "commands.h"
2323 #include "config.h"
2424
25−#include <stdlib.h>
26−#include <stdarg.h>
27−#include <stdio.h>
28−#include <string.h>
29−#include <fcntl.h>
30−#include <unistd.h>
3125 #include <errno.h>
26+#include <fcntl.h>
3227 #include <locale.h>
33−#include <signal.h>
3428 #include <poll.h>
29+#include <signal.h>
30+#include <stdarg.h>
31+#include <stdio.h>
32+#include <stdlib.h>
33+#include <string.h>
3534 #include <sys/stat.h>
35+#include <sys/time.h>
3636 #include <sys/wait.h>
3737 #include <time.h>
38−#include <sys/time.h>
39−#include <X11/keysym.h>
38+#include <unistd.h>
39+
4040 #include <X11/XF86keysym.h>
41+#include <X11/keysym.h>
4142
4243 #define MODMASK(mask) ((mask) & USED_MODMASK)
4344 #define BAR_SEP " "
M nsxiv.h View
@@ -20,8 +20,9 @@
2020 #ifndef NSXIV_H
2121 #define NSXIV_H
2222
23−#include <stddef.h>
2423 #include <stdbool.h>
24+#include <stddef.h>
25+
2526 #include <Imlib2.h>
2627 #include <X11/Xlib.h>
2728
M options.c View
@@ -20,8 +20,8 @@
2020 #include "nsxiv.h"
2121 #include "version.h"
2222
23−#include <stdlib.h>
2423 #include <stdio.h>
24+#include <stdlib.h>
2525 #include <string.h>
2626 #include <unistd.h>
2727
M util.c View
@@ -20,13 +20,13 @@
2020 #include "nsxiv.h"
2121
2222 #include <assert.h>
23−#include <stdlib.h>
23+#include <errno.h>
2424 #include <stdarg.h>
2525 #include <stdio.h>
26+#include <stdlib.h>
2627 #include <string.h>
2728 #include <sys/stat.h>
2829 #include <unistd.h>
29−#include <errno.h>
3030
3131 const char *progname;
3232
M window.c View
@@ -22,13 +22,14 @@
2222 #include "config.h"
2323 #include "icon/data.h"
2424
25+#include <locale.h>
2526 #include <stdlib.h>
2627 #include <string.h>
27−#include <locale.h>
2828 #include <unistd.h>
29−#include <X11/cursorfont.h>
29+
3030 #include <X11/Xatom.h>
3131 #include <X11/Xresource.h>
32+#include <X11/cursorfont.h>
3233
3334 #if HAVE_LIBFONTS
3435 #include "utf8.h"