Enlightenment SVN schrieb: > Log: > Unicde strnlen, and a slight fix to the header so at least part can be read > by > humans. > > Also strlen/strnlen are pure. > > Author: nash > Date: 2010-07-29 20:39:12 -0700 (Thu, 29 Jul 2010) > New Revision: 50676 > > Modified: > trunk/eina/src/include/eina_unicode.h trunk/eina/src/lib/eina_unicode.c > > Modified: trunk/eina/src/include/eina_unicode.h > =================================================================== > --- trunk/eina/src/include/eina_unicode.h 2010-07-30 03:20:40 UTC (rev > 50675) > +++ trunk/eina/src/include/eina_unicode.h 2010-07-30 03:39:12 UTC (rev > 50676) > @@ -42,10 +42,10 @@ > > EAPI extern const Eina_Unicode *EINA_UNICODE_EMPTY_STRING; > > -EAPI size_t > - eina_unicode_strlen( > - const Eina_Unicode *ustr) EINA_ARG_NONNULL(1); > +EAPI size_t eina_unicode_strlen(const Eina_Unicode *ustr) > EINA_ARG_NONNULL(1) EINA_PURE; > +EAPI size_t eina_unicode_strnlen(const Eina_Unicode *ustr, int n) > EINA_ARG_NONNULL(1) EINA_PURE; > > + > EAPI Eina_Unicode * > eina_unicode_strdup( > const Eina_Unicode *text) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) > > Modified: trunk/eina/src/lib/eina_unicode.c > =================================================================== > --- trunk/eina/src/lib/eina_unicode.c 2010-07-30 03:20:40 UTC (rev 50675) > +++ trunk/eina/src/lib/eina_unicode.c 2010-07-30 03:39:12 UTC (rev 50676) > @@ -81,6 +81,29 @@ > } > > /** > + * @brief Returns the length of a Eina_Unicode string, up to a limit. > + * > + * This function returns the number of characters in string, up to a maximum > + * of n. If the terminating character is not found in the string, it returns > + * n. > + * > + * @param ustr String to search > + * @param n Max length to search > + * @return Number of characters or n. > + */ > +EAPI size_t > +eina_unicode_strnlen(const Eina_Unicode *ustr, int n) > +{ > + const Eina_Unicode *end; > + for (end = ustr; *end; end++) > + ; > + return end - ustr; > +} >
The function doesn't seem to respect "n" in any way Regards Peter ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel