diff options
author | unknown <bar@bar.mysql.r18.ru> | 2002-10-09 16:33:35 +0500 |
---|---|---|
committer | unknown <bar@bar.mysql.r18.ru> | 2002-10-09 16:33:35 +0500 |
commit | 1b623a4032eeeb62e42a0f9c21cfe83c02c8ed4f (patch) | |
tree | 734b6bc5368ee742e9647633fa3601ccfaaccf84 | |
parent | edb8ae0f3876d88c2ea8479afdc546ec3a18ea3b (diff) | |
download | mariadb-git-1b623a4032eeeb62e42a0f9c21cfe83c02c8ed4f.tar.gz |
my_sortcmp -> my_strnncoll
BitKeeper/deleted/.del-mf_casecnv.c~c269ed3dcafea441:
Delete: mysys/mf_casecnv.c
-rw-r--r-- | client/mysql.cc | 5 | ||||
-rw-r--r-- | heap/hp_hash.c | 4 | ||||
-rw-r--r-- | include/my_sys.h | 2 | ||||
-rw-r--r-- | libmysql/Makefile.shared | 2 | ||||
-rw-r--r-- | mysys/Makefile.am | 2 | ||||
-rw-r--r-- | mysys/charset.c | 1 | ||||
-rw-r--r-- | mysys/mf_casecnv.c | 67 | ||||
-rw-r--r-- | sql/field.cc | 36 | ||||
-rw-r--r-- | sql/ha_innodb.cc | 6 | ||||
-rw-r--r-- | sql/item_sum.cc | 4 | ||||
-rw-r--r-- | sql/key.cc | 5 |
11 files changed, 44 insertions, 90 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 7341132b8e0..f7da4a963f9 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1396,8 +1396,9 @@ com_go(String *buffer,char *line __attribute__((unused))) (void) com_print(buffer,0); if (skip_updates && - (buffer->length() < 4 || my_sortcmp(system_charset_info,buffer->ptr(), - "SET ",4))) + (buffer->length() < 4 || my_strnncoll(system_charset_info, + (const uchar*)buffer->ptr(),4, + (const uchar*)"SET ",4))) { (void) put_info("Ignoring query to other database",INFO_INFO); return 0; diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 0145e0d503c..b0533e9c7a4 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -401,7 +401,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2) } if (seg->type == HA_KEYTYPE_TEXT) { - if (my_sortcmp(seg->charset,rec1+seg->start,rec2+seg->start,seg->length)) + if (my_strnncoll(seg->charset,rec1+seg->start,seg->length,rec2+seg->start,seg->length)) return 1; } else @@ -433,7 +433,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) } if (seg->type == HA_KEYTYPE_TEXT) { - if (my_sortcmp(seg->charset,rec+seg->start,key,seg->length)) + if (my_strnncoll(seg->charset,rec+seg->start,seg->length,key,seg->length)) return 1; } else diff --git a/include/my_sys.h b/include/my_sys.h index e96543494b4..6545077df72 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -607,8 +607,6 @@ extern my_string my_path(my_string to,const char *progname, extern my_string my_load_path(my_string to, const char *path, const char *own_path_prefix); extern int wild_compare(const char *str,const char *wildstr); -extern int my_sortcmp(CHARSET_INFO *cs, const char *s,const char *t,uint length); -extern int my_sortncmp(CHARSET_INFO *cs, const char *s,uint s_len, const char *t,uint t_len); extern WF_PACK *wf_comp(my_string str); extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern void wf_end(struct wild_file_pack *buffer); diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 0f7cb713d54..26262d9e618 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -49,7 +49,7 @@ dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo mysysheaders = mysys_priv.h my_static.h mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \ - mf_casecnv.lo my_read.lo my_write.lo errors.lo \ + my_read.lo my_write.lo errors.lo \ my_error.lo my_getwd.lo my_div.lo \ mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo\ mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \ diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 8da25ad101a..192b5e7fe37 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -39,7 +39,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ my_symlink.c my_symlink2.c \ mf_pack.c mf_unixpath.c mf_strip.c \ - mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \ + mf_soundex.c mf_wcomp.c mf_wfile.c \ mf_qsort.c mf_qsort2.c mf_sort.c \ ptr_cmp.c mf_radix.c queues.c \ tree.c list.c hash.c array.c string.c typelib.c \ diff --git a/mysys/charset.c b/mysys/charset.c index 48dfad51da9..7d58f7588b4 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -373,6 +373,7 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags) sizeof(tmp_sort_order)); memcpy((char*) cs->tab_to_uni, (char*) tmp_to_uni, sizeof(tmp_to_uni)); + cs->strnncoll = my_strnncoll_simple; cs->caseup_str = my_caseup_str_8bit; cs->casedn_str = my_casedn_str_8bit; cs->caseup = my_caseup_8bit; diff --git a/mysys/mf_casecnv.c b/mysys/mf_casecnv.c deleted file mode 100644 index 26d2e79ee9d..00000000000 --- a/mysys/mf_casecnv.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - Functions to convert to lover_case and to upper_case. -*/ - -#include "mysys_priv.h" -#include <m_ctype.h> -#ifndef SCO -#include <m_string.h> -#endif - - - -int my_sortcmp(CHARSET_INFO *cs, const char *s, const char *t, uint len) -{ -#ifdef USE_STRCOLL - if (use_strnxfrm(cs)) - return my_strnncoll(cs,(uchar *)s, len, (uchar *)t, len); - else -#endif - { - register uchar *map=cs->sort_order; - while (len--) - { - if (map[(uchar) *s++] != map[(uchar) *t++]) - return ((int) map[(uchar) s[-1]] - (int) map[(uchar) t[-1]]); - } - return 0; - } -} - -int my_sortncmp(CHARSET_INFO *cs, - const char *s, uint s_len, - const char *t, uint t_len) -{ -#ifdef USE_STRCOLL - if (use_strnxfrm(cs)) - return my_strnncoll(cs, (uchar *)s, s_len, (uchar *)t, t_len); - else -#endif - { - uint len= min(s_len,t_len); - register uchar *map=cs->sort_order; - - while (len--) - { - if (map[(uchar) *s++] != map[(uchar) *t++]) - return ((int) map[(uchar) s[-1]] - (int) map[(uchar) t[-1]]); - } - return (int) (s_len - t_len); - } -} diff --git a/sql/field.cc b/sql/field.cc index a65e9c4f7a4..cdbe05669d0 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3831,7 +3831,9 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr) if (binary_flag) return memcmp(a_ptr,b_ptr,field_length); else - return my_sortcmp(field_charset,a_ptr,b_ptr,field_length); + return my_strnncoll(field_charset, + (const uchar*)a_ptr,field_length, + (const uchar*)b_ptr,field_length); } void Field_string::sort_string(char *to,uint length) @@ -3907,7 +3909,9 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length) int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); } - return my_sortncmp(field_charset, a,a_length, b,b_length); + return my_strnncoll(field_charset, + (const uchar*)a,a_length, + (const uchar*)b,b_length); } @@ -3924,7 +3928,9 @@ int Field_string::pack_cmp(const char *b, uint length) int cmp= memcmp(ptr,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); } - return my_sortncmp(field_charset, ptr,a_length, b, b_length); + return my_strnncoll(field_charset, + (const uchar*)ptr,a_length, + (const uchar*)b, b_length); } @@ -4033,7 +4039,9 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr) if (binary_flag) diff=memcmp(a_ptr+2,b_ptr+2,min(a_length,b_length)); else - diff=my_sortcmp(field_charset, a_ptr+2,b_ptr+2,min(a_length,b_length)); + diff=my_strnncoll(field_charset, + (const uchar*)a_ptr+2,min(a_length,b_length), + (const uchar*)b_ptr+2,min(a_length,b_length)); return diff ? diff : (int) (a_length - b_length); } @@ -4134,7 +4142,9 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length) int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); } - return my_sortncmp(field_charset, a,a_length, b,b_length); + return my_strnncoll(field_charset, + (const uchar *)a,a_length, + (const uchar *)b,b_length); } int Field_varstring::pack_cmp(const char *b, uint key_length) @@ -4155,7 +4165,9 @@ int Field_varstring::pack_cmp(const char *b, uint key_length) int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); } - return my_sortncmp(field_charset, a,a_length, b,b_length); + return my_strnncoll(field_charset, + (const uchar *)a,a_length, + (const uchar *)b,b_length); } uint Field_varstring::packed_col_length(const char *ptr, uint length) @@ -4382,7 +4394,9 @@ int Field_blob::cmp(const char *a,uint32 a_length, const char *b, if (binary_flag) diff=memcmp(a,b,min(a_length,b_length)); else - diff=my_sortcmp(field_charset, a,b,min(a_length,b_length)); + diff=my_strnncoll(field_charset, + (const uchar*)a,min(a_length,b_length), + (const uchar*)b,min(a_length,b_length)); return diff ? diff : (int) (a_length - b_length); } @@ -4631,7 +4645,9 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length) int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); } - return my_sortncmp(field_charset, a,a_length, b,b_length); + return my_strnncoll(field_charset, + (const uchar *)a,a_length, + (const uchar *)b,b_length); } @@ -4657,7 +4673,9 @@ int Field_blob::pack_cmp(const char *b, uint key_length) int cmp= memcmp(a,b,min(a_length,b_length)); return cmp ? cmp : (int) (a_length - b_length); } - return my_sortncmp(field_charset, a,a_length, b,b_length); + return my_strnncoll(field_charset, + (const uchar *)a,a_length, + (const uchar *)b,b_length); } /* Create a packed key that will be used for storage from a MySQL row */ diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index b684d9dd4dd..02f1d33b1dc 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1366,9 +1366,9 @@ innobase_mysql_cmp( case FIELD_TYPE_VAR_STRING: // BAR TODO: Discuss with heikki.tuuri@innodb.com // so that he sends CHARSET_INFO for the field to this function. - ret = my_sortncmp(default_charset_info, - (const char*) a, a_length, - (const char*) b, b_length); + ret = my_strnncoll(default_charset_info, + a, a_length, + b, b_length); if (ret < 0) { return(-1); } else if (ret > 0) { diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 93ced79005f..4d25098bb88 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -866,7 +866,9 @@ static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2) static int simple_str_key_cmp(void* arg, byte* key1, byte* key2) { /* BAR TODO: remove default_charset_info */ - return my_sortcmp(default_charset_info,(char*) key1, (char*) key2, *(uint*) arg); + return my_strnncoll(default_charset_info, + (const uchar*) key1, *(uint*) arg, + (const uchar*) key2, *(uint*) arg); } /* diff --git a/sql/key.cc b/sql/key.cc index fa09a0a6d44..84669808b92 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -193,8 +193,9 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length) FIELDFLAG_PACK))) { /* BAR TODO: I'm not sure this should be system_charset_info */ - if (my_sortcmp(system_charset_info,(char*) key, - (char*) table->record[0]+key_part->offset,length)) + if (my_strnncoll(system_charset_info, + (const uchar*) key, length, + (const uchar*) table->record[0]+key_part->offset,length)) return 1; } else if (memcmp(key,table->record[0]+key_part->offset,length)) |