Hi RĂ©mi,
I think it would be better to fix it by creating temporary locale_t object when NULL is passed. This way we can avoid adding multiple internal functions (it will also make it possible to reuse it in more functions in future). _get_current_locale is buggy but it should be good enough in this case (you can also introduce get_current_locale_noalloc and free_locale_noalloc that avoids allocation to speed things up).
Thanks, Piotr