Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-03-16 22:52:09 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-03-16 22:52:09 +0400
commit9e2db2dad4ee38036a28452039656594f73b4421 (patch)
tree08c1ee02ad80ea240c8a2c6ced419babaeee2567 /source/blender/blenlib/intern/string.c
parent0fedc6e45bdcb2b159b9ab54267d70c0bb59dd72 (diff)
revert own change: don't use memchr for strnlen, causes problems when the len is longer then the string data, instead use strnlen from freebsd.
also simplify empty string checks in logic_ops.c
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r--source/blender/blenlib/intern/string.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 815295b8eac..906a3095f91 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -509,10 +509,15 @@ void BLI_timestr(double _time, char *str)
}
/* determine the length of a fixed-size string */
-size_t BLI_strnlen(const char *str, const size_t maxlen)
+size_t BLI_strnlen(const char *s, size_t maxlen)
{
- const char *end = memchr(str, '\0', maxlen);
- return end ? (size_t) (end - str) : maxlen;
+ size_t len;
+
+ for (len = 0; len < maxlen; len++, s++) {
+ if (!*s)
+ break;
+ }
+ return len;
}
void BLI_ascii_strtolower(char *str, const size_t len)