Commit 23f25285 authored by unknown's avatar unknown

system_charset_info has been moved to /sql directory

and isn't used in libraries any longer

parent 2aa9f207
...@@ -157,7 +157,7 @@ static int get_answer(QUESTION_WIDGET* w) ...@@ -157,7 +157,7 @@ static int get_answer(QUESTION_WIDGET* w)
char c; char c;
if (!fgets(buf,sizeof(buf),w->in)) if (!fgets(buf,sizeof(buf),w->in))
die("Failed fgets on input stream"); die("Failed fgets on input stream");
switch ((c=my_tolower(system_charset_info,*buf))) switch ((c=my_tolower(&my_charset_latin1,*buf)))
{ {
case '\n': case '\n':
return w->default_ind; return w->default_ind;
......
...@@ -113,7 +113,7 @@ char *argv[]; ...@@ -113,7 +113,7 @@ char *argv[];
exit(1); exit(1);
for (i=1,pos=word_end_chars ; i < 256 ; i++) 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++=i;
*pos=0; *pos=0;
if (!(replace=init_replace((char**) from.typelib.type_names, if (!(replace=init_replace((char**) from.typelib.type_names,
......
...@@ -175,9 +175,9 @@ trace dump and specify the path to it with -s or --symbols-file"); ...@@ -175,9 +175,9 @@ trace dump and specify the path to it with -s or --symbols-file");
static uchar hex_val(char c) static uchar hex_val(char c)
{ {
uchar l; uchar l;
if (my_isdigit(system_charset_info,c)) if (my_isdigit(&my_charset_latin1,c))
return c - '0'; return c - '0';
l = my_tolower(system_charset_info,c); l = my_tolower(&my_charset_latin1,c);
if (l < 'a' || l > 'f') if (l < 'a' || l > 'f')
return HEX_INVALID; return HEX_INVALID;
return (uchar)10 + ((uchar)c - (uchar)'a'); return (uchar)10 + ((uchar)c - (uchar)'a');
...@@ -203,10 +203,10 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf) ...@@ -203,10 +203,10 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf)
if (!se->addr) if (!se->addr)
return -1; return -1;
while (my_isspace(system_charset_info,*buf++)) while (my_isspace(&my_charset_latin1,*buf++))
/* empty */; /* empty */;
while (my_isspace(system_charset_info,*buf++)) while (my_isspace(&my_charset_latin1,*buf++))
/* empty - skip more space */; /* empty - skip more space */;
--buf; --buf;
/* now we are on the symbol */ /* now we are on the symbol */
...@@ -288,7 +288,7 @@ static void do_resolve() ...@@ -288,7 +288,7 @@ static void do_resolve()
{ {
p = buf; p = buf;
/* skip space */ /* skip space */
while (my_isspace(system_charset_info,*p)) while (my_isspace(&my_charset_latin1,*p))
++p; ++p;
if (*p++ == '0' && *p++ == 'x') if (*p++ == '0' && *p++ == 'x')
......
...@@ -122,7 +122,7 @@ int main(int argc, char **argv) ...@@ -122,7 +122,7 @@ int main(int argc, char **argv)
{ {
ip = *argv++; ip = *argv++;
if (my_isdigit(system_charset_info,ip[0])) if (my_isdigit(&my_charset_latin1,ip[0]))
{ {
taddr = inet_addr(ip); taddr = inet_addr(ip);
if (taddr == htonl(INADDR_BROADCAST)) if (taddr == htonl(INADDR_BROADCAST))
......
...@@ -1693,9 +1693,9 @@ STDCALL mysql_rpl_query_type(const char* q, int len) ...@@ -1693,9 +1693,9 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
for (; q < q_end; ++q) for (; q < q_end; ++q)
{ {
char c; 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 'i': /* insert */
case 'u': /* update or unlock tables */ case 'u': /* update or unlock tables */
case 'l': /* lock tables or load data infile */ case 'l': /* lock tables or load data infile */
...@@ -1703,10 +1703,10 @@ STDCALL mysql_rpl_query_type(const char* q, int len) ...@@ -1703,10 +1703,10 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
case 'a': /* alter */ case 'a': /* alter */
return MYSQL_RPL_MASTER; return MYSQL_RPL_MASTER;
case 'c': /* create or check */ 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; MYSQL_RPL_MASTER;
case 's': /* select or show */ 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; MYSQL_RPL_SLAVE;
case 'f': /* flush */ case 'f': /* flush */
case 'r': /* repair */ case 'r': /* repair */
...@@ -4842,40 +4842,40 @@ static void send_data_str(MYSQL_BIND *param, char *value, uint length) ...@@ -4842,40 +4842,40 @@ static void send_data_str(MYSQL_BIND *param, char *value, uint length)
switch(param->buffer_type) { switch(param->buffer_type) {
case MYSQL_TYPE_TINY: 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); &err);
*buffer= data; *buffer= data;
break; break;
} }
case MYSQL_TYPE_SHORT: 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); &err);
int2store(buffer, data); int2store(buffer, data);
break; break;
} }
case MYSQL_TYPE_LONG: 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); &err);
int4store(buffer, data); int4store(buffer, data);
break; break;
} }
case MYSQL_TYPE_LONGLONG: 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); int8store(buffer, data);
break; break;
} }
case MYSQL_TYPE_FLOAT: 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); float4store(buffer, data);
break; break;
} }
case MYSQL_TYPE_DOUBLE: 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); float8store(buffer, data);
break; break;
} }
......
...@@ -408,7 +408,6 @@ char *get_charsets_dir(char *buf) ...@@ -408,7 +408,6 @@ char *get_charsets_dir(char *buf)
CHARSET_INFO *all_charsets[256]; CHARSET_INFO *all_charsets[256];
CHARSET_INFO *default_charset_info = &my_charset_latin1; 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) #define MY_ADD_CHARSET(x) all_charsets[(x)->number]=(x)
......
...@@ -249,7 +249,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, ...@@ -249,7 +249,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
{ {
line++; line++;
/* Ignore comment and empty lines */ /* 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) if (*ptr == '#' || *ptr == ';' || !*ptr)
continue; continue;
if (*ptr == '[') /* Group name */ if (*ptr == '[') /* Group name */
...@@ -262,7 +262,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, ...@@ -262,7 +262,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
name,line); name,line);
goto err; 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; end[0]=0;
read_values=find_type(ptr,group,3) > 0; read_values=find_type(ptr,group,3) > 0;
continue; continue;
...@@ -278,7 +278,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, ...@@ -278,7 +278,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
continue; continue;
if (!(end=value=strchr(ptr,'='))) if (!(end=value=strchr(ptr,'=')))
end=strend(ptr); /* Option without argument */ 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 (!value)
{ {
if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3))) 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, ...@@ -291,9 +291,9 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
{ {
/* Remove pre- and end space */ /* Remove pre- and end space */
char *value_end; 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); 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 */ if (value_end < value) /* Empty string */
value_end=value; value_end=value;
if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3 + if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3 +
......
...@@ -267,7 +267,7 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args) ...@@ -267,7 +267,7 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
/* Found one '%' */ /* Found one '%' */
} }
/* Skipp if max size is used (to be compatible with printf) */ /* 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++; fmt++;
if (*fmt == 's') /* String parameter */ if (*fmt == 's') /* String parameter */
{ {
......
...@@ -69,7 +69,7 @@ int my_error(int nr,myf MyFlags, ...) ...@@ -69,7 +69,7 @@ int my_error(int nr,myf MyFlags, ...)
else else
{ {
/* Skipp if max size is used (to be compatible with printf) */ /* 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++; tpos++;
if (*tpos == 'l') /* Skipp 'l' argument */ if (*tpos == 'l') /* Skipp 'l' argument */
tpos++; tpos++;
......
...@@ -109,7 +109,7 @@ int my_setwd(const char *dir, myf MyFlags) ...@@ -109,7 +109,7 @@ int my_setwd(const char *dir, myf MyFlags)
uint drive,drives; uint drive,drives;
pos++; /* Skipp FN_DEVCHAR */ 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; drives= (uint) -1;
if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32) if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32)
{ {
......
...@@ -52,7 +52,7 @@ my_bool my_init_done=0; ...@@ -52,7 +52,7 @@ my_bool my_init_done=0;
static ulong atoi_octal(const char *str) static ulong atoi_octal(const char *str)
{ {
long int tmp; long int tmp;
while (*str && my_isspace(system_charset_info, *str)) while (*str && my_isspace(&my_charset_latin1, *str))
str++; str++;
str2int(str, str2int(str,
(*str == '0' ? 8 : 10), /* Octalt or decimalt */ (*str == '0' ? 8 : 10), /* Octalt or decimalt */
......
...@@ -48,8 +48,8 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name) ...@@ -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 (pos=0 ; (j=typelib->type_names[pos]) ; pos++)
{ {
for (i=x ; for (i=x ;
*i && my_toupper(system_charset_info,*i) == *i && my_toupper(&my_charset_latin1,*i) ==
my_toupper(system_charset_info,*j) ; i++, j++) ; my_toupper(&my_charset_latin1,*j) ; i++, j++) ;
if (! *j) if (! *j)
{ {
while (*i == ' ') while (*i == ' ')
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <floatingpoint.h> #include <floatingpoint.h>
#endif #endif
CHARSET_INFO *system_charset_info= &my_charset_latin1;
extern gptr sql_alloc(unsigned size); extern gptr sql_alloc(unsigned size);
extern void sql_element_free(void *ptr); extern void sql_element_free(void *ptr);
static uint32 static uint32
......
...@@ -89,6 +89,8 @@ ...@@ -89,6 +89,8 @@
#define MAX_LAUNCHER_MSG 256 #define MAX_LAUNCHER_MSG 256
#endif #endif
static CHARSET_INFO *cs= &my_charset_latin1;
#define MAX_RETRY_COUNT 100 #define MAX_RETRY_COUNT 100
/* /*
...@@ -428,8 +430,8 @@ static int exec_line(struct manager_thd* thd,char* buf,char* buf_end) ...@@ -428,8 +430,8 @@ static int exec_line(struct manager_thd* thd,char* buf,char* buf_end)
{ {
char* p=buf; char* p=buf;
struct manager_cmd* cmd; struct manager_cmd* cmd;
for (;p<buf_end && !my_isspace(system_charset_info,*p);p++) for (;p<buf_end && !my_isspace(cs,*p);p++)
*p=my_tolower(system_charset_info,*p); *p=my_tolower(cs,*p);
log_info("Command '%s'", buf); log_info("Command '%s'", buf);
if (!(cmd=lookup_cmd(buf,(int)(p-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) ...@@ -439,7 +441,7 @@ static int exec_line(struct manager_thd* thd,char* buf,char* buf_end)
thd->fatal=1; thd->fatal=1;
return 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); return cmd->handler_func(thd,p,buf_end);
} }
...@@ -716,7 +718,7 @@ HANDLE_DECL(handle_query) ...@@ -716,7 +718,7 @@ HANDLE_DECL(handle_query)
int num_fields,i,ident_len; int num_fields,i,ident_len;
char* ident,*query; char* ident,*query;
query=ident=args_start; query=ident=args_start;
while (!my_isspace(system_charset_info,*query)) while (!my_isspace(cs,*query))
query++; query++;
if (query == ident) if (query == ident)
{ {
...@@ -724,7 +726,7 @@ HANDLE_DECL(handle_query) ...@@ -724,7 +726,7 @@ HANDLE_DECL(handle_query)
goto err; goto err;
} }
ident_len=(int)(query-ident); ident_len=(int)(query-ident);
while (query<args_end && my_isspace(system_charset_info,*query)) while (query<args_end && my_isspace(cs,*query))
query++; query++;
if (query == args_end) if (query == args_end)
{ {
...@@ -1000,7 +1002,7 @@ static int authenticate(struct manager_thd* thd) ...@@ -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; for (buf=thd->cmd_buf,p=thd->user,p_end=p+MAX_USER_NAME;
buf<buf_end && (c=*buf) && p<p_end; buf++,p++) buf<buf_end && (c=*buf) && p<p_end; buf++,p++)
{ {
if (my_isspace(system_charset_info,c)) if (my_isspace(cs,c))
{ {
*p=0; *p=0;
break; break;
...@@ -1013,7 +1015,7 @@ static int authenticate(struct manager_thd* thd) ...@@ -1013,7 +1015,7 @@ static int authenticate(struct manager_thd* thd)
if (!(u=(struct manager_user*)hash_search(&user_hash,thd->user, if (!(u=(struct manager_user*)hash_search(&user_hash,thd->user,
(uint)(p-thd->user)))) (uint)(p-thd->user))))
return 1; 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_MD5Init(&context);
my_MD5Update(&context,(uchar*) buf,(uint)(buf_end-buf)); my_MD5Update(&context,(uchar*) buf,(uint)(buf_end-buf));
...@@ -1582,9 +1584,9 @@ static void manager_exec_free(void* e) ...@@ -1582,9 +1584,9 @@ static void manager_exec_free(void* e)
static int hex_val(char c) static int hex_val(char c)
{ {
if (my_isdigit(system_charset_info,c)) if (my_isdigit(cs,c))
return c-'0'; return c-'0';
c=my_tolower(system_charset_info,c); c=my_tolower(cs,c);
return c-'a'+10; return c-'a'+10;
} }
...@@ -1641,7 +1643,7 @@ static void init_user_hash() ...@@ -1641,7 +1643,7 @@ static void init_user_hash()
FILE* f; FILE* f;
char buf[80]; char buf[80];
int line_num=1; 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))) get_user_key,manager_user_free,MYF(0)))
die("Could not initialize user hash"); die("Could not initialize user hash");
if (!(f=my_fopen(manager_pw_file, O_RDONLY | O_BINARY, MYF(MY_WME)))) if (!(f=my_fopen(manager_pw_file, O_RDONLY | O_BINARY, MYF(MY_WME))))
...@@ -1688,7 +1690,7 @@ static void init_pid_file() ...@@ -1688,7 +1690,7 @@ static void init_pid_file()
static void init_globals() static void init_globals()
{ {
pthread_attr_t thr_attr; 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))) get_exec_key,manager_exec_free,MYF(0)))
die("Exec hash initialization failed"); die("Exec hash initialization failed");
if (!one_thread) if (!one_thread)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment