mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-07 20:31:20 +00:00
registry: speed up _strlen
Make the _strlen function a little tighter
This commit is contained in:
parent
50b9a3ecc3
commit
5de94ede2f
1 changed files with 4 additions and 7 deletions
|
@ -48,15 +48,12 @@ _strnlen (const gchar * str, gint maxlen)
|
||||||
{
|
{
|
||||||
gint len = 0;
|
gint len = 0;
|
||||||
|
|
||||||
if (G_UNLIKELY (len == maxlen))
|
while (G_LIKELY (len < maxlen)) {
|
||||||
return -1;
|
if (G_UNLIKELY (str[len] == '\0'))
|
||||||
|
return len;
|
||||||
while (*str++ != '\0') {
|
|
||||||
len++;
|
len++;
|
||||||
if (G_UNLIKELY (len == maxlen))
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
return len;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Macros */
|
/* Macros */
|
||||||
|
|
Loading…
Reference in a new issue