keystore/kwallet: values2key: simplify if-condition
authorFilip Roséen <filip@atch.se>
Thu, 18 May 2017 10:01:56 +0000 (12:01 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 18 May 2017 15:49:30 +0000 (18:49 +0300)
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@remlab.net>
modules/keystore/kwallet.c

index e9a96bb..068970d 100644 (file)
@@ -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, "*" );