Commit 8d583016 authored by Rafaël Carré's avatar Rafaël Carré

Use strrchr()

parent d1aff398
...@@ -248,23 +248,15 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, ...@@ -248,23 +248,15 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
system_Init( p_libvlc, &i_argc, ppsz_argv ); system_Init( p_libvlc, &i_argc, ppsz_argv );
/* Get the executable name (similar to the basename command) */ /* Get the executable name (similar to the basename command) */
if( i_argc > 0 ) if( i_argc > 0 && ppsz_argv[0][0] )
{
const char *psz_exe = ppsz_argv[0] + strlen( ppsz_argv[0] );
for( ; psz_exe > ppsz_argv[0] ; psz_exe-- )
{
if( *psz_exe == '/' )
{
psz_exe++;
break;
}
}
if( *psz_exe )
{ {
free( p_libvlc->psz_object_name ); free( p_libvlc->psz_object_name );
p_libvlc->psz_object_name = strdup( psz_exe );
} const char *psz_exe = strrchr( ppsz_argv[0], '/' );
if( psz_exe && *(psz_exe + 1) )
p_libvlc->psz_object_name = strdup( psz_exe + 1 );
else
p_libvlc->psz_object_name = strdup( ppsz_argv[0] );
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment