aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/strings.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2021-12-09 21:09:22 -0500
committerGitHub <noreply@github.com>2021-12-09 21:09:22 -0500
commit0cf546508d3bb3f51fc1d440ce5bd798edd70e82 (patch)
tree52383f48e92a9e8e673347b0e29a3dd1a627d745 /src/nvim/strings.c
parent27648ee21803aabfced13b55b36671c4cf726703 (diff)
parent05f9f63f2478841f9fa6261c68663797fa9d43f6 (diff)
downloadrneovim-0cf546508d3bb3f51fc1d440ce5bd798edd70e82.tar.gz
rneovim-0cf546508d3bb3f51fc1d440ce5bd798edd70e82.tar.bz2
rneovim-0cf546508d3bb3f51fc1d440ce5bd798edd70e82.zip
Merge pull request #16547 from pekdon/sunos
Portability improvements, first steps at getting neovim on x86_64 SunOS
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r--src/nvim/strings.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index c58e052ae9..27f93fe4ce 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -394,6 +394,18 @@ void del_trailing_spaces(char_u *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 end - s;
+}
+#endif
+
#if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP))
/*
* Compare two strings, ignoring case, using current locale.