X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_setup.c;h=4752ba899d4d884414a4cb17dcaedc46512cf93a;hb=bd2d9c5734d2c66abe0b2ddd766695b200c154fe;hp=b3cac8150347b852853b3e75f7260dd890a1e771;hpb=894a177fd5228cdbe790bd1dc9435bd435c29681;p=ncurses.git diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index b3cac815..4752ba89 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2023,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,7 +49,7 @@ #include #endif -MODULE_ID("$Id: lib_setup.c,v 1.228 2023/10/07 23:06:04 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.231 2024/02/04 00:09:34 tom Exp $") /**************************************************************************** * @@ -293,6 +293,7 @@ _nc_default_screensize(TERMINAL *termp, int *linep, int *colp) } } +#if defined(USE_CHECK_SIZE) && defined(user6) && defined(user7) static const char * skip_csi(const char *value) { @@ -406,9 +407,10 @@ _nc_check_screensize(TERMINAL *termp, int *linep, int *colp) _nc_default_screensize(termp, linep, colp); } -#else -#define _nc_check_screensize(termp, linep, colp) _nc_default_screensize(termp, linep, colp) +#else /* !USE_CHECK_SIZE */ +#define _nc_check_screensize(termp, linep, colp) /* nothing */ #endif +#endif /* !(defined(USE_TERM_DRIVER) || defined(EXP_WIN32_DRIVER)) */ NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *sp, @@ -705,22 +707,27 @@ _nc_get_locale(void) NCURSES_EXPORT(int) _nc_unicode_locale(void) { - int result = 0; + static bool initialized = FALSE; + static int result = 0; + + if (!initialized) { #if defined(_NC_WINDOWS) && USE_WIDEC_SUPPORT - result = 1; + result = 1; #elif HAVE_LANGINFO_CODESET - char *env = nl_langinfo(CODESET); - result = !strcmp(env, "UTF-8"); - T(("_nc_unicode_locale(%s) ->%d", env, result)); + char *env = nl_langinfo(CODESET); + result = !strcmp(env, "UTF-8"); + T(("_nc_unicode_locale(%s) ->%d", env, result)); #else - char *env = _nc_get_locale(); - if (env != 0) { - if (strstr(env, ".UTF-8") != 0) { - result = 1; - T(("_nc_unicode_locale(%s) ->%d", env, result)); + char *env = _nc_get_locale(); + if (env != 0) { + if (strstr(env, ".UTF-8") != 0) { + result = 1; + T(("_nc_unicode_locale(%s) ->%d", env, result)); + } } - } #endif + initialized = TRUE; + } return result; }