gst: Simplify some boolean expressions
authorSebastian Dröge <sebastian@centricular.com>
Tue, 24 Jul 2018 06:58:31 +0000 (09:58 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 24 Jul 2018 06:58:31 +0000 (09:58 +0300)
(!x || (x && y)) is the same as (!x || y)

https://bugzilla.gnome.org/show_bug.cgi?id=796847

gst/gstpadtemplate.c
gst/gstparse.c
gst/parse/types.h

index 02a9132..e17da0b 100644 (file)
@@ -279,7 +279,7 @@ name_is_valid (const gchar * name, GstPadPresence presence)
       underscore = strchr (str, '_');
       str = strchr (str + 1, '%');
 
-      if (str && (!underscore || (underscore && str < underscore))) {
+      if (str && (!underscore || str < underscore)) {
         g_warning
             ("invalid name template %s: each of conversion specifications "
             "must be separated by an underscore", name);
index e50d7e7..9f97637 100644 (file)
@@ -193,7 +193,7 @@ _gst_parse_escape (const gchar * str)
   in_quotes = FALSE;
 
   while (*str) {
-    if (*str == '"' && (!in_quotes || (in_quotes && *(str - 1) != '\\')))
+    if (*str == '"' && (!in_quotes || *(str - 1) != '\\'))
       in_quotes = !in_quotes;
 
     if (*str == ' ' && !in_quotes)
index 66d13dd..5dbb959 100644 (file)
@@ -89,8 +89,7 @@ gst_parse_unescape (gchar *str)
       /* make sure we don't read beyond the end of the string */
       if (*walk == '\0')
         break;
-    } else if (*walk == '"' && (!in_quotes || (in_quotes
-                && (*(walk - 1) != '\\')))) {
+    } else if (*walk == '"' && (!in_quotes || *(walk - 1) != '\\')) {
       /* don't unescape inside quotes and don't switch
        * state with escaped quoted inside quotes */
       in_quotes = !in_quotes;