Commit af3d8bd4 authored by bar@mysql.com's avatar bar@mysql.com

charset.c:

  Bug#13238 mysqldump and mysqladmin hangs
  Avoid recursion into init_available_charsets.
  Serg's version didn't work for me: I got 
  double mutex locking.
  Pushing this version instead
  (It was approved by Serg anyway)
parent 2a7c88c5
...@@ -38,6 +38,22 @@ my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2) ...@@ -38,6 +38,22 @@ my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2)
} }
static uint
get_collation_number_internal(const char *name)
{
CHARSET_INFO **cs;
for (cs= all_charsets;
cs < all_charsets+array_elements(all_charsets)-1 ;
cs++)
{
if ( cs[0] && cs[0]->name &&
!my_strcasecmp(&my_charset_latin1, cs[0]->name, name))
return cs[0]->number;
}
return 0;
}
static my_bool init_state_maps(CHARSET_INFO *cs) static my_bool init_state_maps(CHARSET_INFO *cs)
{ {
uint i; uint i;
...@@ -189,7 +205,8 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs) ...@@ -189,7 +205,8 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs)
static int add_collation(CHARSET_INFO *cs) static int add_collation(CHARSET_INFO *cs)
{ {
if (cs->name && (cs->number || (cs->number=get_collation_number(cs->name)))) if (cs->name && (cs->number ||
(cs->number=get_collation_number_internal(cs->name))))
{ {
if (!all_charsets[cs->number]) if (!all_charsets[cs->number])
{ {
...@@ -419,18 +436,8 @@ void free_charsets(void) ...@@ -419,18 +436,8 @@ void free_charsets(void)
uint get_collation_number(const char *name) uint get_collation_number(const char *name)
{ {
CHARSET_INFO **cs;
init_available_charsets(MYF(0)); init_available_charsets(MYF(0));
return get_collation_number_internal(name);
for (cs= all_charsets;
cs < all_charsets+array_elements(all_charsets)-1 ;
cs++)
{
if ( cs[0] && cs[0]->name &&
!my_strcasecmp(&my_charset_latin1, cs[0]->name, name))
return cs[0]->number;
}
return 0; /* this mimics find_type() */
} }
......
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