changeset 35384:9c7bba653bfb

Avoid a duplicate strrchr() call.
author ib
date Sun, 25 Nov 2012 15:04:44 +0000
parents fa7a7312c47a
children 8b8534de8b83
files gui/ui/main.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gui/ui/main.c	Sun Nov 25 14:46:47 2012 +0000
+++ b/gui/ui/main.c	Sun Nov 25 15:04:44 2012 +0000
@@ -609,6 +609,7 @@
 
   char* subtitles = NULL;
   char* filename = NULL;
+  char* s;
 
   if (num <= 0)
     return;
@@ -650,10 +651,12 @@
 
       item = calloc(1,sizeof(plItem));
 
+      s = strrchr( str,'/' );
+
       /* FIXME: decompose file name ? */
       /* yes -- Pontscho */
-      if ( strrchr( str,'/' ) ) {
-	char * s = strrchr( str,'/' ); *s=0; s++;
+      if ( s ) {
+	*s=0; s++;
 	item->name = gstrdup( s );
 	item->path = gstrdup( str );
       } else {