mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
refactor: move function macros out of vim_defs.h (#26300)
This commit is contained in:
parent
18c1fd8e9d
commit
86cc791deb
1
Makefile
1
Makefile
@ -221,7 +221,6 @@ iwyu: build/.ran-cmake
|
|||||||
|src/nvim/ui.h\
|
|src/nvim/ui.h\
|
||||||
|src/nvim/ui_client.h\
|
|src/nvim/ui_client.h\
|
||||||
|src/nvim/ui_compositor.h\
|
|src/nvim/ui_compositor.h\
|
||||||
|src/nvim/vim_defs.h\
|
|
||||||
|src/nvim/viml/parser/expressions.h\
|
|src/nvim/viml/parser/expressions.h\
|
||||||
|src/nvim/viml/parser/parser.h\
|
|src/nvim/viml/parser/parser.h\
|
||||||
|src/nvim/window.h\
|
|src/nvim/window.h\
|
||||||
|
@ -976,7 +976,6 @@ def CheckIncludes(filename, lines, error):
|
|||||||
"src/nvim/ui.h",
|
"src/nvim/ui.h",
|
||||||
"src/nvim/ui_client.h",
|
"src/nvim/ui_client.h",
|
||||||
"src/nvim/ui_compositor.h",
|
"src/nvim/ui_compositor.h",
|
||||||
"src/nvim/vim_defs.h",
|
|
||||||
"src/nvim/viml/parser/expressions.h",
|
"src/nvim/viml/parser/expressions.h",
|
||||||
"src/nvim/viml/parser/parser.h",
|
"src/nvim/viml/parser/parser.h",
|
||||||
"src/nvim/window.h",
|
"src/nvim/window.h",
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "nvim/option.h"
|
#include "nvim/option.h"
|
||||||
#include "nvim/types_defs.h"
|
#include "nvim/types_defs.h"
|
||||||
#include "nvim/ui.h"
|
#include "nvim/ui.h"
|
||||||
#include "nvim/vim_defs.h"
|
|
||||||
|
|
||||||
#define BUF_POS(data) ((size_t)((data)->buf_wptr - (data)->buf))
|
#define BUF_POS(data) ((size_t)((data)->buf_wptr - (data)->buf))
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "nvim/memory.h"
|
#include "nvim/memory.h"
|
||||||
#include "nvim/option.h"
|
#include "nvim/option.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
|
#include "nvim/strings.h"
|
||||||
#include "nvim/syntax.h"
|
#include "nvim/syntax.h"
|
||||||
#include "nvim/ui.h"
|
#include "nvim/ui.h"
|
||||||
#include "nvim/window.h"
|
#include "nvim/window.h"
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "nvim/state_defs.h"
|
#include "nvim/state_defs.h"
|
||||||
#include "nvim/strings.h"
|
#include "nvim/strings.h"
|
||||||
#include "nvim/ui.h"
|
#include "nvim/ui.h"
|
||||||
#include "nvim/vim_defs.h"
|
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "cursor_shape.c.generated.h"
|
# include "cursor_shape.c.generated.h"
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "nvim/message.h"
|
#include "nvim/message.h"
|
||||||
#include "nvim/option.h"
|
#include "nvim/option.h"
|
||||||
#include "nvim/popupmenu.h"
|
#include "nvim/popupmenu.h"
|
||||||
|
#include "nvim/strings.h"
|
||||||
#include "nvim/types_defs.h"
|
#include "nvim/types_defs.h"
|
||||||
#include "nvim/ui.h"
|
#include "nvim/ui.h"
|
||||||
#include "nvim/vim_defs.h"
|
#include "nvim/vim_defs.h"
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "nvim/memory.h"
|
#include "nvim/memory.h"
|
||||||
#include "nvim/message.h"
|
#include "nvim/message.h"
|
||||||
#include "nvim/mouse.h"
|
#include "nvim/mouse.h"
|
||||||
#include "nvim/vim_defs.h"
|
#include "nvim/strings.h"
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "keycodes.c.generated.h"
|
# include "keycodes.c.generated.h"
|
||||||
|
@ -36,8 +36,8 @@
|
|||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
#include "nvim/regexp.h"
|
#include "nvim/regexp.h"
|
||||||
#include "nvim/runtime.h"
|
#include "nvim/runtime.h"
|
||||||
|
#include "nvim/strings.h"
|
||||||
#include "nvim/types_defs.h"
|
#include "nvim/types_defs.h"
|
||||||
#include "nvim/vim_defs.h"
|
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "lua/stdlib.c.generated.h"
|
# include "lua/stdlib.c.generated.h"
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "nvim/macros_defs.h"
|
#include "nvim/macros_defs.h"
|
||||||
#include "nvim/memory.h"
|
#include "nvim/memory.h"
|
||||||
#include "nvim/pos_defs.h"
|
#include "nvim/pos_defs.h"
|
||||||
#include "nvim/vim_defs.h"
|
|
||||||
#include "xdiff/xdiff.h"
|
#include "xdiff/xdiff.h"
|
||||||
|
|
||||||
#define COMPARED_BUFFER0 (1 << 0)
|
#define COMPARED_BUFFER0 (1 << 0)
|
||||||
|
@ -213,6 +213,18 @@ void *xmemdupz(const void *data, size_t len)
|
|||||||
return memcpy(xmallocz(len), data, len);
|
return memcpy(xmallocz(len), data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_STRNLEN
|
||||||
|
size_t xstrnlen(const char *s, size_t n)
|
||||||
|
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE
|
||||||
|
{
|
||||||
|
const char *end = memchr(s, '\0', n);
|
||||||
|
if (end == NULL) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
return (size_t)(end - s);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// A version of strchr() that returns a pointer to the terminating NUL if it
|
/// A version of strchr() that returns a pointer to the terminating NUL if it
|
||||||
/// doesn't find `c`.
|
/// doesn't find `c`.
|
||||||
///
|
///
|
||||||
@ -496,13 +508,6 @@ bool strequal(const char *a, const char *b)
|
|||||||
return (a == NULL && b == NULL) || (a && b && strcmp(a, b) == 0);
|
return (a == NULL && b == NULL) || (a && b && strcmp(a, b) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Case-insensitive `strequal`.
|
|
||||||
bool striequal(const char *a, const char *b)
|
|
||||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
|
||||||
{
|
|
||||||
return (a == NULL && b == NULL) || (a && b && STRICMP(a, b) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid repeating the error message many times (they take 1 second each).
|
// Avoid repeating the error message many times (they take 1 second each).
|
||||||
// Did_outofmem_msg is reset when a character is read.
|
// Did_outofmem_msg is reset when a character is read.
|
||||||
void do_outofmem_msg(size_t size)
|
void do_outofmem_msg(size_t size)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <stdint.h> // IWYU pragma: keep
|
#include <stdint.h> // IWYU pragma: keep
|
||||||
#include <time.h> // IWYU pragma: keep
|
#include <time.h> // IWYU pragma: keep
|
||||||
|
|
||||||
|
#include "auto/config.h"
|
||||||
#include "nvim/macros_defs.h"
|
#include "nvim/macros_defs.h"
|
||||||
#include "nvim/memory_defs.h" // IWYU pragma: export
|
#include "nvim/memory_defs.h" // IWYU pragma: export
|
||||||
|
|
||||||
@ -57,3 +58,17 @@ EXTERN size_t arena_alloc_count INIT( = 0);
|
|||||||
*ptr_ = NULL; \
|
*ptr_ = NULL; \
|
||||||
(void)(*ptr_); \
|
(void)(*ptr_); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define CLEAR_FIELD(field) memset(&(field), 0, sizeof(field))
|
||||||
|
#define CLEAR_POINTER(ptr) memset((ptr), 0, sizeof(*(ptr)))
|
||||||
|
|
||||||
|
#ifndef HAVE_STRNLEN
|
||||||
|
# define strnlen xstrnlen // Older versions of SunOS may not have strnlen
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define STRCPY(d, s) strcpy((char *)(d), (char *)(s)) // NOLINT(runtime/printf)
|
||||||
|
|
||||||
|
// Like strcpy() but allows overlapped source and destination.
|
||||||
|
#define STRMOVE(d, s) memmove((d), (s), strlen(s) + 1)
|
||||||
|
|
||||||
|
#define STRCAT(d, s) strcat((char *)(d), (char *)(s)) // NOLINT(runtime/printf)
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "nvim/mark.h"
|
#include "nvim/mark.h"
|
||||||
#include "nvim/mbyte.h"
|
#include "nvim/mbyte.h"
|
||||||
#include "nvim/memline.h"
|
#include "nvim/memline.h"
|
||||||
|
#include "nvim/memory.h"
|
||||||
#include "nvim/menu.h"
|
#include "nvim/menu.h"
|
||||||
#include "nvim/message.h"
|
#include "nvim/message.h"
|
||||||
#include "nvim/mouse.h"
|
#include "nvim/mouse.h"
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#ifdef MSWIN
|
#ifdef MSWIN
|
||||||
# include "nvim/mbyte.h"
|
# include "nvim/mbyte.h"
|
||||||
# include "nvim/option.h"
|
# include "nvim/option.h"
|
||||||
|
# include "nvim/strings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
|
@ -10,6 +10,16 @@
|
|||||||
#include "nvim/os/os_defs.h" // IWYU pragma: export
|
#include "nvim/os/os_defs.h" // IWYU pragma: export
|
||||||
#include "nvim/os/stdpaths_defs.h" // IWYU pragma: keep
|
#include "nvim/os/stdpaths_defs.h" // IWYU pragma: keep
|
||||||
|
|
||||||
|
#define HAVE_PATHDEF
|
||||||
|
|
||||||
|
// Some file names are stored in pathdef.c, which is generated from the
|
||||||
|
// Makefile to make their value depend on the Makefile.
|
||||||
|
#ifdef HAVE_PATHDEF
|
||||||
|
extern char *default_vim_dir;
|
||||||
|
extern char *default_vimruntime_dir;
|
||||||
|
extern char *default_lib_dir;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
// IWYU pragma: begin_exports
|
// IWYU pragma: begin_exports
|
||||||
# include "os/env.h.generated.h"
|
# include "os/env.h.generated.h"
|
||||||
|
@ -6,10 +6,12 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "auto/config.h"
|
||||||
|
|
||||||
// Note: Some systems need both string.h and strings.h (Savage).
|
// Note: Some systems need both string.h and strings.h (Savage).
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_STRINGS_H
|
#ifdef HAVE_STRINGS_H
|
||||||
# include <strings.h>
|
# include <strings.h> // IWYU pragma: export
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MSWIN
|
#ifdef MSWIN
|
||||||
@ -105,3 +107,9 @@
|
|||||||
# define S_ISLNK(m) 0
|
# define S_ISLNK(m) 0
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// BSD is supposed to cover FreeBSD and similar systems.
|
||||||
|
#if (defined(BSD) || defined(__FreeBSD_kernel__)) \
|
||||||
|
&& (defined(S_ISCHR) || defined(S_IFCHR))
|
||||||
|
# define OPEN_CHR_FILES
|
||||||
|
#endif
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "nvim/memory.h"
|
||||||
#include "nvim/sha256.h"
|
#include "nvim/sha256.h"
|
||||||
#include "nvim/vim_defs.h"
|
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "sha256.c.generated.h"
|
# include "sha256.c.generated.h"
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "nvim/log.h"
|
#include "nvim/log.h"
|
||||||
#include "nvim/macros_defs.h"
|
#include "nvim/macros_defs.h"
|
||||||
#include "nvim/main.h"
|
#include "nvim/main.h"
|
||||||
|
#include "nvim/memory.h"
|
||||||
#include "nvim/option.h"
|
#include "nvim/option.h"
|
||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
#include "nvim/os/input.h"
|
#include "nvim/os/input.h"
|
||||||
@ -23,7 +24,6 @@
|
|||||||
#include "nvim/strings.h"
|
#include "nvim/strings.h"
|
||||||
#include "nvim/types_defs.h"
|
#include "nvim/types_defs.h"
|
||||||
#include "nvim/ui.h"
|
#include "nvim/ui.h"
|
||||||
#include "nvim/vim_defs.h"
|
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "state.c.generated.h" // IWYU pragma: export
|
# include "state.c.generated.h" // IWYU pragma: export
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
#include "nvim/strings.h"
|
#include "nvim/strings.h"
|
||||||
#include "nvim/ui.h"
|
#include "nvim/ui.h"
|
||||||
#include "nvim/undo.h"
|
#include "nvim/undo.h"
|
||||||
#include "nvim/vim_defs.h"
|
|
||||||
#include "nvim/window.h"
|
#include "nvim/window.h"
|
||||||
|
|
||||||
// Determines how deeply nested %{} blocks will be evaluated in statusline.
|
// Determines how deeply nested %{} blocks will be evaluated in statusline.
|
||||||
|
@ -380,18 +380,6 @@ void del_trailing_spaces(char *ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(HAVE_STRNLEN)
|
|
||||||
size_t xstrnlen(const char *s, size_t n)
|
|
||||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE
|
|
||||||
{
|
|
||||||
const char *end = memchr(s, '\0', n);
|
|
||||||
if (end == NULL) {
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
return (size_t)(end - s);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP))
|
#if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP))
|
||||||
// Compare two strings, ignoring case, using current locale.
|
// Compare two strings, ignoring case, using current locale.
|
||||||
// Doesn't work for multi-byte characters.
|
// Doesn't work for multi-byte characters.
|
||||||
@ -441,6 +429,13 @@ int vim_strnicmp(const char *s1, const char *s2, size_t len)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// Case-insensitive `strequal`.
|
||||||
|
bool striequal(const char *a, const char *b)
|
||||||
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
|
{
|
||||||
|
return (a == NULL && b == NULL) || (a && b && STRICMP(a, b) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
/// strchr() version which handles multibyte strings
|
/// strchr() version which handles multibyte strings
|
||||||
///
|
///
|
||||||
/// @param[in] string String to search in.
|
/// @param[in] string String to search in.
|
||||||
|
@ -3,9 +3,11 @@
|
|||||||
#include <stdarg.h> // IWYU pragma: keep
|
#include <stdarg.h> // IWYU pragma: keep
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "auto/config.h"
|
||||||
#include "klib/kvec.h"
|
#include "klib/kvec.h"
|
||||||
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
|
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
|
||||||
#include "nvim/func_attr.h"
|
#include "nvim/func_attr.h"
|
||||||
|
#include "nvim/os/os_defs.h"
|
||||||
#include "nvim/types_defs.h" // IWYU pragma: keep
|
#include "nvim/types_defs.h" // IWYU pragma: keep
|
||||||
|
|
||||||
/// Append string to string and return pointer to the next byte
|
/// Append string to string and return pointer to the next byte
|
||||||
@ -30,3 +32,23 @@ typedef kvec_t(char) StringBuilder;
|
|||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "strings.h.generated.h"
|
# include "strings.h.generated.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRCASECMP
|
||||||
|
# define STRICMP(d, s) strcasecmp((char *)(d), (char *)(s))
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_STRICMP
|
||||||
|
# define STRICMP(d, s) stricmp((char *)(d), (char *)(s))
|
||||||
|
# else
|
||||||
|
# define STRICMP(d, s) vim_stricmp((char *)(d), (char *)(s))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRNCASECMP
|
||||||
|
# define STRNICMP(d, s, n) strncasecmp((char *)(d), (char *)(s), (size_t)(n))
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_STRNICMP
|
||||||
|
# define STRNICMP(d, s, n) strnicmp((char *)(d), (char *)(s), (size_t)(n))
|
||||||
|
# else
|
||||||
|
# define STRNICMP(d, s, n) vim_strnicmp((char *)(d), (char *)(s), (size_t)(n))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
@ -30,9 +30,9 @@
|
|||||||
#include "nvim/memory.h"
|
#include "nvim/memory.h"
|
||||||
#include "nvim/message.h"
|
#include "nvim/message.h"
|
||||||
#include "nvim/option_vars.h"
|
#include "nvim/option_vars.h"
|
||||||
|
#include "nvim/os/os.h"
|
||||||
#include "nvim/strings.h"
|
#include "nvim/strings.h"
|
||||||
#include "nvim/version.h"
|
#include "nvim/version.h"
|
||||||
#include "nvim/vim_defs.h"
|
|
||||||
|
|
||||||
// for ":version", ":intro", and "nvim --version"
|
// for ":version", ":intro", and "nvim --version"
|
||||||
#ifndef NVIM_VERSION_MEDIUM
|
#ifndef NVIM_VERSION_MEDIUM
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "nvim/pos_defs.h"
|
|
||||||
#include "nvim/types_defs.h"
|
|
||||||
|
|
||||||
// Some defines from the old feature.h
|
// Some defines from the old feature.h
|
||||||
#define SESSION_FILE "Session.vim"
|
#define SESSION_FILE "Session.vim"
|
||||||
#define MAX_MSG_HIST_LEN 200
|
#define MAX_MSG_HIST_LEN 200
|
||||||
@ -10,15 +7,6 @@
|
|||||||
#define RUNTIME_DIRNAME "runtime"
|
#define RUNTIME_DIRNAME "runtime"
|
||||||
|
|
||||||
#include "auto/config.h"
|
#include "auto/config.h"
|
||||||
#define HAVE_PATHDEF
|
|
||||||
|
|
||||||
// Some file names are stored in pathdef.c, which is generated from the
|
|
||||||
// Makefile to make their value depend on the Makefile.
|
|
||||||
#ifdef HAVE_PATHDEF
|
|
||||||
extern char *default_vim_dir;
|
|
||||||
extern char *default_vimruntime_dir;
|
|
||||||
extern char *default_lib_dir;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Check if configure correctly managed to find sizeof(int). If this failed,
|
// Check if configure correctly managed to find sizeof(int). If this failed,
|
||||||
// it becomes zero. This is likely a problem of not being able to run the
|
// it becomes zero. This is likely a problem of not being able to run the
|
||||||
@ -27,17 +15,14 @@ extern char *default_lib_dir;
|
|||||||
# error Configure did not run properly.
|
# error Configure did not run properly.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "nvim/os/os_defs.h" // bring lots of system header files
|
// bring lots of system header files
|
||||||
|
#include "nvim/os/os_defs.h" // IWYU pragma: keep
|
||||||
|
|
||||||
/// length of a buffer to store a number in ASCII (64 bits binary + NUL)
|
/// length of a buffer to store a number in ASCII (64 bits binary + NUL)
|
||||||
enum { NUMBUFLEN = 65, };
|
enum { NUMBUFLEN = 65, };
|
||||||
|
|
||||||
#define MAX_TYPENR 65535
|
#define MAX_TYPENR 65535
|
||||||
|
|
||||||
#include "nvim/gettext.h"
|
|
||||||
#include "nvim/keycodes.h"
|
|
||||||
#include "nvim/macros_defs.h"
|
|
||||||
|
|
||||||
/// Directions.
|
/// Directions.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
kDirectionNotSet = 0,
|
kDirectionNotSet = 0,
|
||||||
@ -54,44 +39,3 @@ typedef enum {
|
|||||||
#endif
|
#endif
|
||||||
#define FAIL 0
|
#define FAIL 0
|
||||||
#define NOTDONE 2 // not OK or FAIL but skipped
|
#define NOTDONE 2 // not OK or FAIL but skipped
|
||||||
|
|
||||||
#define CLEAR_FIELD(field) memset(&(field), 0, sizeof(field))
|
|
||||||
#define CLEAR_POINTER(ptr) memset((ptr), 0, sizeof(*(ptr)))
|
|
||||||
|
|
||||||
// (vim_strchr() is now in strings.c)
|
|
||||||
|
|
||||||
#ifndef HAVE_STRNLEN
|
|
||||||
# define strnlen xstrnlen // Older versions of SunOS may not have strnlen
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define STRCPY(d, s) strcpy((char *)(d), (char *)(s)) // NOLINT(runtime/printf)
|
|
||||||
#ifdef HAVE_STRCASECMP
|
|
||||||
# define STRICMP(d, s) strcasecmp((char *)(d), (char *)(s))
|
|
||||||
#else
|
|
||||||
# ifdef HAVE_STRICMP
|
|
||||||
# define STRICMP(d, s) stricmp((char *)(d), (char *)(s))
|
|
||||||
# else
|
|
||||||
# define STRICMP(d, s) vim_stricmp((char *)(d), (char *)(s))
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Like strcpy() but allows overlapped source and destination.
|
|
||||||
#define STRMOVE(d, s) memmove((d), (s), strlen(s) + 1)
|
|
||||||
|
|
||||||
#ifdef HAVE_STRNCASECMP
|
|
||||||
# define STRNICMP(d, s, n) strncasecmp((char *)(d), (char *)(s), (size_t)(n))
|
|
||||||
#else
|
|
||||||
# ifdef HAVE_STRNICMP
|
|
||||||
# define STRNICMP(d, s, n) strnicmp((char *)(d), (char *)(s), (size_t)(n))
|
|
||||||
# else
|
|
||||||
# define STRNICMP(d, s, n) vim_strnicmp((char *)(d), (char *)(s), (size_t)(n))
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define STRCAT(d, s) strcat((char *)(d), (char *)(s)) // NOLINT(runtime/printf)
|
|
||||||
|
|
||||||
// BSD is supposed to cover FreeBSD and similar systems.
|
|
||||||
#if (defined(BSD) || defined(__FreeBSD_kernel__)) \
|
|
||||||
&& (defined(S_ISCHR) || defined(S_IFCHR))
|
|
||||||
# define OPEN_CHR_FILES
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user