From 23f252855e5dcb18ac55cf9ce303f61c28e06421 Mon Sep 17 00:00:00 2001 From: unknown <root@home.(none)> Date: Sun, 16 Mar 2003 12:30:10 +0400 Subject: [PATCH] system_charset_info has been moved to /sql directory and isn't used in libraries any longer --- extra/mysql_install.c | 2 +- extra/replace.c | 2 +- extra/resolve_stack_dump.c | 10 +++++----- extra/resolveip.c | 2 +- libmysql/libmysql.c | 20 ++++++++++---------- mysys/charset.c | 1 - mysys/default.c | 10 +++++----- mysys/mf_iocache2.c | 2 +- mysys/my_error.c | 2 +- mysys/my_getwd.c | 2 +- mysys/my_init.c | 2 +- mysys/typelib.c | 4 ++-- sql/sql_string.cc | 1 + tools/mysqlmanager.c | 24 +++++++++++++----------- 14 files changed, 43 insertions(+), 41 deletions(-) diff --git a/extra/mysql_install.c b/extra/mysql_install.c index 3f3da8cfb5..11f33028ce 100644 --- a/extra/mysql_install.c +++ b/extra/mysql_install.c @@ -157,7 +157,7 @@ static int get_answer(QUESTION_WIDGET* w) char c; if (!fgets(buf,sizeof(buf),w->in)) die("Failed fgets on input stream"); - switch ((c=my_tolower(system_charset_info,*buf))) + switch ((c=my_tolower(&my_charset_latin1,*buf))) { case '\n': return w->default_ind; diff --git a/extra/replace.c b/extra/replace.c index 5826586988..8e007e3a97 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -113,7 +113,7 @@ char *argv[]; exit(1); for (i=1,pos=word_end_chars ; i < 256 ; i++) - if (my_isspace(system_charset_info,i)) + if (my_isspace(&my_charset_latin1,i)) *pos++=i; *pos=0; if (!(replace=init_replace((char**) from.typelib.type_names, diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index f19ef467b5..06a670b935 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -175,9 +175,9 @@ trace dump and specify the path to it with -s or --symbols-file"); static uchar hex_val(char c) { uchar l; - if (my_isdigit(system_charset_info,c)) + if (my_isdigit(&my_charset_latin1,c)) return c - '0'; - l = my_tolower(system_charset_info,c); + l = my_tolower(&my_charset_latin1,c); if (l < 'a' || l > 'f') return HEX_INVALID; return (uchar)10 + ((uchar)c - (uchar)'a'); @@ -203,10 +203,10 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf) if (!se->addr) return -1; - while (my_isspace(system_charset_info,*buf++)) + while (my_isspace(&my_charset_latin1,*buf++)) /* empty */; - while (my_isspace(system_charset_info,*buf++)) + while (my_isspace(&my_charset_latin1,*buf++)) /* empty - skip more space */; --buf; /* now we are on the symbol */ @@ -288,7 +288,7 @@ static void do_resolve() { p = buf; /* skip space */ - while (my_isspace(system_charset_info,*p)) + while (my_isspace(&my_charset_latin1,*p)) ++p; if (*p++ == '0' && *p++ == 'x') diff --git a/extra/resolveip.c b/extra/resolveip.c index c9446b0fdf..95861bca2b 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -122,7 +122,7 @@ int main(int argc, char **argv) { ip = *argv++; - if (my_isdigit(system_charset_info,ip[0])) + if (my_isdigit(&my_charset_latin1,ip[0])) { taddr = inet_addr(ip); if (taddr == htonl(INADDR_BROADCAST)) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 6fe199bb45..564db0fe11 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1693,9 +1693,9 @@ STDCALL mysql_rpl_query_type(const char* q, int len) for (; q < q_end; ++q) { char c; - if (my_isalpha(system_charset_info, (c= *q))) + if (my_isalpha(&my_charset_latin1, (c= *q))) { - switch (my_tolower(system_charset_info,c)) { + switch (my_tolower(&my_charset_latin1,c)) { case 'i': /* insert */ case 'u': /* update or unlock tables */ case 'l': /* lock tables or load data infile */ @@ -1703,10 +1703,10 @@ STDCALL mysql_rpl_query_type(const char* q, int len) case 'a': /* alter */ return MYSQL_RPL_MASTER; case 'c': /* create or check */ - return my_tolower(system_charset_info,q[1]) == 'h' ? MYSQL_RPL_ADMIN : + return my_tolower(&my_charset_latin1,q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_MASTER; case 's': /* select or show */ - return my_tolower(system_charset_info,q[1]) == 'h' ? MYSQL_RPL_ADMIN : + return my_tolower(&my_charset_latin1,q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_SLAVE; case 'f': /* flush */ case 'r': /* repair */ @@ -4842,40 +4842,40 @@ static void send_data_str(MYSQL_BIND *param, char *value, uint length) switch(param->buffer_type) { case MYSQL_TYPE_TINY: { - uchar data= (uchar)my_strntol(system_charset_info,value,length,10,NULL, + uchar data= (uchar)my_strntol(&my_charset_latin1,value,length,10,NULL, &err); *buffer= data; break; } case MYSQL_TYPE_SHORT: { - short data= (short)my_strntol(system_charset_info,value,length,10,NULL, + short data= (short)my_strntol(&my_charset_latin1,value,length,10,NULL, &err); int2store(buffer, data); break; } case MYSQL_TYPE_LONG: { - int32 data= (int32)my_strntol(system_charset_info,value,length,10,NULL, + int32 data= (int32)my_strntol(&my_charset_latin1,value,length,10,NULL, &err); int4store(buffer, data); break; } case MYSQL_TYPE_LONGLONG: { - longlong data= my_strntoll(system_charset_info,value,length,10,NULL,&err); + longlong data= my_strntoll(&my_charset_latin1,value,length,10,NULL,&err); int8store(buffer, data); break; } case MYSQL_TYPE_FLOAT: { - float data = (float)my_strntod(system_charset_info,value,length,NULL,&err); + float data = (float)my_strntod(&my_charset_latin1,value,length,NULL,&err); float4store(buffer, data); break; } case MYSQL_TYPE_DOUBLE: { - double data= my_strntod(system_charset_info,value,length,NULL,&err); + double data= my_strntod(&my_charset_latin1,value,length,NULL,&err); float8store(buffer, data); break; } diff --git a/mysys/charset.c b/mysys/charset.c index 7baacd613b..9b628ce017 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -408,7 +408,6 @@ char *get_charsets_dir(char *buf) CHARSET_INFO *all_charsets[256]; CHARSET_INFO *default_charset_info = &my_charset_latin1; -CHARSET_INFO *system_charset_info = &my_charset_latin1; #define MY_ADD_CHARSET(x) all_charsets[(x)->number]=(x) diff --git a/mysys/default.c b/mysys/default.c index 06557f73d0..0ae409f101 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -249,7 +249,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, { line++; /* Ignore comment and empty lines */ - for (ptr=buff ; my_isspace(system_charset_info,*ptr) ; ptr++ ) ; + for (ptr=buff ; my_isspace(&my_charset_latin1,*ptr) ; ptr++ ) ; if (*ptr == '#' || *ptr == ';' || !*ptr) continue; if (*ptr == '[') /* Group name */ @@ -262,7 +262,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, name,line); goto err; } - for ( ; my_isspace(system_charset_info,end[-1]) ; end--) ;/* Remove end space */ + for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ;/* Remove end space */ end[0]=0; read_values=find_type(ptr,group,3) > 0; continue; @@ -278,7 +278,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, continue; if (!(end=value=strchr(ptr,'='))) end=strend(ptr); /* Option without argument */ - for ( ; my_isspace(system_charset_info,end[-1]) ; end--) ; + for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ; if (!value) { if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3))) @@ -291,9 +291,9 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, { /* Remove pre- and end space */ char *value_end; - for (value++ ; my_isspace(system_charset_info,*value); value++) ; + for (value++ ; my_isspace(&my_charset_latin1,*value); value++) ; value_end=strend(value); - for ( ; my_isspace(system_charset_info,value_end[-1]) ; value_end--) ; + for ( ; my_isspace(&my_charset_latin1,value_end[-1]) ; value_end--) ; if (value_end < value) /* Empty string */ value_end=value; if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3 + diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 8a7dfc7be0..bce08b9795 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -267,7 +267,7 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args) /* Found one '%' */ } /* Skipp if max size is used (to be compatible with printf) */ - while (my_isdigit(system_charset_info, *fmt) || *fmt == '.' || *fmt == '-') + while (my_isdigit(&my_charset_latin1, *fmt) || *fmt == '.' || *fmt == '-') fmt++; if (*fmt == 's') /* String parameter */ { diff --git a/mysys/my_error.c b/mysys/my_error.c index cd41589f36..6fd346c89f 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -69,7 +69,7 @@ int my_error(int nr,myf MyFlags, ...) else { /* Skipp if max size is used (to be compatible with printf) */ - while (my_isdigit(system_charset_info, *tpos) || *tpos == '.' || *tpos == '-') + while (my_isdigit(&my_charset_latin1, *tpos) || *tpos == '.' || *tpos == '-') tpos++; if (*tpos == 'l') /* Skipp 'l' argument */ tpos++; diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index adf131c5fd..a08d28d854 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -109,7 +109,7 @@ int my_setwd(const char *dir, myf MyFlags) uint drive,drives; pos++; /* Skipp FN_DEVCHAR */ - drive=(uint) (my_toupper(system_charset_info,dir[0])-'A'+1); + drive=(uint) (my_toupper(&my_charset_latin1,dir[0])-'A'+1); drives= (uint) -1; if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32) { diff --git a/mysys/my_init.c b/mysys/my_init.c index ec7cae46d5..fa1beaa3e3 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -52,7 +52,7 @@ my_bool my_init_done=0; static ulong atoi_octal(const char *str) { long int tmp; - while (*str && my_isspace(system_charset_info, *str)) + while (*str && my_isspace(&my_charset_latin1, *str)) str++; str2int(str, (*str == '0' ? 8 : 10), /* Octalt or decimalt */ diff --git a/mysys/typelib.c b/mysys/typelib.c index e524f903b5..e32fad8742 100644 --- a/mysys/typelib.c +++ b/mysys/typelib.c @@ -48,8 +48,8 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name) for (pos=0 ; (j=typelib->type_names[pos]) ; pos++) { for (i=x ; - *i && my_toupper(system_charset_info,*i) == - my_toupper(system_charset_info,*j) ; i++, j++) ; + *i && my_toupper(&my_charset_latin1,*i) == + my_toupper(&my_charset_latin1,*j) ; i++, j++) ; if (! *j) { while (*i == ' ') diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 1a0366112f..b6425003af 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -28,6 +28,7 @@ #include <floatingpoint.h> #endif +CHARSET_INFO *system_charset_info= &my_charset_latin1; extern gptr sql_alloc(unsigned size); extern void sql_element_free(void *ptr); static uint32 diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index 4f2deeb005..20fe217800 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -89,6 +89,8 @@ #define MAX_LAUNCHER_MSG 256 #endif +static CHARSET_INFO *cs= &my_charset_latin1; + #define MAX_RETRY_COUNT 100 /* @@ -428,8 +430,8 @@ static int exec_line(struct manager_thd* thd,char* buf,char* buf_end) { char* p=buf; struct manager_cmd* cmd; - for (;p<buf_end && !my_isspace(system_charset_info,*p);p++) - *p=my_tolower(system_charset_info,*p); + for (;p<buf_end && !my_isspace(cs,*p);p++) + *p=my_tolower(cs,*p); log_info("Command '%s'", buf); if (!(cmd=lookup_cmd(buf,(int)(p-buf)))) { @@ -439,7 +441,7 @@ static int exec_line(struct manager_thd* thd,char* buf,char* buf_end) thd->fatal=1; return 1; } - for (;p<buf_end && my_isspace(system_charset_info,*p);p++); + for (;p<buf_end && my_isspace(cs,*p);p++); return cmd->handler_func(thd,p,buf_end); } @@ -716,7 +718,7 @@ HANDLE_DECL(handle_query) int num_fields,i,ident_len; char* ident,*query; query=ident=args_start; - while (!my_isspace(system_charset_info,*query)) + while (!my_isspace(cs,*query)) query++; if (query == ident) { @@ -724,7 +726,7 @@ HANDLE_DECL(handle_query) goto err; } ident_len=(int)(query-ident); - while (query<args_end && my_isspace(system_charset_info,*query)) + while (query<args_end && my_isspace(cs,*query)) query++; if (query == args_end) { @@ -1000,7 +1002,7 @@ static int authenticate(struct manager_thd* thd) for (buf=thd->cmd_buf,p=thd->user,p_end=p+MAX_USER_NAME; buf<buf_end && (c=*buf) && p<p_end; buf++,p++) { - if (my_isspace(system_charset_info,c)) + if (my_isspace(cs,c)) { *p=0; break; @@ -1013,7 +1015,7 @@ static int authenticate(struct manager_thd* thd) if (!(u=(struct manager_user*)hash_search(&user_hash,thd->user, (uint)(p-thd->user)))) return 1; - for (;my_isspace(system_charset_info,*buf) && buf<buf_end;buf++) /* empty */; + for (;my_isspace(cs,*buf) && buf<buf_end;buf++) /* empty */; my_MD5Init(&context); my_MD5Update(&context,(uchar*) buf,(uint)(buf_end-buf)); @@ -1582,9 +1584,9 @@ static void manager_exec_free(void* e) static int hex_val(char c) { - if (my_isdigit(system_charset_info,c)) + if (my_isdigit(cs,c)) return c-'0'; - c=my_tolower(system_charset_info,c); + c=my_tolower(cs,c); return c-'a'+10; } @@ -1641,7 +1643,7 @@ static void init_user_hash() FILE* f; char buf[80]; int line_num=1; - if (hash_init(&user_hash,system_charset_info,1024,0,0, + if (hash_init(&user_hash,cs,1024,0,0, get_user_key,manager_user_free,MYF(0))) die("Could not initialize user hash"); if (!(f=my_fopen(manager_pw_file, O_RDONLY | O_BINARY, MYF(MY_WME)))) @@ -1688,7 +1690,7 @@ static void init_pid_file() static void init_globals() { pthread_attr_t thr_attr; - if (hash_init(&exec_hash,system_charset_info,1024,0,0, + if (hash_init(&exec_hash,cs,1024,0,0, get_exec_key,manager_exec_free,MYF(0))) die("Exec hash initialization failed"); if (!one_thread) -- 2.30.9