Skip to content

Commit 08129ee

Browse files
Reorganization to restore generating charset C files from conf files
1 parent b2c97a0 commit 08129ee

File tree

17 files changed

+4139
-4067
lines changed

17 files changed

+4139
-4067
lines changed

include/m_ctype.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,20 @@ typedef struct charset_info_st
166166

167167
extern CHARSET_INFO *my_charset_bin;
168168
extern CHARSET_INFO *my_charset_latin1;
169-
extern CHARSET_INFO *default_charset_info;
170-
extern CHARSET_INFO *system_charset_info;
171-
extern CHARSET_INFO *all_charsets[256];
172-
extern my_bool init_compiled_charsets(myf flags);
169+
extern CHARSET_INFO my_charset_big5;
170+
extern CHARSET_INFO my_charset_czech;
171+
extern CHARSET_INFO my_charset_euc_kr;
172+
extern CHARSET_INFO my_charset_gb2312;
173+
extern CHARSET_INFO my_charset_gbk;
174+
extern CHARSET_INFO my_charset_latin1_de;
175+
extern CHARSET_INFO my_charset_sjis;
176+
extern CHARSET_INFO my_charset_tis620;
177+
extern CHARSET_INFO my_charset_ucs2;
178+
extern CHARSET_INFO my_charset_ujis;
179+
extern CHARSET_INFO my_charset_utf8;
180+
extern CHARSET_INFO my_charset_win1250ch;
181+
182+
173183
extern my_bool my_parse_charset_xml(const char *bug, uint len,
174184
int (*add)(CHARSET_INFO *cs));
175185

include/my_sys.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
201201
myf MyFlags);
202202

203203
/* charsets */
204+
extern CHARSET_INFO *default_charset_info;
205+
extern CHARSET_INFO *system_charset_info;
206+
extern CHARSET_INFO *all_charsets[256];
207+
extern CHARSET_INFO compiled_charsets[];
208+
204209
extern uint get_charset_number(const char *cs_name);
205210
extern const char *get_charset_name(uint cs_number);
206211
extern CHARSET_INFO *get_charset(uint cs_number, myf flags);

libmysql/Makefile.shared

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
4040
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
4141
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \
4242
ctype-big5.lo ctype-czech.lo ctype-euc_kr.lo \
43-
ctype-win1250ch.lo ctype-utf8.lo \
43+
ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \
4444
ctype-gb2312.lo ctype-gbk.lo ctype-latin1_de.lo \
4545
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo xml.lo
4646

mysys/charset.c

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,76 @@ char *get_charsets_dir(char *buf)
314314
DBUG_RETURN(strend(buf));
315315
}
316316

317+
CHARSET_INFO *all_charsets[256];
318+
CHARSET_INFO *default_charset_info = &compiled_charsets[0];
319+
CHARSET_INFO *system_charset_info = &compiled_charsets[0];
320+
321+
#define MY_ADD_CHARSET(x) all_charsets[(x)->number]=(x)
322+
323+
324+
static my_bool init_compiled_charsets(myf flags __attribute__((unused)))
325+
{
326+
CHARSET_INFO *cs;
327+
328+
MY_ADD_CHARSET(my_charset_bin);
329+
330+
#ifdef HAVE_CHARSET_big5
331+
MY_ADD_CHARSET(&my_charset_big5);
332+
#endif
333+
334+
#ifdef HAVE_CHARSET_czech
335+
MY_ADD_CHARSET(&my_charset_czech);
336+
#endif
337+
338+
#ifdef HAVE_CHARSET_euc_kr
339+
MY_ADD_CHARSET(&my_charset_euc_kr);
340+
#endif
341+
342+
#ifdef HAVE_CHARSET_gb2312
343+
MY_ADD_CHARSET(&my_charset_gb2312);
344+
#endif
345+
346+
#ifdef HAVE_CHARSET_gbk
347+
MY_ADD_CHARSET(&my_charset_gbk);
348+
#endif
349+
350+
#ifdef HAVE_CHARSET_latin1_de
351+
MY_ADD_CHARSET(&my_charset_latin1_de);
352+
#endif
353+
354+
#ifdef HAVE_CHARSET_sjis
355+
MY_ADD_CHARSET(&my_charset_sjis);
356+
#endif
357+
358+
#ifdef HAVE_CHARSET_tis620
359+
MY_ADD_CHARSET(&my_charset_tis620);
360+
#endif
361+
362+
#ifdef HAVE_CHARSET_ucs2
363+
MY_ADD_CHARSET(&my_charset_ucs2);
364+
#endif
365+
366+
#ifdef HAVE_CHARSET_ujis
367+
MY_ADD_CHARSET(&my_charset_ujis);
368+
#endif
369+
370+
#ifdef HAVE_CHARSET_utf8
371+
MY_ADD_CHARSET(&my_charset_utf8);
372+
#endif
373+
374+
#ifdef HAVE_CHARSET_win1250ch
375+
MY_ADD_CHARSET(&my_charset_win1250ch);
376+
#endif
377+
378+
/* Copy compiled charsets */
379+
for (cs=compiled_charsets; cs->name; cs++)
380+
{
381+
all_charsets[cs->number]=cs;
382+
}
383+
384+
return FALSE;
385+
}
386+
317387
static my_bool init_available_charsets(myf myflags)
318388
{
319389
char fname[FN_REFLEN];
@@ -607,3 +677,5 @@ char *list_charsets(myf want_flags)
607677

608678
return p;
609679
}
680+
681+

