1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

stringcmp() and sortcmp() have been unified

into the only one sortcmp() with additional
CHARSET_INFO *cmp_charset argument.
This commit is contained in:
unknown
2003-03-04 18:01:59 +04:00
parent 9dfa4eb60a
commit 3cbb978d51
11 changed files with 105 additions and 135 deletions

View File

@ -538,30 +538,14 @@ void String::qs_append(const char &c)
}
int sortcmp(const String *x,const String *y)
int sortcmp(const String *x,const String *y, CHARSET_INFO *cs)
{
CHARSET_INFO *cs= x->str_charset;
return cs->strnncollsp(cs,
(unsigned char *) x->ptr(),x->length(),
(unsigned char *) y->ptr(),y->length());
}
int stringcmp(const String *x,const String *y)
{
const char *s= x->ptr();
const char *t= y->ptr();
uint32 x_len=x->length(),y_len=y->length(),len=min(x_len,y_len);
while (len--)
{
if (*s++ != *t++)
return ((int) (uchar) s[-1] - (int) (uchar) t[-1]);
}
return (int) (x_len-y_len);
}
String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
{
if (from->Alloced_length >= from_length)