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:
@ -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)
|
||||
|
Reference in New Issue
Block a user