gst: Simplify some boolean expressions

(!x || (x && y)) is the same as (!x || y)

https://bugzilla.gnome.org/show_bug.cgi?id=796847
This commit is contained in:
Sebastian Dröge 2018-07-24 09:58:31 +03:00
parent 2aa9ad9c62
commit b079334c1c
3 changed files with 3 additions and 4 deletions

View file

@ -279,7 +279,7 @@ name_is_valid (const gchar * name, GstPadPresence presence)
underscore = strchr (str, '_'); underscore = strchr (str, '_');
str = strchr (str + 1, '%'); str = strchr (str + 1, '%');
if (str && (!underscore || (underscore && str < underscore))) { if (str && (!underscore || str < underscore)) {
g_warning g_warning
("invalid name template %s: each of conversion specifications " ("invalid name template %s: each of conversion specifications "
"must be separated by an underscore", name); "must be separated by an underscore", name);

View file

@ -193,7 +193,7 @@ _gst_parse_escape (const gchar * str)
in_quotes = FALSE; in_quotes = FALSE;
while (*str) { while (*str) {
if (*str == '"' && (!in_quotes || (in_quotes && *(str - 1) != '\\'))) if (*str == '"' && (!in_quotes || *(str - 1) != '\\'))
in_quotes = !in_quotes; in_quotes = !in_quotes;
if (*str == ' ' && !in_quotes) if (*str == ' ' && !in_quotes)

View file

@ -89,8 +89,7 @@ gst_parse_unescape (gchar *str)
/* make sure we don't read beyond the end of the string */ /* make sure we don't read beyond the end of the string */
if (*walk == '\0') if (*walk == '\0')
break; break;
} else if (*walk == '"' && (!in_quotes || (in_quotes } else if (*walk == '"' && (!in_quotes || *(walk - 1) != '\\')) {
&& (*(walk - 1) != '\\')))) {
/* don't unescape inside quotes and don't switch /* don't unescape inside quotes and don't switch
* state with escaped quoted inside quotes */ * state with escaped quoted inside quotes */
in_quotes = !in_quotes; in_quotes = !in_quotes;