From 8f1fdbc54a873abc7375c785b2b6ee5440910de2 Mon Sep 17 00:00:00 2001 From: Claes Nästén Date: Mon, 6 Dec 2021 07:49:15 +0100 Subject: fix: add STRNLEN compatability macro Older SunOS systems come without strnlen, add STRNLEN macro in line with the other str* compat macros. --- src/nvim/vim.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nvim/vim.h') diff --git a/src/nvim/vim.h b/src/nvim/vim.h index e3539c1a57..2f8ddd1e88 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -215,6 +215,11 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() // (vim_strchr() is now in strings.c) #define STRLEN(s) strlen((char *)(s)) +#ifdef HAVE_STRNLEN +# define STRNLEN(s, n) strnlen((char *)(s), (size_t)(n)) +#else +# define STRNLEN(s, n) xstrnlen((char *)(s), (size_t)(n)) +#endif #define STRCPY(d, s) strcpy((char *)(d), (char *)(s)) #define STRNCPY(d, s, n) strncpy((char *)(d), (char *)(s), (size_t)(n)) #define STRLCPY(d, s, n) xstrlcpy((char *)(d), (char *)(s), (size_t)(n)) -- cgit