Commit 6e9aebe3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Simplify

parent 6a3e9f6a
...@@ -965,6 +965,7 @@ char *E_(RealPath)( intf_thread_t *p_intf, const char *psz_src ) ...@@ -965,6 +965,7 @@ char *E_(RealPath)( intf_thread_t *p_intf, const char *psz_src )
} }
#endif #endif
/* FIXME: this could be O(N) rather than O(N²)... */
/* Remove multiple separators and /./ */ /* Remove multiple separators and /./ */
p = psz_dir; p = psz_dir;
while( (p = strchr( p, sep )) != NULL ) while( (p = strchr( p, sep )) != NULL )
...@@ -979,10 +980,8 @@ char *E_(RealPath)( intf_thread_t *p_intf, const char *psz_src ) ...@@ -979,10 +980,8 @@ char *E_(RealPath)( intf_thread_t *p_intf, const char *psz_src )
if( psz_dir[0] == '~' ) if( psz_dir[0] == '~' )
{ {
char *dir = malloc( strlen(psz_dir)
+ strlen(p_intf->p_libvlc->psz_userdir) );
/* This is incomplete : we should also support the ~cmassiot/ syntax. */ /* This is incomplete : we should also support the ~cmassiot/ syntax. */
sprintf( dir, "%s%s", p_intf->p_libvlc->psz_userdir, psz_dir + 1 ); asprintf( &dir, "%s%s", p_intf->p_libvlc->psz_userdir, psz_dir + 1 );
free( psz_dir ); free( psz_dir );
psz_dir = dir; psz_dir = dir;
} }
......
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