Commit 3a6da657 authored by Rémi Duraffort's avatar Rémi Duraffort

Simplification (and use only the needed memory).

parent 17c77005
...@@ -172,19 +172,22 @@ vlc_module_end () ...@@ -172,19 +172,22 @@ vlc_module_end ()
*/ */
char *FindPrefix( demux_t *p_demux ) char *FindPrefix( demux_t *p_demux )
{ {
char *psz_name; char *psz_file;
char *psz_path = strdup( p_demux->psz_path ); char *psz_prefix;
const char *psz_path = p_demux->psz_path;
#ifndef WIN32 #ifndef WIN32
psz_name = strrchr( psz_path, '/' ); psz_file = strrchr( psz_path, '/' );
#else #else
psz_name = strrchr( psz_path, '\\' ); psz_file = strrchr( psz_path, '\\' );
if( !psz_name ) psz_name = strrchr( psz_path, '/' ); if( !psz_file ) psz_name = strrchr( psz_path, '/' );
#endif #endif
if( psz_name ) psz_name[1] = '\0'; if( psz_file )
else *psz_path = '\0'; psz_prefix = strndup( psz_path, psz_file - psz_path + 1 );
else
psz_prefix = strdup( "" );
return psz_path; return psz_prefix;
} }
/** /**
......
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