Commit eba2f5bc authored by unknown's avatar unknown

s/ha_store_ptr/my_store_ptr/

s/ha_get_ptr/my_get_ptr/

parent cce44b14
...@@ -663,6 +663,8 @@ extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, ...@@ -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, extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size,
qsort2_cmp cmp, void *cmp_argument); qsort2_cmp cmp, void *cmp_argument);
extern qsort2_cmp get_ptr_compare(uint); 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, extern int init_io_cache(IO_CACHE *info,File file,uint cachesize,
enum cache_type type,my_off_t seek_offset, enum cache_type type,my_off_t seek_offset,
pbool use_async_io, myf cache_myflags); pbool use_async_io, myf cache_myflags);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include "mysys_priv.h" #include "mysys_priv.h"
#include <myisampack.h>
static int ptr_compare(uint *compare_length, uchar **a, uchar **b); static int ptr_compare(uint *compare_length, uchar **a, uchar **b);
static int ptr_compare_0(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) ...@@ -152,3 +153,41 @@ static int ptr_compare_3(uint *compare_length,uchar **a, uchar **b)
} }
return (0); 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;
}
...@@ -464,7 +464,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, ...@@ -464,7 +464,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
error=file->rnd_next(sort_form->record[0]); error=file->rnd_next(sort_form->record[0]);
if (!flag) 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; record+=sort_form->db_record_offset;
} }
else else
......
...@@ -172,7 +172,7 @@ int ha_isam::rnd_pos(byte * buf, byte *pos) ...@@ -172,7 +172,7 @@ int ha_isam::rnd_pos(byte * buf, byte *pos)
{ {
statistic_increment(current_thd->status_var.ha_read_rnd_count, statistic_increment(current_thd->status_var.ha_read_rnd_count,
&LOCK_status); &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; table->status=error ? STATUS_NOT_FOUND: 0;
return !error ? 0 : my_errno ? my_errno : -1; return !error ? 0 : my_errno ? my_errno : -1;
} }
...@@ -182,7 +182,7 @@ void ha_isam::position(const byte *record) ...@@ -182,7 +182,7 @@ void ha_isam::position(const byte *record)
my_off_t position=nisam_position(file); my_off_t position=nisam_position(file);
if (position == (my_off_t) ~ (ulong) 0) if (position == (my_off_t) ~ (ulong) 0)
position=HA_OFFSET_ERROR; position=HA_OFFSET_ERROR;
ha_store_ptr(ref, ref_length, position); my_store_ptr(ref, ref_length, position);
} }
void ha_isam::info(uint flag) void ha_isam::info(uint flag)
...@@ -227,7 +227,7 @@ void ha_isam::info(uint flag) ...@@ -227,7 +227,7 @@ void ha_isam::info(uint flag)
if (flag & HA_STATUS_ERRKEY) if (flag & HA_STATUS_ERRKEY)
{ {
errkey = info.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) if (flag & HA_STATUS_TIME)
update_time = info.update_time; update_time = info.update_time;
......
...@@ -138,7 +138,7 @@ int ha_isammrg::rnd_next(byte *buf) ...@@ -138,7 +138,7 @@ int ha_isammrg::rnd_next(byte *buf)
int ha_isammrg::rnd_pos(byte * buf, byte *pos) int ha_isammrg::rnd_pos(byte * buf, byte *pos)
{ {
statistic_increment(current_thd->status_var.ha_read_rnd_count, &LOCK_status); 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; table->status=error ? STATUS_NOT_FOUND: 0;
return !error ? 0 : my_errno ? my_errno : -1; return !error ? 0 : my_errno ? my_errno : -1;
} }
...@@ -146,7 +146,7 @@ int ha_isammrg::rnd_pos(byte * buf, byte *pos) ...@@ -146,7 +146,7 @@ int ha_isammrg::rnd_pos(byte * buf, byte *pos)
void ha_isammrg::position(const byte *record) void ha_isammrg::position(const byte *record)
{ {
ulong position= mrg_position(file); 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);
} }
......
...@@ -1197,7 +1197,7 @@ int ha_myisam::restart_rnd_next(byte *buf, byte *pos) ...@@ -1197,7 +1197,7 @@ int ha_myisam::restart_rnd_next(byte *buf, byte *pos)
int ha_myisam::rnd_pos(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); 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; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
} }
...@@ -1205,7 +1205,7 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos) ...@@ -1205,7 +1205,7 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos)
void ha_myisam::position(const byte* record) void ha_myisam::position(const byte* record)
{ {
my_off_t position=mi_position(file); 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) void ha_myisam::info(uint flag)
...@@ -1261,7 +1261,7 @@ void ha_myisam::info(uint flag) ...@@ -1261,7 +1261,7 @@ void ha_myisam::info(uint flag)
if (flag & HA_STATUS_ERRKEY) if (flag & HA_STATUS_ERRKEY)
{ {
errkey = info.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) if (flag & HA_STATUS_TIME)
update_time = info.update_time; update_time = info.update_time;
......
...@@ -190,7 +190,7 @@ int ha_myisammrg::rnd_next(byte *buf) ...@@ -190,7 +190,7 @@ int ha_myisammrg::rnd_next(byte *buf)
int ha_myisammrg::rnd_pos(byte * buf, byte *pos) int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
{ {
statistic_increment(current_thd->status_var.ha_read_rnd_count,&LOCK_status); 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; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
} }
...@@ -198,7 +198,7 @@ int ha_myisammrg::rnd_pos(byte * buf, byte *pos) ...@@ -198,7 +198,7 @@ int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
void ha_myisammrg::position(const byte *record) void ha_myisammrg::position(const byte *record)
{ {
ulonglong position= myrg_position(file); 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);
} }
......
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