changeset 37074:1bcac20d3393

Rewrite add_vf(). Avoid confusing usage of i = -1 to indicate that a video filter has been found. Check vf_settings[i].name instead. As a result, the index of the video filter found won't be destroyed.
author ib
date Thu, 24 Apr 2014 13:08:38 +0000
parents 3ec195585bfd
children 3021ac203d3c
files gui/interface.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Thu Apr 24 12:58:40 2014 +0000
+++ b/gui/interface.c	Thu Apr 24 13:08:38 2014 +0000
@@ -281,13 +281,13 @@
         int i = 0;
 
         while (vf_settings[i].name) {
-            if (strcmp(vf_settings[i++].name, vf) == 0) {
-                i = -1;
+            if (strcmp(vf_settings[i].name, vf) == 0)
                 break;
-            }
+
+            i++;
         }
 
-        if (i != -1) {
+        if (!vf_settings[i].name) {
             void *settings = realloc(vf_settings, (i + 2) * sizeof(m_obj_settings_t));
 
             if (!settings)