diff options
Diffstat (limited to 'src/nvim/ascii_defs.h')
-rw-r--r-- | src/nvim/ascii_defs.h | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/src/nvim/ascii_defs.h b/src/nvim/ascii_defs.h index 0cd7ccfec4..155a18fb95 100644 --- a/src/nvim/ascii_defs.h +++ b/src/nvim/ascii_defs.h @@ -2,9 +2,12 @@ #include <stdbool.h> -#include "nvim/func_attr.h" #include "nvim/os/os_defs.h" +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "ascii_defs.h.inline.generated.h" +#endif + // Definitions of various common control characters. #define CHAR_ORD(x) ((uint8_t)(x) < 'a' \ @@ -82,31 +85,24 @@ # define PATHSEPSTR "/" #endif -static inline bool ascii_iswhite(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a space or tab character. /// /// @see {ascii_isdigit} static inline bool ascii_iswhite(int c) + FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE { return c == ' ' || c == '\t'; } -static inline bool ascii_iswhite_or_nul(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a space or tab character or NUL. /// /// @see {ascii_isdigit} static inline bool ascii_iswhite_or_nul(int c) + FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE { return ascii_iswhite(c) || c == NUL; } -static inline bool ascii_isdigit(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; /// Check whether character is a decimal digit. /// /// Library isdigit() function is officially locale-dependent and, for @@ -117,64 +113,55 @@ static inline bool ascii_isdigit(int c) /// what may be used for some optimizations (e.g. simple `return /// isdigit_table[c];`). static inline bool ascii_isdigit(int c) + FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE { return c >= '0' && c <= '9'; } -static inline bool ascii_isxdigit(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a hexadecimal digit, that is, one of 0-9, a-f, A-F. /// /// @see {ascii_isdigit} static inline bool ascii_isxdigit(int c) + FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } -static inline bool ascii_isident(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is an “identifier” character /// /// That is, whether it is alphanumeric character or underscore. static inline bool ascii_isident(int c) + FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE { return ASCII_ISALNUM(c) || c == '_'; } -static inline bool ascii_isbdigit(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a binary digit, that is, 0-1. /// /// @see {ascii_isdigit} static inline bool ascii_isbdigit(int c) + FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE { return (c == '0' || c == '1'); } -static inline bool ascii_isodigit(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is an octal digit, that is, 0-7. /// /// @see {ascii_isdigit} static inline bool ascii_isodigit(int c) + FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE { return (c >= '0' && c <= '7'); } -static inline bool ascii_isspace(int c) - REAL_FATTR_CONST - REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a white-space character, that is, /// one of \f, \n, \r, \t, \v. /// /// @see {ascii_isdigit} static inline bool ascii_isspace(int c) + FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE { return (c >= 9 && c <= 13) || c == ' '; } |