[vlc-devel] [PATCH 6/9] demux/playlist: xspf: remove redundant variable

Filip Roséen filip at atch.se
Thu May 18 12:08:24 CEST 2017


b_release_input_item was used to denote whether or not the object
referred to by p_new_input should be released or not, but the object
is unconditionally released if "p_new_input" is not NULL; as such
b_release_input_item has been removed.
---
 modules/demux/playlist/xspf.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index 8f8826955b..0a723ad5f3 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -578,7 +578,6 @@ static bool parse_extension_node COMPLEX_INTERFACE
     char *psz_title = NULL;
     char *psz_application = NULL;
     int i_node;
-    bool b_release_input_item = false;
     const xml_elem_hnd_t *p_handler = NULL;
     input_item_t *p_new_input = NULL;
 
@@ -629,7 +628,6 @@ static bool parse_extension_node COMPLEX_INTERFACE
             p_input_node =
                 input_item_node_AppendItem(p_input_node, p_new_input);
             p_input_item = p_new_input;
-            b_release_input_item = true;
         }
     }
     else if (!strcmp(psz_element, "extension"))
@@ -666,7 +664,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 if (!*name)
                 {
                     msg_Err(p_demux, "invalid xml stream");
-                    if (b_release_input_item) input_item_Release(p_new_input);
+                    if (p_new_input) input_item_Release(p_new_input);
                     return false;
                 }
                 /* choose handler */
@@ -674,7 +672,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 if (!p_handler)
                 {
                     msg_Err(p_demux, "unexpected element <%s>", name);
-                    if (b_release_input_item) input_item_Release(p_new_input);
+                    if (p_new_input) input_item_Release(p_new_input);
                     return false;
                 }
                 /* complex content is parsed in a separate function */
@@ -689,7 +687,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                     }
                     else
                     {
-                        if (b_release_input_item)
+                        if (p_new_input)
                             input_item_Release(p_new_input);
                         return false;
                     }
@@ -702,7 +700,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 psz_value = strdup(name);
                 if (unlikely(!psz_value))
                 {
-                    if (b_release_input_item) input_item_Release(p_new_input);
+                    if (p_new_input) input_item_Release(p_new_input);
                     return false;
                 }
                 break;
@@ -713,7 +711,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 if (!strcmp(name, psz_element))
                 {
                     FREENULL(psz_value);
-                    if (b_release_input_item) input_item_Release(p_new_input);
+                    if (p_new_input) input_item_Release(p_new_input);
                     return true;
                 }
                 /* there MUST have been a start tag for that element name */
@@ -723,7 +721,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                     msg_Err(p_demux, "there's no open element left for <%s>",
                              name);
                     FREENULL(psz_value);
-                    if (b_release_input_item) input_item_Release(p_new_input);
+                    if (p_new_input) input_item_Release(p_new_input);
                     return false;
                 }
 
@@ -742,7 +740,8 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 break;
         }
     }
-    if (b_release_input_item) input_item_Release(p_new_input);
+
+    if (p_new_input) input_item_Release(p_new_input);
     free(psz_value);
     return false;
 }
-- 
2.12.2


More information about the vlc-devel mailing list