regex/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
1919
noinst_LIBRARIES = libregex.a
20-
LDADD = libregex.a ../strings/libmystrings.a ../mysys/libmysys.a
20+
LDADD = libregex.a ../strings/libmystrings.a
2121
noinst_HEADERS = cclass.h cname.h regex2.h utils.h engine.c regex.h
2222
libregex_a_SOURCES = regerror.c regcomp.c regexec.c regfree.c reginit.c
2323
noinst_PROGRAMS = re

regex/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ char *argv[];
7474
exit(status);
7575
}
7676

77-
err = regcomp(&re, argv[optind++], copts, default_charset_info);
77+
err = regcomp(&re, argv[optind++], copts, my_charset_latin1);
7878
if (err) {
7979
len = regerror(err, &re, erbuf, sizeof(erbuf));
8080
fprintf(stderr, "error %s, %d/%d `%s'\n",
@@ -226,7 +226,7 @@ int opts; /* may not match f1 */
226226
strcpy(f0copy, f0);
227227
re.re_endp = (opts&REG_PEND) ? f0copy + strlen(f0copy) : NULL;
228228
fixstr(f0copy);
229-
err = regcomp(&re, f0copy, opts, default_charset_info);
229+
err = regcomp(&re, f0copy, opts, my_charset_latin1);
230230
if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
231231
/* unexpected error or wrong error */
232232
len = regerror(err, &re, erbuf, sizeof(erbuf));

regex/regcomp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ CHARSET_INFO *charset;
117117
# define GOODFLAGS(f) ((f)&~REG_DUMP)
118118
#endif
119119

120-
regex_init(); /* Init cclass if neaded */
120+
regex_init(charset); /* Init cclass if neaded */
121121
preg->charset=charset;
122122
cflags = GOODFLAGS(cflags);
123123
if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))

regex/regex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ extern void regfree(regex_t *);
7676

7777
/* === reginit.c === */
7878

79-
extern void regex_init(void); /* Should be called for multithread progs */
79+
extern void regex_init(CHARSET_INFO *cs); /* Should be called for multithread progs */
8080
extern void regex_end(void); /* If one wants a clean end */
8181

8282
#ifdef __cplusplus

regex/reginit.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77

88
static bool regex_inited=0;
99

10-
void regex_init()
10+
void regex_init(CHARSET_INFO *cs)
1111
{
1212
char buff[CCLASS_LAST][256];
1313
int count[CCLASS_LAST];
1414
uint i;
15-
CHARSET_INFO *cs=default_charset_info;
1615

1716
if (!regex_inited)
1817
{

sql/mysqld.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
19371937
set_var_init();
19381938
mysys_uses_curses=0;
19391939
#ifdef USE_REGEX
1940-
regex_init();
1940+
regex_init(my_charset_latin1);
19411941
#endif
19421942
if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME)))
19431943
return 1;

0 commit comments

Comments
 (0)