aboutsummaryrefslogtreecommitdiff
path: root/common/str.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/str.cpp')
-rw-r--r--common/str.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 90bd539790..3a0fd6a08e 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -942,6 +942,13 @@ size_t strlcat(char *dst, const char *src, size_t size) {
return dstLength + (src - srcStart);
}
+size_t strnlen(const char *src, size_t maxSize) {
+ size_t counter = 0;
+ while (counter != maxSize && *src++)
+ ++counter;
+ return counter;
+}
+
} // End of namespace Common
// Portable implementation of stricmp / strcasecmp / strcmpi.