projects
/
platform
/
upstream
/
gstreamer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
50b9a3e
)
registry: speed up _strlen
author
Wim Taymans
<wim.taymans@collabora.co.uk>
Wed, 21 Oct 2009 03:27:41 +0000
(23:27 -0400)
committer
Wim Taymans
<wim@metal.(none)>
Wed, 21 Oct 2009 03:27:41 +0000
(23:27 -0400)
Make the _strlen function a little tighter
gst/gstregistrychunks.c
patch
|
blob
|
history
diff --git
a/gst/gstregistrychunks.c
b/gst/gstregistrychunks.c
index
9e20ef4
..
d81542b
100644
(file)
--- a/
gst/gstregistrychunks.c
+++ b/
gst/gstregistrychunks.c
@@
-48,15
+48,12
@@
_strnlen (const gchar * str, gint maxlen)
{
gint len = 0;
- if (G_UNLIKELY (len == maxlen))
- return -1;
-
- while (*str++ != '\0') {
+ while (G_LIKELY (len < maxlen)) {
+ if (G_UNLIKELY (str[len] == '\0'))
+ return len;
len++;
- if (G_UNLIKELY (len == maxlen))
- return -1;
}
- return
len
;
+ return
-1
;
}
/* Macros */