Commit 09eac479 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

bin chatset now handles strnncoll itself so we don't have to check

if charset is binary anymore
parent 22b7e67b
......@@ -4017,11 +4017,6 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length)
uint a_length= (uint) (uchar) *a++;
uint b_length= (uint) (uchar) *b++;
if (binary())
{
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
return my_strnncoll(field_charset,
(const uchar*)a,a_length,
(const uchar*)b,b_length);
......@@ -4036,11 +4031,6 @@ int Field_string::pack_cmp(const char *b, uint length)
end--;
uint a_length = (uint) (end - ptr);
if (binary())
{
int cmp= memcmp(ptr,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
return my_strnncoll(field_charset,
(const uchar*)ptr,a_length,
(const uchar*)b, b_length);
......@@ -4231,11 +4221,6 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length)
a_length= (uint) (uchar) *a++;
b_length= (uint) (uchar) *b++;
}
if (binary())
{
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
return my_strnncoll(field_charset,
(const uchar *)a,a_length,
(const uchar *)b,b_length);
......@@ -4254,11 +4239,6 @@ int Field_varstring::pack_cmp(const char *b, uint key_length)
{
b_length= (uint) (uchar) *b++;
}
if (binary())
{
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
return my_strnncoll(field_charset,
(const uchar *)a,a_length,
(const uchar *)b,b_length);
......@@ -4747,11 +4727,6 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length)
a_length= (uint) (uchar) *a++;
b_length= (uint) (uchar) *b++;
}
if (binary())
{
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
return my_strnncoll(field_charset,
(const uchar *)a,a_length,
(const uchar *)b,b_length);
......@@ -4775,11 +4750,6 @@ int Field_blob::pack_cmp(const char *b, uint key_length)
{
b_length= (uint) (uchar) *b++;
}
if (binary())
{
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
return my_strnncoll(field_charset,
(const uchar *)a,a_length,
(const uchar *)b,b_length);
......
......@@ -47,8 +47,8 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
int len = ( slen > tlen ) ? tlen : slen;
return memcmp(s,t,len);
int cmp= memcmp(s,t,min(slen,tlen));
return cmp ? cmp : (int) (slen - tlen);
}
static void my_caseup_str_bin(CHARSET_INFO *cs __attribute__((unused)),
......
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