mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
Moved setlocale() at the beginning of initialization, should fix regexp
crashes with non-C locale. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2858 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
0c712801a0
commit
b38316c8ba
@ -42,6 +42,7 @@
|
|||||||
#include "textbuffer-reformat.h"
|
#include "textbuffer-reformat.h"
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#ifdef HAVE_STATIC_PERL
|
#ifdef HAVE_STATIC_PERL
|
||||||
void perl_core_init(void);
|
void perl_core_init(void);
|
||||||
@ -333,6 +334,14 @@ int main(int argc, char **argv)
|
|||||||
textdomain(PACKAGE);
|
textdomain(PACKAGE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* setlocale() must be called at the beginning before any calls that
|
||||||
|
affect it, especially regexps seem to break if they're generated
|
||||||
|
before t his call.
|
||||||
|
|
||||||
|
locales aren't actually used for anything else than autodetection
|
||||||
|
of UTF-8 currently.. */
|
||||||
|
setlocale(LC_CTYPE, "");
|
||||||
|
|
||||||
textui_init();
|
textui_init();
|
||||||
args_register(options);
|
args_register(options);
|
||||||
args_execute(argc, argv);
|
args_execute(argc, argv);
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "mainwindows.h"
|
#include "mainwindows.h"
|
||||||
|
|
||||||
#ifdef HAVE_NL_LANGINFO
|
#ifdef HAVE_NL_LANGINFO
|
||||||
# include <locale.h>
|
|
||||||
# include <langinfo.h>
|
# include <langinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -155,7 +154,6 @@ void term_common_init(void)
|
|||||||
read_settings();
|
read_settings();
|
||||||
|
|
||||||
#if defined (HAVE_NL_LANGINFO) && defined(CODESET)
|
#if defined (HAVE_NL_LANGINFO) && defined(CODESET)
|
||||||
setlocale(LC_CTYPE, "");
|
|
||||||
if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
|
if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
|
||||||
term_type = TERM_TYPE_UTF8;
|
term_type = TERM_TYPE_UTF8;
|
||||||
term_set_input_type(TERM_TYPE_UTF8);
|
term_set_input_type(TERM_TYPE_UTF8);
|
||||||
|
Loading…
Reference in New Issue
Block a user