[vlc-commits] keystore/kwallet: values2key: simplify if-condition

Filip Roséen git at videolan.org
Thu May 18 17:51:57 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 12:01:56 2017 +0200| [34a840a62f68a23be6b16fae7687a1a66a94ddd5] | committer: Rémi Denis-Courmont

keystore/kwallet: values2key: simplify if-condition

There is no need to check for the inverse of a condition that was just
being checked.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/keystore/kwallet.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/keystore/kwallet.c b/modules/keystore/kwallet.c
index e9a96bb994..068970db3b 100644
--- a/modules/keystore/kwallet.c
+++ b/modules/keystore/kwallet.c
@@ -149,10 +149,13 @@ values2key( const char* const* ppsz_values, bool b_search )
         vlc_memstream_printf( &ms, "*" );
 
     /* Path section */
-    if ( ppsz_values[KEY_PATH] && ppsz_values[KEY_PATH][0] == '/')
-        vlc_memstream_printf( &ms, "%s", ppsz_values[KEY_PATH] );
-    else if ( ppsz_values[KEY_PATH] && ppsz_values[KEY_PATH][0] != '/' )
-        vlc_memstream_printf( &ms, "/%s", ppsz_values[KEY_PATH] );
+    if( ppsz_values[KEY_PATH] )
+    {
+        if( ppsz_values[KEY_PATH][0] != '/' )
+            vlc_memstream_putc( &ms, '/' );
+
+        vlc_memstream_puts( &ms, ppsz_values[KEY_PATH] );
+    }
     else if ( b_search )
         vlc_memstream_printf( &ms, "*" );
 



More information about the vlc-commits mailing list