[vlc-devel] [PATCH 2/3] keystore/kwallet: values2key: simplify if-condition
Filip Roséen
filip at atch.se
Thu May 18 12:01:56 CEST 2017
There is no need to check for the inverse of a condition that was just
being checked.
---
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, "*" );
--
2.12.2
More information about the vlc-devel
mailing list