else if ( prefix == NULL )
{
prefix = DATADIR;
- filename = calloc( 1, strlen( prefix ) + strlen( PROFILES_DIR ) + strlen( name ) + 2 );
+ filename = calloc( 1, strlen( prefix ) + strlen( PROFILES_DIR ) + strlen( name ) + 1 );
strcpy( filename, prefix );
- if ( filename[ strlen( filename ) - 1 ] != '/' )
- filename[ strlen( filename ) ] = '/';
strcat( filename, PROFILES_DIR );
}
// Use environment variable instead
if ( prefix == NULL )
{
prefix = mlt_environment( "MLT_DATA" );
- filename = calloc( 1, strlen( prefix ) + strlen( PROFILES_DIR ) + 2 );
+ filename = calloc( 1, strlen( prefix ) + strlen( PROFILES_DIR ) + 1 );
strcpy( filename, prefix );
- if ( filename[ strlen( filename ) - 1 ] != '/' )
- filename[ strlen( filename ) ] = '/';
strcat( filename, PROFILES_DIR );
prefix = filename;
}
#include <errno.h>
#include <locale.h>
+#define PRESETS_DIR "/presets"
+
/** \brief private implementation of the property list */
typedef struct
}
else
{
- data = malloc( strlen( mlt_environment( "MLT_DATA" ) ) + 9 );
+ data = malloc( strlen( mlt_environment( "MLT_DATA" ) ) + strlen( PRESETS_DIR ) + 1 );
strcpy( data, mlt_environment( "MLT_DATA" ) );
- strcat( data, "/presets" );
+ strcat( data, PRESETS_DIR );
}
if ( data && type && service )
{
}
else
{
- path = malloc( strlen( mlt_environment( "MLT_DATA" ) ) + 9 );
+ path = malloc( strlen( mlt_environment( "MLT_DATA" ) ) + strlen( PRESETS_DIR ) + 1 );
strcpy( path, mlt_environment( "MLT_DATA" ) );
- if ( path[ strlen( path ) - 1 ] != '/' )
- path[ strlen( path ) ] = '/';
strcat( path, PRESETS_DIR );
}
list_presets( result, NULL, path );