aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/vim.h
diff options
context:
space:
mode:
authorClaes Nästén <pekdon@gmail.com>2021-12-06 07:49:15 +0100
committerClaes Nästén <pekdon@gmail.com>2021-12-06 17:34:26 +0100
commit8f1fdbc54a873abc7375c785b2b6ee5440910de2 (patch)
tree3d2d70542b1b87a48d56252c25d6c0b15db83b41 /src/nvim/vim.h
parent8fdf1b265d982b80bfa8e6d98374514ece20a03e (diff)
downloadrneovim-8f1fdbc54a873abc7375c785b2b6ee5440910de2.tar.gz
rneovim-8f1fdbc54a873abc7375c785b2b6ee5440910de2.tar.bz2
rneovim-8f1fdbc54a873abc7375c785b2b6ee5440910de2.zip
fix: add STRNLEN compatability macro
Older SunOS systems come without strnlen, add STRNLEN macro in line with the other str* compat macros.
Diffstat (limited to 'src/nvim/vim.h')
-rw-r--r--src/nvim/vim.h5
1 files changed, 5 insertions, 0 deletions
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))