Remove the wrong assumptions that if __GLIBC__ isn't defined, then strtod_l() would not exist. It exists with musl libc as well. Also don't assume locale_t == char* if __GLIBC__ isn't defined. --- src/framework/mlt_properties.c 2018-01-23 07:41:00.000000000 +0100 +++ src/framework/mlt_properties.c 2018-01-25 17:49:25.604808390 +0100 @@ -141,15 +141,9 @@ int mlt_properties_set_lcnumeric( mlt_pr { property_list *list = self->local; -#if defined(__GLIBC__) || defined(__APPLE__) if ( list->locale ) freelocale( list->locale ); list->locale = newlocale( LC_NUMERIC_MASK, locale, NULL ); -#else - - free( list->locale ); - list->locale = strdup( locale ); -#endif } else error = 1; @@ -181,7 +175,7 @@ const char* mlt_properties_get_lcnumeric #elif defined(__GLIBC__) result = list->locale->__names[ LC_NUMERIC ]; #else - result = list->locale; + result = "C"; #endif #if defined(_WIN32) if ( result ) @@ -713,12 +707,10 @@ int mlt_properties_set( mlt_properties s // Determine the value if ( isdigit( id[ 0 ] ) ) { -#if defined(__GLIBC__) || defined(__APPLE__) property_list *list = self->local; if ( list->locale ) current = strtod_l( id, NULL, list->locale ); else -#endif current = strtod( id, NULL ); } else @@ -1404,14 +1396,9 @@ void mlt_properties_close( mlt_propertie free( list->name[ index ] ); } -#if defined(__GLIBC__) || defined(__APPLE__) // Cleanup locale if ( list->locale ) freelocale( list->locale ); -#else - - free( list->locale ); -#endif // Clear up the list pthread_mutex_destroy( &list->mutex ); --- src/framework/mlt_property.c 2018-01-23 07:41:00.000000000 +0100 +++ src/framework/mlt_property.c 2018-01-25 17:45:17.343812836 +0100 @@ -278,27 +278,10 @@ static int time_clock_to_frames( mlt_pro s = copy; pos = strrchr( s, ':' ); -#if !defined(__GLIBC__) && !defined(__APPLE__) && !defined(_WIN32) - char *orig_localename = NULL; - if ( locale ) - { - // Protect damaging the global locale from a temporary locale on another thread. - pthread_mutex_lock( &self->mutex ); - - // Get the current locale - orig_localename = strdup( setlocale( LC_NUMERIC, NULL ) ); - - // Set the new locale - setlocale( LC_NUMERIC, locale ); - } -#endif - if ( pos ) { -#if defined(__GLIBC__) || defined(__APPLE__) if ( locale ) seconds = strtod_l( pos + 1, NULL, locale ); else -#endif seconds = strtod( pos + 1, NULL ); *pos = 0; pos = strrchr( s, ':' ); @@ -312,23 +295,12 @@ static int time_clock_to_frames( mlt_pro } } else { -#if defined(__GLIBC__) || defined(__APPLE__) if ( locale ) seconds = strtod_l( s, NULL, locale ); else -#endif seconds = strtod( s, NULL ); } -#if !defined(__GLIBC__) && !defined(__APPLE__) && !defined(_WIN32) - if ( locale ) { - // Restore the current locale - setlocale( LC_NUMERIC, orig_localename ); - free( orig_localename ); - pthread_mutex_unlock( &self->mutex ); - } -#endif - free( copy ); return floor( fps * hours * 3600 ) + floor( fps * minutes * 60 ) + lrint( fps * seconds ); @@ -407,7 +379,7 @@ static int time_code_to_frames( mlt_prop static int mlt_property_atoi( mlt_property self, double fps, locale_t locale ) { const char *value = self->prop_string; - + // Parse a hex color value as #RRGGBB or #AARRGGBB. if ( value[0] == '#' ) { @@ -489,37 +461,13 @@ static double mlt_property_atof( mlt_pro char *end = NULL; double result; -#if defined(__GLIBC__) || defined(__APPLE__) if ( locale ) result = strtod_l( value, &end, locale ); else -#elif !defined(_WIN32) - char *orig_localename = NULL; - if ( locale ) { - // Protect damaging the global locale from a temporary locale on another thread. - pthread_mutex_lock( &self->mutex ); - - // Get the current locale - orig_localename = strdup( setlocale( LC_NUMERIC, NULL ) ); - - // Set the new locale - setlocale( LC_NUMERIC, locale ); - } -#endif - result = strtod( value, &end ); if ( end && end[0] == '%' ) result /= 100.0; -#if !defined(__GLIBC__) && !defined(__APPLE__) && !defined(_WIN32) - if ( locale ) { - // Restore the current locale - setlocale( LC_NUMERIC, orig_localename ); - free( orig_localename ); - pthread_mutex_unlock( &self->mutex ); - } -#endif - return result; } } @@ -1030,36 +978,11 @@ static int is_property_numeric( mlt_prop { double temp; char *p = NULL; - -#if defined(__GLIBC__) || defined(__APPLE__) + if ( locale ) temp = strtod_l( self->prop_string, &p, locale ); else -#elif !defined(_WIN32) - char *orig_localename = NULL; - if ( locale ) { - // Protect damaging the global locale from a temporary locale on another thread. - pthread_mutex_lock( &self->mutex ); - - // Get the current locale - orig_localename = strdup( setlocale( LC_NUMERIC, NULL ) ); - - // Set the new locale - setlocale( LC_NUMERIC, locale ); - } -#endif - - temp = strtod( self->prop_string, &p ); - -#if !defined(__GLIBC__) && !defined(__APPLE__) && !defined(_WIN32) - if ( locale ) { - // Restore the current locale - setlocale( LC_NUMERIC, orig_localename ); - free( orig_localename ); - pthread_mutex_unlock( &self->mutex ); - } -#endif - + temp = strtod( self->prop_string, &p ); result = ( p != self->prop_string ); } return result; @@ -1535,28 +1458,12 @@ mlt_rect mlt_property_get_rect( mlt_prop char *p = NULL; int count = 0; -#if !defined(__GLIBC__) && !defined(__APPLE__) && !defined(_WIN32) - char *orig_localename = NULL; - if ( locale ) { - // Protect damaging the global locale from a temporary locale on another thread. - pthread_mutex_lock( &self->mutex ); - - // Get the current locale - orig_localename = strdup( setlocale( LC_NUMERIC, NULL ) ); - - // Set the new locale - setlocale( LC_NUMERIC, locale ); - } -#endif - while ( *value ) { double temp; -#if defined(__GLIBC__) || defined(__APPLE__) if ( locale ) temp = strtod_l( value, &p, locale ); else -#endif temp = strtod( value, &p ); if ( p != value ) { @@ -1586,15 +1493,6 @@ mlt_rect mlt_property_get_rect( mlt_prop value = p; count ++; } - -#if !defined(__GLIBC__) && !defined(__APPLE__) && !defined(_WIN32) - if ( locale ) { - // Restore the current locale - setlocale( LC_NUMERIC, orig_localename ); - free( orig_localename ); - pthread_mutex_unlock( &self->mutex ); - } -#endif } return rect; } --- src/framework/mlt_property.h 2018-01-23 07:41:00.000000000 +0100 +++ src/framework/mlt_property.h 2018-01-25 18:01:15.393795679 +0100 @@ -30,13 +30,7 @@ #include #endif -#if defined(__GLIBC__) && !defined(__APPLE__) # include -#elif defined(__APPLE__) || (__FreeBSD_version >= 900506) -# include -#else -typedef char* locale_t; -#endif extern mlt_property mlt_property_init( ); extern int mlt_property_set_int( mlt_property self, int value );