eina: Actually implement strnlen for eina_unicode.
authornash <nash@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 31 Jul 2010 03:54:09 +0000 (03:54 +0000)
committernash <nash@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 31 Jul 2010 03:54:09 +0000 (03:54 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@50700 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/eina_unicode.c

index fc72ed6..4f0431b 100644 (file)
@@ -95,7 +95,8 @@ EAPI size_t
 eina_unicode_strnlen(const Eina_Unicode *ustr, int n)
 {
    const Eina_Unicode *end;
-   for (end = ustr; *end; end++)
+   const Eina_Unicode *last = ustr + n; /* technically not portable ;-) */
+   for (end = ustr; *end && last < end; end++)
       ;
    return end - ustr;
 }