aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-11-10 12:23:42 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-11-12 22:01:28 +0100
commit4f8941c1a5f1ef6caa410feeb52e343db22763ce (patch)
tree6e801079d088533198d526cb9aac8eb7981dc568 /src/nvim/os
parent353a4be7e84fdc101318215bdcc8a7e780d737fe (diff)
downloadrneovim-4f8941c1a5f1ef6caa410feeb52e343db22763ce.tar.gz
rneovim-4f8941c1a5f1ef6caa410feeb52e343db22763ce.tar.bz2
rneovim-4f8941c1a5f1ef6caa410feeb52e343db22763ce.zip
refactor: replace manual header guards with #pragma once
It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard.
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/dl.h4
-rw-r--r--src/nvim/os/fileio.h4
-rw-r--r--src/nvim/os/fs.h4
-rw-r--r--src/nvim/os/fs_defs.h5
-rw-r--r--src/nvim/os/input.h4
-rw-r--r--src/nvim/os/lang.h4
-rw-r--r--src/nvim/os/os.h5
-rw-r--r--src/nvim/os/os_defs.h5
-rw-r--r--src/nvim/os/os_win_console.h5
-rw-r--r--src/nvim/os/process.h5
-rw-r--r--src/nvim/os/pty_conpty_win.h5
-rw-r--r--src/nvim/os/pty_process.h4
-rw-r--r--src/nvim/os/pty_process_unix.h5
-rw-r--r--src/nvim/os/pty_process_win.h5
-rw-r--r--src/nvim/os/shell.h4
-rw-r--r--src/nvim/os/signal.h4
-rw-r--r--src/nvim/os/stdpaths_defs.h5
-rw-r--r--src/nvim/os/time.h4
-rw-r--r--src/nvim/os/tty.h4
-rw-r--r--src/nvim/os/unix_defs.h5
-rw-r--r--src/nvim/os/win_defs.h5
21 files changed, 21 insertions, 74 deletions
diff --git a/src/nvim/os/dl.h b/src/nvim/os/dl.h
index 302e4e6678..9c41a28f69 100644
--- a/src/nvim/os/dl.h
+++ b/src/nvim/os/dl.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_DL_H
-#define NVIM_OS_DL_H
+#pragma once
#include <stdbool.h>
#include <stdint.h>
@@ -7,4 +6,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/dl.h.generated.h"
#endif
-#endif // NVIM_OS_DL_H
diff --git a/src/nvim/os/fileio.h b/src/nvim/os/fileio.h
index 5e47bbf921..72e7984c8a 100644
--- a/src/nvim/os/fileio.h
+++ b/src/nvim/os/fileio.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_FILEIO_H
-#define NVIM_OS_FILEIO_H
+#pragma once
#include <stdbool.h>
#include <stddef.h>
@@ -75,4 +74,3 @@ enum {
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/fileio.h.generated.h"
#endif
-#endif // NVIM_OS_FILEIO_H
diff --git a/src/nvim/os/fs.h b/src/nvim/os/fs.h
index 75c24b8db2..4fe54215ba 100644
--- a/src/nvim/os/fs.h
+++ b/src/nvim/os/fs.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_FS_H
-#define NVIM_OS_FS_H
+#pragma once
#include "nvim/os/fs_defs.h"
#include "nvim/types.h"
@@ -7,4 +6,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/fs.h.generated.h"
#endif
-#endif // NVIM_OS_FS_H
diff --git a/src/nvim/os/fs_defs.h b/src/nvim/os/fs_defs.h
index f4929b12b1..e5355ddefd 100644
--- a/src/nvim/os/fs_defs.h
+++ b/src/nvim/os/fs_defs.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_FS_DEFS_H
-#define NVIM_OS_FS_DEFS_H
+#pragma once
#include <uv.h>
@@ -26,5 +25,3 @@ typedef struct {
#define NODE_WRITABLE 1 // something we can write to (character
// device, fifo, socket, ..)
#define NODE_OTHER 2 // non-writable thing (e.g., block device)
-
-#endif // NVIM_OS_FS_DEFS_H
diff --git a/src/nvim/os/input.h b/src/nvim/os/input.h
index d42da010f0..113dbbb8d5 100644
--- a/src/nvim/os/input.h
+++ b/src/nvim/os/input.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_INPUT_H
-#define NVIM_OS_INPUT_H
+#pragma once
#include <stdbool.h>
#include <stdint.h>
@@ -13,4 +12,3 @@ EXTERN bool used_stdin INIT( = false);
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/input.h.generated.h"
#endif
-#endif // NVIM_OS_INPUT_H
diff --git a/src/nvim/os/lang.h b/src/nvim/os/lang.h
index ad64b38916..dd32378c69 100644
--- a/src/nvim/os/lang.h
+++ b/src/nvim/os/lang.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_LANG_H
-#define NVIM_OS_LANG_H
+#pragma once
#include "nvim/cmdexpand_defs.h"
#include "nvim/ex_cmds_defs.h"
@@ -8,4 +7,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/lang.h.generated.h"
#endif
-#endif // NVIM_OS_LANG_H
diff --git a/src/nvim/os/os.h b/src/nvim/os/os.h
index 006dfbfc04..54fff5c8e3 100644
--- a/src/nvim/os/os.h
+++ b/src/nvim/os/os.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_OS_H
-#define NVIM_OS_OS_H
+#pragma once
#include <stdbool.h>
#include <uv.h>
@@ -21,5 +20,3 @@
#define ENV_LOGFILE "NVIM_LOG_FILE"
#define ENV_NVIM "NVIM"
-
-#endif // NVIM_OS_OS_H
diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h
index 1e0f5b77f8..e5060a5e6a 100644
--- a/src/nvim/os/os_defs.h
+++ b/src/nvim/os/os_defs.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_OS_DEFS_H
-#define NVIM_OS_OS_DEFS_H
+#pragma once
#include <ctype.h>
#include <stdio.h>
@@ -104,5 +103,3 @@
# define S_ISLNK(m) 0
# endif
#endif
-
-#endif // NVIM_OS_OS_DEFS_H
diff --git a/src/nvim/os/os_win_console.h b/src/nvim/os/os_win_console.h
index 7b5800afa8..098267312a 100644
--- a/src/nvim/os/os_win_console.h
+++ b/src/nvim/os/os_win_console.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_OS_WIN_CONSOLE_H
-#define NVIM_OS_OS_WIN_CONSOLE_H
+#pragma once
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/os_win_console.h.generated.h"
@@ -8,5 +7,3 @@
#ifndef ENABLE_VIRTUAL_TERMINAL_INPUT
# define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200
#endif
-
-#endif // NVIM_OS_OS_WIN_CONSOLE_H
diff --git a/src/nvim/os/process.h b/src/nvim/os/process.h
index faa4762cf1..61a5009fd8 100644
--- a/src/nvim/os/process.h
+++ b/src/nvim/os/process.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_PROCESS_H
-#define NVIM_OS_PROCESS_H
+#pragma once
#include <stddef.h>
@@ -8,5 +7,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/process.h.generated.h"
#endif
-
-#endif // NVIM_OS_PROCESS_H
diff --git a/src/nvim/os/pty_conpty_win.h b/src/nvim/os/pty_conpty_win.h
index c47857bdd9..aa04cd1e84 100644
--- a/src/nvim/os/pty_conpty_win.h
+++ b/src/nvim/os/pty_conpty_win.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_PTY_CONPTY_WIN_H
-#define NVIM_OS_PTY_CONPTY_WIN_H
+#pragma once
#include "klib/kvec.h"
#include "nvim/os/input.h"
@@ -21,5 +20,3 @@ typedef struct conpty {
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/pty_conpty_win.h.generated.h"
#endif
-
-#endif // NVIM_OS_PTY_CONPTY_WIN_H
diff --git a/src/nvim/os/pty_process.h b/src/nvim/os/pty_process.h
index 07d346be22..2c7a5f66bd 100644
--- a/src/nvim/os/pty_process.h
+++ b/src/nvim/os/pty_process.h
@@ -1,9 +1,7 @@
-#ifndef NVIM_OS_PTY_PROCESS_H
-#define NVIM_OS_PTY_PROCESS_H
+#pragma once
#ifdef MSWIN
# include "nvim/os/pty_process_win.h"
#else
# include "nvim/os/pty_process_unix.h"
#endif
-#endif // NVIM_OS_PTY_PROCESS_H
diff --git a/src/nvim/os/pty_process_unix.h b/src/nvim/os/pty_process_unix.h
index 0cc68cf3e9..344e0a3423 100644
--- a/src/nvim/os/pty_process_unix.h
+++ b/src/nvim/os/pty_process_unix.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_PTY_PROCESS_UNIX_H
-#define NVIM_OS_PTY_PROCESS_UNIX_H
+#pragma once
#include <stdint.h>
#include <sys/ioctl.h>
@@ -27,5 +26,3 @@ static inline PtyProcess pty_process_init(Loop *loop, void *data)
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/pty_process_unix.h.generated.h"
#endif
-
-#endif // NVIM_OS_PTY_PROCESS_UNIX_H
diff --git a/src/nvim/os/pty_process_win.h b/src/nvim/os/pty_process_win.h
index ed7d765ac7..71190380fd 100644
--- a/src/nvim/os/pty_process_win.h
+++ b/src/nvim/os/pty_process_win.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_PTY_PROCESS_WIN_H
-#define NVIM_OS_PTY_PROCESS_WIN_H
+#pragma once
#include <uv.h>
@@ -37,5 +36,3 @@ static inline PtyProcess pty_process_init(Loop *loop, void *data)
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/pty_process_win.h.generated.h"
#endif
-
-#endif // NVIM_OS_PTY_PROCESS_WIN_H
diff --git a/src/nvim/os/shell.h b/src/nvim/os/shell.h
index 48503f2601..498c72e63d 100644
--- a/src/nvim/os/shell.h
+++ b/src/nvim/os/shell.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_SHELL_H
-#define NVIM_OS_SHELL_H
+#pragma once
#include <stdio.h>
@@ -19,4 +18,3 @@ typedef enum {
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/shell.h.generated.h"
#endif
-#endif // NVIM_OS_SHELL_H
diff --git a/src/nvim/os/signal.h b/src/nvim/os/signal.h
index 5d8cc6f661..83a0a9c91b 100644
--- a/src/nvim/os/signal.h
+++ b/src/nvim/os/signal.h
@@ -1,7 +1,5 @@
-#ifndef NVIM_OS_SIGNAL_H
-#define NVIM_OS_SIGNAL_H
+#pragma once
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/signal.h.generated.h"
#endif
-#endif // NVIM_OS_SIGNAL_H
diff --git a/src/nvim/os/stdpaths_defs.h b/src/nvim/os/stdpaths_defs.h
index f94c511fe7..985688390d 100644
--- a/src/nvim/os/stdpaths_defs.h
+++ b/src/nvim/os/stdpaths_defs.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_STDPATHS_DEFS_H
-#define NVIM_OS_STDPATHS_DEFS_H
+#pragma once
/// List of possible XDG variables
typedef enum {
@@ -12,5 +11,3 @@ typedef enum {
kXDGConfigDirs, ///< XDG_CONFIG_DIRS
kXDGDataDirs, ///< XDG_DATA_DIRS
} XDGVarType;
-
-#endif // NVIM_OS_STDPATHS_DEFS_H
diff --git a/src/nvim/os/time.h b/src/nvim/os/time.h
index 1b6c667dbb..8f8b5511bd 100644
--- a/src/nvim/os/time.h
+++ b/src/nvim/os/time.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_TIME_H
-#define NVIM_OS_TIME_H
+#pragma once
#include <stdbool.h>
#include <stdint.h>
@@ -10,4 +9,3 @@ typedef uint64_t Timestamp;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/time.h.generated.h"
#endif
-#endif // NVIM_OS_TIME_H
diff --git a/src/nvim/os/tty.h b/src/nvim/os/tty.h
index d771e63768..3a78573189 100644
--- a/src/nvim/os/tty.h
+++ b/src/nvim/os/tty.h
@@ -1,7 +1,5 @@
-#ifndef NVIM_OS_TTY_H
-#define NVIM_OS_TTY_H
+#pragma once
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/tty.h.generated.h"
#endif
-#endif // NVIM_OS_TTY_H
diff --git a/src/nvim/os/unix_defs.h b/src/nvim/os/unix_defs.h
index 8d002fc5e9..42d649d773 100644
--- a/src/nvim/os/unix_defs.h
+++ b/src/nvim/os/unix_defs.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_UNIX_DEFS_H
-#define NVIM_OS_UNIX_DEFS_H
+#pragma once
#include <sys/param.h>
#include <unistd.h>
@@ -21,5 +20,3 @@
// Character that separates entries in $PATH.
#define ENV_SEPCHAR ':'
#define ENV_SEPSTR ":"
-
-#endif // NVIM_OS_UNIX_DEFS_H
diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h
index 4f8a242a51..e1bc1a727b 100644
--- a/src/nvim/os/win_defs.h
+++ b/src/nvim/os/win_defs.h
@@ -1,5 +1,4 @@
-#ifndef NVIM_OS_WIN_DEFS_H
-#define NVIM_OS_WIN_DEFS_H
+#pragma once
#ifndef MSWIN
# error Header must be included only when compiling for Windows.
@@ -86,5 +85,3 @@ typedef int mode_t;
#ifndef STDERR_FILENO
# define STDERR_FILENO 2
#endif
-
-#endif // NVIM_OS_WIN_DEFS_H