value: just compute strlen() once

This commit is contained in:
Stefan Kost 2010-06-07 12:07:30 +03:00
parent 15141b3954
commit c95a85f6cf

View file

@ -723,17 +723,18 @@ gst_value_deserialize_fourcc (GValue * dest, const char *s)
gboolean ret = FALSE; gboolean ret = FALSE;
guint32 fourcc = 0; guint32 fourcc = 0;
char *end; char *end;
gint l = strlen (s);
if (strlen (s) == 4) { if (l == 4) {
fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]); fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
ret = TRUE; ret = TRUE;
} else if (strlen (s) == 3) { } else if (l == 3) {
fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], ' '); fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], ' ');
ret = TRUE; ret = TRUE;
} else if (strlen (s) == 2) { } else if (l == 2) {
fourcc = GST_MAKE_FOURCC (s[0], s[1], ' ', ' '); fourcc = GST_MAKE_FOURCC (s[0], s[1], ' ', ' ');
ret = TRUE; ret = TRUE;
} else if (strlen (s) == 1) { } else if (l == 1) {
fourcc = GST_MAKE_FOURCC (s[0], ' ', ' ', ' '); fourcc = GST_MAKE_FOURCC (s[0], ' ', ' ', ' ');
ret = TRUE; ret = TRUE;
} else if (g_ascii_isdigit (*s)) { } else if (g_ascii_isdigit (*s)) {