Commit 935ac4c2 authored by marko's avatar marko

Merge changes from MySQL AB:

ChangeSet@2007-05-10 12:59:39+03:00, monty@mysql.com 
  WL#3817: Simplify string / memory area types and make things more consistent
  (first part)
  
  The following type conversions was done:
  
  - Changed byte to uchar
  - Changed gptr to uchar*
  - Change my_string to char *
  - Change my_size_t to size_t
  - Change size_s to size_t
  
  Removed declaration of byte, gptr, my_string, my_size_t and size_s. 
[...]
ha_innodb.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Added missing casts for alloc() and printf()
  Removed some not needed casts

ha_innodb.h:
  Removed some old types
parent 3b705b44
...@@ -81,7 +81,7 @@ static handlerton *innodb_hton_ptr; ...@@ -81,7 +81,7 @@ static handlerton *innodb_hton_ptr;
uses unsigned char; the header univ.i which we include next defines uses unsigned char; the header univ.i which we include next defines
'byte' as a macro which expands to 'unsigned char' */ 'byte' as a macro which expands to 'unsigned char' */
typedef byte mysql_byte; typedef uchar mysql_byte;
#define INSIDE_HA_INNOBASE_CC #define INSIDE_HA_INNOBASE_CC
...@@ -163,7 +163,7 @@ static HASH innobase_open_tables; ...@@ -163,7 +163,7 @@ static HASH innobase_open_tables;
bool nw_panic = FALSE; bool nw_panic = FALSE;
#endif #endif
static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length, static mysql_byte* innobase_get_key(INNOBASE_SHARE *share, size_t *length,
my_bool not_used __attribute__((unused))); my_bool not_used __attribute__((unused)));
static INNOBASE_SHARE *get_share(const char *table_name); static INNOBASE_SHARE *get_share(const char *table_name);
static void free_share(INNOBASE_SHARE *share); static void free_share(INNOBASE_SHARE *share);
...@@ -1270,12 +1270,12 @@ innobase_print_identifier( ...@@ -1270,12 +1270,12 @@ innobase_print_identifier(
output strings buffers must not be shared. The function output strings buffers must not be shared. The function
only produces more output when the name contains other only produces more output when the name contains other
characters than [0-9A-Z_a-z]. */ characters than [0-9A-Z_a-z]. */
char* temp_name = my_malloc((uint) namelen + 1, MYF(MY_WME)); char* temp_name = (char*) my_malloc((uint) namelen + 1, MYF(MY_WME));
uint qnamelen = (uint) (namelen uint qnamelen = (uint) (namelen
+ (1 + sizeof srv_mysql50_table_name_prefix)); + (1 + sizeof srv_mysql50_table_name_prefix));
if (temp_name) { if (temp_name) {
qname = my_malloc(qnamelen, MYF(MY_WME)); qname = (char*) my_malloc(qnamelen, MYF(MY_WME));
if (qname) { if (qname) {
memcpy(temp_name, name, namelen); memcpy(temp_name, name, namelen);
temp_name[namelen] = 0; temp_name[namelen] = 0;
...@@ -2425,7 +2425,7 @@ ha_innobase::open( ...@@ -2425,7 +2425,7 @@ ha_innobase::open(
"how you can resolve the problem.\n", "how you can resolve the problem.\n",
norm_name); norm_name);
free_share(share); free_share(share);
my_free((gptr) upd_buff, MYF(0)); my_free(upd_buff, MYF(0));
my_errno = ENOENT; my_errno = ENOENT;
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
...@@ -2442,7 +2442,7 @@ ha_innobase::open( ...@@ -2442,7 +2442,7 @@ ha_innobase::open(
"how you can resolve the problem.\n", "how you can resolve the problem.\n",
norm_name); norm_name);
free_share(share); free_share(share);
my_free((gptr) upd_buff, MYF(0)); my_free(upd_buff, MYF(0));
my_errno = ENOENT; my_errno = ENOENT;
dict_table_decrement_handle_count(ib_table); dict_table_decrement_handle_count(ib_table);
...@@ -2548,7 +2548,7 @@ ha_innobase::close(void) ...@@ -2548,7 +2548,7 @@ ha_innobase::close(void)
row_prebuilt_free(prebuilt); row_prebuilt_free(prebuilt);
my_free((gptr) upd_buff, MYF(0)); my_free(upd_buff, MYF(0));
free_share(share); free_share(share);
/* Tell InnoDB server that there might be work for /* Tell InnoDB server that there might be work for
...@@ -2571,7 +2571,7 @@ get_field_offset( ...@@ -2571,7 +2571,7 @@ get_field_offset(
TABLE* table, /* in: MySQL table object */ TABLE* table, /* in: MySQL table object */
Field* field) /* in: MySQL field object */ Field* field) /* in: MySQL field object */
{ {
return((uint) (field->ptr - (char*) table->record[0])); return((uint) (field->ptr - table->record[0]));
} }
/****************************************************************** /******************************************************************
...@@ -4430,7 +4430,7 @@ ha_innobase::rnd_pos( ...@@ -4430,7 +4430,7 @@ ha_innobase::rnd_pos(
int error; int error;
uint keynr = active_index; uint keynr = active_index;
DBUG_ENTER("rnd_pos"); DBUG_ENTER("rnd_pos");
DBUG_DUMP("key", (char*) pos, ref_length); DBUG_DUMP("key", pos, ref_length);
ha_statistic_increment(&SSV::ha_read_rnd_count); ha_statistic_increment(&SSV::ha_read_rnd_count);
...@@ -4766,7 +4766,7 @@ create_index( ...@@ -4766,7 +4766,7 @@ create_index(
error = convert_error_code_to_mysql(error, NULL); error = convert_error_code_to_mysql(error, NULL);
my_free((gptr) field_lengths, MYF(0)); my_free(field_lengths, MYF(0));
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -5204,7 +5204,7 @@ innobase_drop_database( ...@@ -5204,7 +5204,7 @@ innobase_drop_database(
} }
ptr++; ptr++;
namebuf = my_malloc((uint) len + 2, MYF(0)); namebuf = (char*) my_malloc((uint) len + 2, MYF(0));
memcpy(namebuf, ptr, len); memcpy(namebuf, ptr, len);
namebuf[len] = '/'; namebuf[len] = '/';
...@@ -5402,7 +5402,7 @@ ha_innobase::records_in_range( ...@@ -5402,7 +5402,7 @@ ha_innobase::records_in_range(
dtuple_free_for_mysql(heap1); dtuple_free_for_mysql(heap1);
dtuple_free_for_mysql(heap2); dtuple_free_for_mysql(heap2);
my_free((gptr) key_val_buff2, MYF(0)); my_free(key_val_buff2, MYF(0));
prebuilt->trx->op_info = (char*)""; prebuilt->trx->op_info = (char*)"";
...@@ -5866,7 +5866,7 @@ ha_innobase::update_table_comment( ...@@ -5866,7 +5866,7 @@ ha_innobase::update_table_comment(
/* allocate buffer for the full string, and /* allocate buffer for the full string, and
read the contents of the temporary file */ read the contents of the temporary file */
str = my_malloc(length + flen + 3, MYF(0)); str = (char*) my_malloc(length + flen + 3, MYF(0));
if (str) { if (str) {
char* pos = str + length; char* pos = str + length;
...@@ -5934,7 +5934,7 @@ ha_innobase::get_foreign_key_create_info(void) ...@@ -5934,7 +5934,7 @@ ha_innobase::get_foreign_key_create_info(void)
/* allocate buffer for the string, and /* allocate buffer for the string, and
read the contents of the temporary file */ read the contents of the temporary file */
str = my_malloc(flen + 1, MYF(0)); str = (char*) my_malloc(flen + 1, MYF(0));
if (str) { if (str) {
rewind(srv_dict_tmpfile); rewind(srv_dict_tmpfile);
...@@ -6066,7 +6066,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ...@@ -6066,7 +6066,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
} }
FOREIGN_KEY_INFO *pf_key_info = (FOREIGN_KEY_INFO *) FOREIGN_KEY_INFO *pf_key_info = (FOREIGN_KEY_INFO *)
thd_memdup(thd, (gptr) &f_key_info, sizeof f_key_info); thd_memdup(thd, &f_key_info, sizeof f_key_info);
f_key_list->push_back(pf_key_info); f_key_list->push_back(pf_key_info);
foreign = UT_LIST_GET_NEXT(foreign_list, foreign); foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
} }
...@@ -6607,7 +6607,7 @@ innodb_show_status( ...@@ -6607,7 +6607,7 @@ innodb_show_status(
/* allocate buffer for the string, and /* allocate buffer for the string, and
read the contents of the temporary file */ read the contents of the temporary file */
if (!(str = my_malloc(usable_len + 1, MYF(0)))) { if (!(str = (char*) my_malloc(usable_len + 1, MYF(0)))) {
mutex_exit_noninline(&srv_monitor_file_mutex); mutex_exit_noninline(&srv_monitor_file_mutex);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -6768,7 +6768,7 @@ bool innobase_show_status(handlerton *hton, THD* thd, ...@@ -6768,7 +6768,7 @@ bool innobase_show_status(handlerton *hton, THD* thd,
locking. locking.
****************************************************************************/ ****************************************************************************/
static mysql_byte* innobase_get_key(INNOBASE_SHARE* share, uint* length, static mysql_byte* innobase_get_key(INNOBASE_SHARE* share, size_t *length,
my_bool not_used __attribute__((unused))) my_bool not_used __attribute__((unused)))
{ {
*length=share->table_name_length; *length=share->table_name_length;
...@@ -6796,7 +6796,7 @@ static INNOBASE_SHARE* get_share(const char* table_name) ...@@ -6796,7 +6796,7 @@ static INNOBASE_SHARE* get_share(const char* table_name)
if (my_hash_insert(&innobase_open_tables, if (my_hash_insert(&innobase_open_tables,
(mysql_byte*) share)) { (mysql_byte*) share)) {
pthread_mutex_unlock(&innobase_share_mutex); pthread_mutex_unlock(&innobase_share_mutex);
my_free((gptr) share,0); my_free(share,0);
return 0; return 0;
} }
...@@ -6819,7 +6819,7 @@ static void free_share(INNOBASE_SHARE* share) ...@@ -6819,7 +6819,7 @@ static void free_share(INNOBASE_SHARE* share)
hash_delete(&innobase_open_tables, (mysql_byte*) share); hash_delete(&innobase_open_tables, (mysql_byte*) share);
thr_lock_delete(&share->lock); thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex); pthread_mutex_destroy(&share->mutex);
my_free((gptr) share, MYF(0)); my_free(share, MYF(0));
} }
pthread_mutex_unlock(&innobase_share_mutex); pthread_mutex_unlock(&innobase_share_mutex);
...@@ -7315,9 +7315,8 @@ ha_innobase::cmp_ref( ...@@ -7315,9 +7315,8 @@ ha_innobase::cmp_ref(
ref1 += 2; ref1 += 2;
ref2 += 2; ref2 += 2;
result = ((Field_blob*)field)->cmp( result = ((Field_blob*)field)->cmp( ref1, len1,
(const char*)ref1, len1, ref2, len2);
(const char*)ref2, len2);
} else { } else {
result = field->key_cmp(ref1, ref2); result = field->key_cmp(ref1, ref2);
} }
......
...@@ -47,8 +47,8 @@ class ha_innobase: public handler ...@@ -47,8 +47,8 @@ class ha_innobase: public handler
THR_LOCK_DATA lock; THR_LOCK_DATA lock;
INNOBASE_SHARE *share; INNOBASE_SHARE *share;
byte* upd_buff; /* buffer used in updates */ uchar* upd_buff; /* buffer used in updates */
byte* key_val_buff; /* buffer used in converting uchar* key_val_buff; /* buffer used in converting
search key values from MySQL format search key values from MySQL format
to Innodb format */ to Innodb format */
ulong upd_and_key_val_buff_len; ulong upd_and_key_val_buff_len;
...@@ -65,10 +65,10 @@ class ha_innobase: public handler ...@@ -65,10 +65,10 @@ class ha_innobase: public handler
uint num_write_row; /* number of write_row() calls */ uint num_write_row; /* number of write_row() calls */
uint store_key_val_for_row(uint keynr, char* buff, uint buff_len, uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
const byte* record); const uchar* record);
int update_thd(THD* thd); int update_thd(THD* thd);
int change_active_index(uint keynr); int change_active_index(uint keynr);
int general_fetch(byte* buf, uint direction, uint match_mode); int general_fetch(uchar* buf, uint direction, uint match_mode);
int innobase_read_and_init_auto_inc(longlong* ret); int innobase_read_and_init_auto_inc(longlong* ret);
/* Init values for the class: */ /* Init values for the class: */
...@@ -110,32 +110,32 @@ class ha_innobase: public handler ...@@ -110,32 +110,32 @@ class ha_innobase: public handler
double scan_time(); double scan_time();
double read_time(uint index, uint ranges, ha_rows rows); double read_time(uint index, uint ranges, ha_rows rows);
int write_row(byte * buf); int write_row(uchar * buf);
int update_row(const byte * old_data, byte * new_data); int update_row(const uchar * old_data, uchar * new_data);
int delete_row(const byte * buf); int delete_row(const uchar * buf);
bool was_semi_consistent_read(); bool was_semi_consistent_read();
void try_semi_consistent_read(bool yes); void try_semi_consistent_read(bool yes);
void unlock_row(); void unlock_row();
int index_init(uint index, bool sorted); int index_init(uint index, bool sorted);
int index_end(); int index_end();
int index_read(byte * buf, const byte * key, int index_read(uchar * buf, const uchar * key,
uint key_len, enum ha_rkey_function find_flag); uint key_len, enum ha_rkey_function find_flag);
int index_read_idx(byte * buf, uint index, const byte * key, int index_read_idx(uchar * buf, uint index, const uchar * key,
uint key_len, enum ha_rkey_function find_flag); uint key_len, enum ha_rkey_function find_flag);
int index_read_last(byte * buf, const byte * key, uint key_len); int index_read_last(uchar * buf, const uchar * key, uint key_len);
int index_next(byte * buf); int index_next(uchar * buf);
int index_next_same(byte * buf, const byte *key, uint keylen); int index_next_same(uchar * buf, const uchar *key, uint keylen);
int index_prev(byte * buf); int index_prev(uchar * buf);
int index_first(byte * buf); int index_first(uchar * buf);
int index_last(byte * buf); int index_last(uchar * buf);
int rnd_init(bool scan); int rnd_init(bool scan);
int rnd_end(); int rnd_end();
int rnd_next(byte *buf); int rnd_next(uchar *buf);
int rnd_pos(byte * buf, byte *pos); int rnd_pos(uchar * buf, uchar *pos);
void position(const byte *record); void position(const uchar *record);
int info(uint); int info(uint);
int analyze(THD* thd,HA_CHECK_OPT* check_opt); int analyze(THD* thd,HA_CHECK_OPT* check_opt);
int optimize(THD* thd,HA_CHECK_OPT* check_opt); int optimize(THD* thd,HA_CHECK_OPT* check_opt);
...@@ -145,7 +145,7 @@ class ha_innobase: public handler ...@@ -145,7 +145,7 @@ class ha_innobase: public handler
int external_lock(THD *thd, int lock_type); int external_lock(THD *thd, int lock_type);
int transactional_table_lock(THD *thd, int lock_type); int transactional_table_lock(THD *thd, int lock_type);
int start_stmt(THD *thd, thr_lock_type lock_type); int start_stmt(THD *thd, thr_lock_type lock_type);
void position(byte *record); void position(uchar *record);
ha_rows records_in_range(uint inx, key_range *min_key, key_range ha_rows records_in_range(uint inx, key_range *min_key, key_range
*max_key); *max_key);
ha_rows estimate_rows_upper_bound(); ha_rows estimate_rows_upper_bound();
...@@ -185,7 +185,7 @@ class ha_innobase: public handler ...@@ -185,7 +185,7 @@ class ha_innobase: public handler
static char *get_mysql_bin_log_name(); static char *get_mysql_bin_log_name();
static ulonglong get_mysql_bin_log_pos(); static ulonglong get_mysql_bin_log_pos();
bool primary_key_is_clustered() { return true; } bool primary_key_is_clustered() { return true; }
int cmp_ref(const byte *ref1, const byte *ref2); int cmp_ref(const uchar *ref1, const uchar *ref2);
bool check_if_incompatible_data(HA_CREATE_INFO *info, bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes); uint table_changes);
}; };
......
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