forked from enlightenment/efl
Unicde strnlen, and a slight fix to the header so at least part can be read by
humans. Also strlen/strnlen are pure. SVN revision: 50676
This commit is contained in:
parent
ec7e390bdf
commit
4414556323
|
@ -42,9 +42,9 @@ typedef unsigned int Eina_Unicode;
|
||||||
|
|
||||||
EAPI extern const Eina_Unicode *EINA_UNICODE_EMPTY_STRING;
|
EAPI extern const Eina_Unicode *EINA_UNICODE_EMPTY_STRING;
|
||||||
|
|
||||||
EAPI size_t
|
EAPI size_t eina_unicode_strlen(const Eina_Unicode *ustr) EINA_ARG_NONNULL(1) EINA_PURE;
|
||||||
eina_unicode_strlen(
|
EAPI size_t eina_unicode_strnlen(const Eina_Unicode *ustr, int n) EINA_ARG_NONNULL(1) EINA_PURE;
|
||||||
const Eina_Unicode *ustr) EINA_ARG_NONNULL(1);
|
|
||||||
|
|
||||||
EAPI Eina_Unicode *
|
EAPI Eina_Unicode *
|
||||||
eina_unicode_strdup(
|
eina_unicode_strdup(
|
||||||
|
|
|
@ -80,6 +80,29 @@ eina_unicode_strlen(const Eina_Unicode *ustr)
|
||||||
return end - ustr;
|
return end - ustr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Same as the standard strdup just with Eina_Unicode instead of char.
|
* @brief Same as the standard strdup just with Eina_Unicode instead of char.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue