refactor: adjust headers according to the style guide (#23934)

System headers should be included first to prevent naming conflicts.
This commit is contained in:
dundargoc
2023-06-06 14:00:32 +02:00
committed by GitHub
parent 7b973c71ea
commit f5d12889e8
9 changed files with 33 additions and 32 deletions

View File

@@ -10,7 +10,7 @@
#include "nvim/eval/typval_defs.h" #include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h" #include "nvim/ex_cmds_defs.h"
#include "nvim/func_attr.h" #include "nvim/func_attr.h"
#include "nvim/grid_defs.h" // for StlClickRecord #include "nvim/grid_defs.h"
#include "nvim/macros.h" #include "nvim/macros.h"
#include "nvim/memline.h" #include "nvim/memline.h"
#include "nvim/memline_defs.h" #include "nvim/memline_defs.h"

View File

@@ -18,6 +18,7 @@ typedef struct {
#include "klib/kvec.h" #include "klib/kvec.h"
#include "nvim/api/private/defs.h" #include "nvim/api/private/defs.h"
#include "nvim/eval/typval_defs.h" #include "nvim/eval/typval_defs.h"
#include "nvim/extmark_defs.h"
#include "nvim/garray.h" #include "nvim/garray.h"
#include "nvim/grid_defs.h" #include "nvim/grid_defs.h"
#include "nvim/hashtab.h" #include "nvim/hashtab.h"
@@ -25,9 +26,6 @@ typedef struct {
#include "nvim/map.h" #include "nvim/map.h"
#include "nvim/mark_defs.h" #include "nvim/mark_defs.h"
#include "nvim/marktree.h" #include "nvim/marktree.h"
// for float window title
#include "nvim/extmark_defs.h"
// for click definitions
#include "nvim/option_defs.h" #include "nvim/option_defs.h"
#include "nvim/pos.h" #include "nvim/pos.h"
#include "nvim/statusline_defs.h" #include "nvim/statusline_defs.h"

View File

@@ -14,6 +14,19 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <uv.h> #include <uv.h>
#ifdef MSWIN
# include <shlobj.h>
#endif
#if defined(HAVE_ACL)
# ifdef HAVE_SYS_ACL_H
# include <sys/acl.h>
# endif
# ifdef HAVE_SYS_ACCESS_H
# include <sys/access.h>
# endif
#endif
#include "auto/config.h" #include "auto/config.h"
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/gettext.h" #include "nvim/gettext.h"
@@ -731,15 +744,6 @@ int os_setperm(const char *const name, int perm)
return (r == kLibuvSuccess ? OK : FAIL); return (r == kLibuvSuccess ? OK : FAIL);
} }
#if defined(HAVE_ACL)
# ifdef HAVE_SYS_ACL_H
# include <sys/acl.h>
# endif
# ifdef HAVE_SYS_ACCESS_H
# include <sys/access.h>
# endif
#endif
// Return a pointer to the ACL of file "fname" in allocated memory. // Return a pointer to the ACL of file "fname" in allocated memory.
// Return NULL if the ACL is not available for whatever reason. // Return NULL if the ACL is not available for whatever reason.
vim_acl_T os_get_acl(const char *fname) vim_acl_T os_get_acl(const char *fname)
@@ -1225,8 +1229,6 @@ char *os_realpath(const char *name, char *buf)
} }
#ifdef MSWIN #ifdef MSWIN
# include <shlobj.h>
/// When "fname" is the name of a shortcut (*.lnk) resolve the file it points /// When "fname" is the name of a shortcut (*.lnk) resolve the file it points
/// to and return that name in allocated memory. /// to and return that name in allocated memory.
/// Otherwise NULL is returned. /// Otherwise NULL is returned.

View File

@@ -7,6 +7,12 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
// Note: Some systems need both string.h and strings.h (Savage).
#include <string.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef MSWIN #ifdef MSWIN
# include "nvim/os/win_defs.h" # include "nvim/os/win_defs.h"
#else #else
@@ -36,12 +42,6 @@
// Command-processing buffer. Use large buffers for all platforms. // Command-processing buffer. Use large buffers for all platforms.
#define CMDBUFFSIZE 1024 #define CMDBUFFSIZE 1024
// Note: Some systems need both string.h and strings.h (Savage).
#include <string.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
/// Converts libuv error (negative int) to error description string. /// Converts libuv error (negative int) to error description string.
#define os_strerror uv_strerror #define os_strerror uv_strerror

View File

@@ -13,14 +13,8 @@
#include <stdio.h> #include <stdio.h>
#include <uv.h> #include <uv.h>
#include "nvim/log.h"
#include "nvim/memory.h"
#include "nvim/os/process.h"
#ifdef MSWIN #ifdef MSWIN
# include <tlhelp32.h> # include <tlhelp32.h>
# include "nvim/api/private/helpers.h"
#endif #endif
#if defined(__FreeBSD__) // XXX: OpenBSD ? #if defined(__FreeBSD__) // XXX: OpenBSD ?
@@ -38,6 +32,14 @@
# include <sys/sysctl.h> # include <sys/sysctl.h>
#endif #endif
#include "nvim/log.h"
#include "nvim/memory.h"
#include "nvim/os/process.h"
#ifdef MSWIN
# include "nvim/api/private/helpers.h"
#endif
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/process.c.generated.h" // IWYU pragma: export # include "os/process.c.generated.h" // IWYU pragma: export
#endif #endif

View File

@@ -11,6 +11,7 @@
#include <string.h> #include <string.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <uv.h>
// forkpty is not in POSIX, so headers are platform-specific // forkpty is not in POSIX, so headers are platform-specific
#if defined(__FreeBSD__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__DragonFly__)
@@ -31,8 +32,6 @@
# include <crt_externs.h> # include <crt_externs.h>
#endif #endif
#include <uv.h>
#include "auto/config.h" #include "auto/config.h"
#include "klib/klist.h" #include "klib/klist.h"
#include "nvim/eval/typval.h" #include "nvim/eval/typval.h"

View File

@@ -7,7 +7,7 @@
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/eval/typval.h" #include "nvim/eval/typval.h"
#include "nvim/mbyte.h" // for utf8_to_utf16, utf16_to_utf8 #include "nvim/mbyte.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/pty_conpty_win.h" #include "nvim/os/pty_conpty_win.h"

View File

@@ -5,7 +5,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#ifndef MSWIN #ifndef MSWIN
# include <signal.h> // for sigset_t # include <signal.h>
#endif #endif
#include "nvim/autocmd.h" #include "nvim/autocmd.h"

View File

@@ -1,7 +1,7 @@
#ifndef NVIM_UNDO_DEFS_H #ifndef NVIM_UNDO_DEFS_H
#define NVIM_UNDO_DEFS_H #define NVIM_UNDO_DEFS_H
#include <time.h> // for time_t #include <time.h>
#include "nvim/extmark_defs.h" #include "nvim/extmark_defs.h"
#include "nvim/mark_defs.h" #include "nvim/mark_defs.h"