diff options
author | serg@serg.mylan <> | 2004-11-07 22:39:27 +0100 |
---|---|---|
committer | serg@serg.mylan <> | 2004-11-07 22:39:27 +0100 |
commit | f58484fac2796502bbb2b874d436cb73f3dd89b7 (patch) | |
tree | 21cfbec56aed1543b9eb0098b188565895034f18 | |
parent | bb9cc04026719d95ecd5d44d45634e7ecc110dc8 (diff) | |
download | mariadb-git-f58484fac2796502bbb2b874d436cb73f3dd89b7.tar.gz |
s/ha_store_ptr/my_store_ptr/
s/ha_get_ptr/my_get_ptr/
-rw-r--r-- | include/my_sys.h | 2 | ||||
-rw-r--r-- | mysys/ptr_cmp.c | 39 | ||||
-rw-r--r-- | sql/filesort.cc | 2 | ||||
-rw-r--r-- | sql/ha_isam.cc | 6 | ||||
-rw-r--r-- | sql/ha_isammrg.cc | 4 | ||||
-rw-r--r-- | sql/ha_myisam.cc | 6 | ||||
-rw-r--r-- | sql/ha_myisammrg.cc | 4 |
7 files changed, 52 insertions, 11 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index 8d017f2d614..0db661b7781 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -663,6 +663,8 @@ extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size, qsort2_cmp cmp, void *cmp_argument); extern qsort2_cmp get_ptr_compare(uint); +void my_store_ptr(byte *buff, uint pack_length, my_off_t pos); +my_off_t my_get_ptr(byte *ptr, uint pack_length); extern int init_io_cache(IO_CACHE *info,File file,uint cachesize, enum cache_type type,my_off_t seek_offset, pbool use_async_io, myf cache_myflags); diff --git a/mysys/ptr_cmp.c b/mysys/ptr_cmp.c index 5fc7ccab4fa..57778574bb6 100644 --- a/mysys/ptr_cmp.c +++ b/mysys/ptr_cmp.c @@ -21,6 +21,7 @@ */ #include "mysys_priv.h" +#include <myisampack.h> static int ptr_compare(uint *compare_length, uchar **a, uchar **b); static int ptr_compare_0(uint *compare_length, uchar **a, uchar **b); @@ -152,3 +153,41 @@ static int ptr_compare_3(uint *compare_length,uchar **a, uchar **b) } return (0); } + +void my_store_ptr(byte *buff, uint pack_length, my_off_t pos) +{ + switch (pack_length) { +#if SIZEOF_OFF_T > 4 + case 8: mi_int8store(buff,pos); break; + case 7: mi_int7store(buff,pos); break; + case 6: mi_int6store(buff,pos); break; + case 5: mi_int5store(buff,pos); break; +#endif + case 4: mi_int4store(buff,pos); break; + case 3: mi_int3store(buff,pos); break; + case 2: mi_int2store(buff,pos); break; + case 1: buff[0]= (uchar) pos; break; + default: DBUG_ASSERT(0); + } + return; +} + +my_off_t my_get_ptr(byte *ptr, uint pack_length) +{ + my_off_t pos; + switch (pack_length) { +#if SIZEOF_OFF_T > 4 + case 8: pos= (my_off_t) mi_uint8korr(ptr); break; + case 7: pos= (my_off_t) mi_uint7korr(ptr); break; + case 6: pos= (my_off_t) mi_uint6korr(ptr); break; + case 5: pos= (my_off_t) mi_uint5korr(ptr); break; +#endif + case 4: pos= (my_off_t) mi_uint4korr(ptr); break; + case 3: pos= (my_off_t) mi_uint3korr(ptr); break; + case 2: pos= (my_off_t) mi_uint2korr(ptr); break; + case 1: pos= (my_off_t) mi_uint2korr(ptr); break; + default: DBUG_ASSERT(0); + } + return pos; +} + diff --git a/sql/filesort.cc b/sql/filesort.cc index 3e56acefea9..4ca8a2f418c 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -464,7 +464,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, error=file->rnd_next(sort_form->record[0]); if (!flag) { - ha_store_ptr(ref_pos,ref_length,record); // Position to row + my_store_ptr(ref_pos,ref_length,record); // Position to row record+=sort_form->db_record_offset; } else diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc index d703df7d2e3..903f9c46002 100644 --- a/sql/ha_isam.cc +++ b/sql/ha_isam.cc @@ -172,7 +172,7 @@ int ha_isam::rnd_pos(byte * buf, byte *pos) { statistic_increment(current_thd->status_var.ha_read_rnd_count, &LOCK_status); - int error=nisam_rrnd(file, buf, (ulong) ha_get_ptr(pos,ref_length)); + int error=nisam_rrnd(file, buf, (ulong) my_get_ptr(pos,ref_length)); table->status=error ? STATUS_NOT_FOUND: 0; return !error ? 0 : my_errno ? my_errno : -1; } @@ -182,7 +182,7 @@ void ha_isam::position(const byte *record) my_off_t position=nisam_position(file); if (position == (my_off_t) ~ (ulong) 0) position=HA_OFFSET_ERROR; - ha_store_ptr(ref, ref_length, position); + my_store_ptr(ref, ref_length, position); } void ha_isam::info(uint flag) @@ -227,7 +227,7 @@ void ha_isam::info(uint flag) if (flag & HA_STATUS_ERRKEY) { errkey = info.errkey; - ha_store_ptr(dupp_ref, ref_length, info.dupp_key_pos); + my_store_ptr(dupp_ref, ref_length, info.dupp_key_pos); } if (flag & HA_STATUS_TIME) update_time = info.update_time; diff --git a/sql/ha_isammrg.cc b/sql/ha_isammrg.cc index 5a070087724..3d28b7aa4e2 100644 --- a/sql/ha_isammrg.cc +++ b/sql/ha_isammrg.cc @@ -138,7 +138,7 @@ int ha_isammrg::rnd_next(byte *buf) int ha_isammrg::rnd_pos(byte * buf, byte *pos) { statistic_increment(current_thd->status_var.ha_read_rnd_count, &LOCK_status); - int error=mrg_rrnd(file, buf, (ulong) ha_get_ptr(pos,ref_length)); + int error=mrg_rrnd(file, buf, (ulong) my_get_ptr(pos,ref_length)); table->status=error ? STATUS_NOT_FOUND: 0; return !error ? 0 : my_errno ? my_errno : -1; } @@ -146,7 +146,7 @@ int ha_isammrg::rnd_pos(byte * buf, byte *pos) void ha_isammrg::position(const byte *record) { ulong position= mrg_position(file); - ha_store_ptr(ref, ref_length, (my_off_t) position); + my_store_ptr(ref, ref_length, (my_off_t) position); } diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 7482c6d5fa8..8ff67fe95ab 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -1197,7 +1197,7 @@ int ha_myisam::restart_rnd_next(byte *buf, byte *pos) int ha_myisam::rnd_pos(byte * buf, byte *pos) { statistic_increment(current_thd->status_var.ha_read_rnd_count,&LOCK_status); - int error=mi_rrnd(file, buf, ha_get_ptr(pos,ref_length)); + int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length)); table->status=error ? STATUS_NOT_FOUND: 0; return error; } @@ -1205,7 +1205,7 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos) void ha_myisam::position(const byte* record) { my_off_t position=mi_position(file); - ha_store_ptr(ref, ref_length, position); + my_store_ptr(ref, ref_length, position); } void ha_myisam::info(uint flag) @@ -1261,7 +1261,7 @@ void ha_myisam::info(uint flag) if (flag & HA_STATUS_ERRKEY) { errkey = info.errkey; - ha_store_ptr(dupp_ref, ref_length, info.dupp_key_pos); + my_store_ptr(dupp_ref, ref_length, info.dupp_key_pos); } if (flag & HA_STATUS_TIME) update_time = info.update_time; diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 903dd9dec2f..3eadd94bb93 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -190,7 +190,7 @@ int ha_myisammrg::rnd_next(byte *buf) int ha_myisammrg::rnd_pos(byte * buf, byte *pos) { statistic_increment(current_thd->status_var.ha_read_rnd_count,&LOCK_status); - int error=myrg_rrnd(file, buf, ha_get_ptr(pos,ref_length)); + int error=myrg_rrnd(file, buf, my_get_ptr(pos,ref_length)); table->status=error ? STATUS_NOT_FOUND: 0; return error; } @@ -198,7 +198,7 @@ int ha_myisammrg::rnd_pos(byte * buf, byte *pos) void ha_myisammrg::position(const byte *record) { ulonglong position= myrg_position(file); - ha_store_ptr(ref, ref_length, (my_off_t) position); + my_store_ptr(ref, ref_length, (my_off_t) position); } |