Merge branch 'js/runtime-prefix'
* js/runtime-prefix: Avoid multiple PREFIX definitions git_setup_gettext: plug memory leak gettext: avoid initialization if the locale dir is not present
This commit is contained in:
10
gettext.c
10
gettext.c
@ -159,15 +159,23 @@ static void init_gettext_charset(const char *domain)
|
||||
void git_setup_gettext(void)
|
||||
{
|
||||
const char *podir = getenv(GIT_TEXT_DOMAIN_DIR_ENVIRONMENT);
|
||||
char *p = NULL;
|
||||
|
||||
if (!podir)
|
||||
podir = system_path(GIT_LOCALE_PATH);
|
||||
podir = p = system_path(GIT_LOCALE_PATH);
|
||||
|
||||
if (!is_directory(podir)) {
|
||||
free(p);
|
||||
return;
|
||||
}
|
||||
|
||||
bindtextdomain("git", podir);
|
||||
setlocale(LC_MESSAGES, "");
|
||||
setlocale(LC_TIME, "");
|
||||
init_gettext_charset("git");
|
||||
textdomain("git");
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
/* return the number of columns of string 's' in current locale */
|
||||
|
Reference in New Issue
Block a user