[vlc-commits] cli: simplify

Rémi Denis-Courmont git at videolan.org
Sat Oct 17 20:36:12 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 17 21:01:35 2020 +0300| [a6f31f4de8627fbc40ab9de39697ede011f510c3] | committer: Rémi Denis-Courmont

cli: simplify

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a6f31f4de8627fbc40ab9de39697ede011f510c3
---

 modules/control/cli/player.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/modules/control/cli/player.c b/modules/control/cli/player.c
index 07ab6f29a8..2696157e0c 100644
--- a/modules/control/cli/player.c
+++ b/modules/control/cli/player.c
@@ -384,20 +384,19 @@ static void PlayerRecord(intf_thread_t *intf, const char *const *args,
 
     vlc_player_Lock(player);
 
-    bool b_update = true;
-    bool b_value = vlc_player_IsRecording(player);
+    bool cur_value = vlc_player_IsRecording(player);
+    bool new_value = !cur_value;
 
     if (count > 1)
     {
-        if ((strncmp(args[1], "on", 2) == 0 &&  b_value)
-         || (strncmp( args[1], "off", 3) == 0 && !b_value))
-            b_update = false;
-    }
-    if (b_update)
-    {
-        b_value = !b_value;
-        vlc_player_SetRecordingEnabled(player, b_value);
+        if (strcmp(args[1], "on") == 0)
+            new_value = true;
+        if (strcmp(args[1], "off") == 0)
+            new_value = false;
     }
+
+    if (cur_value != new_value)
+        vlc_player_SetRecordingEnabled(player, new_value);
     vlc_player_Unlock(player);
 }
 



More information about the vlc-commits mailing list