Commit 3facae33 authored by miguel@hegel.local's avatar miguel@hegel.local

Sergei's MyODBC fix

parent 59a00868
...@@ -648,7 +648,7 @@ int main(int argc, char **argv) ...@@ -648,7 +648,7 @@ int main(int argc, char **argv)
exit(EX_MYSQLERR); exit(EX_MYSQLERR);
if (opt_auto_repair && if (opt_auto_repair &&
init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64)) my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64))
{ {
first_error = 1; first_error = 1;
goto end; goto end;
......
...@@ -1948,7 +1948,7 @@ int main(int argc, char** argv) ...@@ -1948,7 +1948,7 @@ int main(int argc, char** argv)
file_stack_end = file_stack + MAX_INCLUDE_DEPTH; file_stack_end = file_stack + MAX_INCLUDE_DEPTH;
cur_file = file_stack; cur_file = file_stack;
lineno = lineno_stack; lineno = lineno_stack;
init_dynamic_array(&q_lines, sizeof(struct st_query*), INIT_Q_LINES, my_init_dynamic_array(&q_lines, sizeof(struct st_query*), INIT_Q_LINES,
INIT_Q_LINES); INIT_Q_LINES);
memset(block_stack, 0, sizeof(block_stack)); memset(block_stack, 0, sizeof(block_stack));
block_stack_end = block_stack + BLOCK_STACK_DEPTH; block_stack_end = block_stack + BLOCK_STACK_DEPTH;
......
...@@ -231,9 +231,9 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf) ...@@ -231,9 +231,9 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf)
static void init_sym_table() static void init_sym_table()
{ {
char buf[512]; char buf[512];
if(init_dynamic_array(&sym_table, sizeof(SYM_ENTRY), INIT_SYM_TABLE, if(my_init_dynamic_array(&sym_table, sizeof(SYM_ENTRY), INIT_SYM_TABLE,
INC_SYM_TABLE)) INC_SYM_TABLE))
die("Failed in init_dynamic_array() -- looks like out of memory problem"); die("Failed in my_init_dynamic_array() -- looks like out of memory problem");
while(fgets(buf, sizeof(buf), fp_sym)) while(fgets(buf, sizeof(buf), fp_sym))
{ {
......
...@@ -549,9 +549,9 @@ extern my_bool real_open_cached_file(IO_CACHE *cache); ...@@ -549,9 +549,9 @@ extern my_bool real_open_cached_file(IO_CACHE *cache);
extern void close_cached_file(IO_CACHE *cache); extern void close_cached_file(IO_CACHE *cache);
File create_temp_file(char *to, const char *dir, const char *pfx, File create_temp_file(char *to, const char *dir, const char *pfx,
int mode, myf MyFlags); int mode, myf MyFlags);
#define init_dynamic_array(A,B,C,D) _init_dynamic_array(A,B,C,D CALLER_INFO) #define my_init_dynamic_array(A,B,C,D) init_dynamic_array(A,B,C,D CALLER_INFO)
#define init_dynamic_array_ci(A,B,C,D) _init_dynamic_array(A,B,C,D ORIG_CALLER_INFO) #define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array(A,B,C,D ORIG_CALLER_INFO)
extern my_bool _init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
uint init_alloc,uint alloc_increment CALLER_INFO_PROTO); uint init_alloc,uint alloc_increment CALLER_INFO_PROTO);
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element); extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element);
extern byte *alloc_dynamic(DYNAMIC_ARRAY *array); extern byte *alloc_dynamic(DYNAMIC_ARRAY *array);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
even if space allocation failed even if space allocation failed
*/ */
my_bool _init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
uint init_alloc, uint alloc_increment CALLER_INFO_PROTO) uint init_alloc, uint alloc_increment CALLER_INFO_PROTO)
{ {
DBUG_ENTER("init_dynamic_array"); DBUG_ENTER("init_dynamic_array");
......
...@@ -130,7 +130,7 @@ static my_bool read_charset_index(CS_ID ***charsets, myf myflags) ...@@ -130,7 +130,7 @@ static my_bool read_charset_index(CS_ID ***charsets, myf myflags)
fb.buf[0] = '\0'; fb.buf[0] = '\0';
fb.p = fb.buf; fb.p = fb.buf;
if (init_dynamic_array(&cs, sizeof(CS_ID *), 32, 32)) if (my_init_dynamic_array(&cs, sizeof(CS_ID *), 32, 32))
return TRUE; return TRUE;
while (!get_word(&fb, buf) && !get_word(&fb, num_buf)) while (!get_word(&fb, buf) && !get_word(&fb, num_buf))
...@@ -188,7 +188,7 @@ static my_bool init_available_charsets(myf myflags) ...@@ -188,7 +188,7 @@ static my_bool init_available_charsets(myf myflags)
pthread_mutex_lock(&THR_LOCK_charset); pthread_mutex_lock(&THR_LOCK_charset);
if (!cs_info_table.buffer) /* If not initialized */ if (!cs_info_table.buffer) /* If not initialized */
{ {
init_dynamic_array(&cs_info_table, sizeof(CHARSET_INFO*), 16, 8); my_init_dynamic_array(&cs_info_table, sizeof(CHARSET_INFO*), 16, 8);
error = read_charset_index(&available_charsets, myflags); error = read_charset_index(&available_charsets, myflags);
} }
charset_initialized=1; charset_initialized=1;
......
...@@ -123,7 +123,7 @@ void load_defaults(const char *conf_file, const char **groups, ...@@ -123,7 +123,7 @@ void load_defaults(const char *conf_file, const char **groups,
for (; *groups ; groups++) for (; *groups ; groups++)
group.count++; group.count++;
if (init_dynamic_array(&args, sizeof(char*),*argc, 32)) if (my_init_dynamic_array(&args, sizeof(char*),*argc, 32))
goto err; goto err;
if (forced_default_file) if (forced_default_file)
{ {
......
...@@ -45,7 +45,7 @@ my_bool _hash_init(HASH *hash,uint size,uint key_offset,uint key_length, ...@@ -45,7 +45,7 @@ my_bool _hash_init(HASH *hash,uint size,uint key_offset,uint key_length,
DBUG_PRINT("enter",("hash: %lx size: %d",hash,size)); DBUG_PRINT("enter",("hash: %lx size: %d",hash,size));
hash->records=0; hash->records=0;
if (init_dynamic_array_ci(&hash->array,sizeof(HASH_LINK),size,0)) if (my_init_dynamic_array_ci(&hash->array,sizeof(HASH_LINK),size,0))
{ {
hash->free=0; /* Allow call to hash_free */ hash->free=0; /* Allow call to hash_free */
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
...@@ -105,7 +105,7 @@ extern "C" { ...@@ -105,7 +105,7 @@ extern "C" {
void init_raid(void) void init_raid(void)
{ {
/* Allocate memory for global file to raid map */ /* Allocate memory for global file to raid map */
init_dynamic_array(&RaidFd::_raid_map, sizeof(RaidFd*), 4096, 1024); my_init_dynamic_array(&RaidFd::_raid_map, sizeof(RaidFd*), 4096, 1024);
} }
void end_raid(void) void end_raid(void)
{ {
......
...@@ -372,14 +372,14 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log) ...@@ -372,14 +372,14 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
error = LOG_INFO_MEM; error = LOG_INFO_MEM;
goto err; goto err;
} }
if (init_dynamic_array(&logs_to_purge, sizeof(char*), 1024, 1024)) if (my_init_dynamic_array(&logs_to_purge, sizeof(char*), 1024, 1024))
{ {
error = LOG_INFO_MEM; error = LOG_INFO_MEM;
goto err; goto err;
} }
logs_to_purge_inited = 1; logs_to_purge_inited = 1;
if (init_dynamic_array(&logs_to_keep, sizeof(char*), 1024, 1024)) if (my_init_dynamic_array(&logs_to_keep, sizeof(char*), 1024, 1024))
{ {
error = LOG_INFO_MEM; error = LOG_INFO_MEM;
goto err; goto err;
......
...@@ -114,7 +114,7 @@ void init_table_rule_hash(HASH* h, bool* h_inited) ...@@ -114,7 +114,7 @@ void init_table_rule_hash(HASH* h, bool* h_inited)
void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited) void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited)
{ {
init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE, my_init_dynamic_array(a, sizeof(TABLE_RULE_ENT*), TABLE_RULE_ARR_SIZE,
TABLE_RULE_ARR_SIZE); TABLE_RULE_ARR_SIZE);
*a_inited = 1; *a_inited = 1;
} }
......
...@@ -158,7 +158,7 @@ int acl_init(bool dont_read_acl_tables) ...@@ -158,7 +158,7 @@ int acl_init(bool dont_read_acl_tables)
init_sql_alloc(&mem,1024,0); init_sql_alloc(&mem,1024,0);
init_read_record(&read_record_info,thd,table= tables[0].table,NULL,1,0); init_read_record(&read_record_info,thd,table= tables[0].table,NULL,1,0);
VOID(init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50)); VOID(my_init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50));
while (!(read_record_info.read_record(&read_record_info))) while (!(read_record_info.read_record(&read_record_info)))
{ {
ACL_HOST host; ACL_HOST host;
...@@ -182,7 +182,7 @@ int acl_init(bool dont_read_acl_tables) ...@@ -182,7 +182,7 @@ int acl_init(bool dont_read_acl_tables)
freeze_size(&acl_hosts); freeze_size(&acl_hosts);
init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0); init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0);
VOID(init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100)); VOID(my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100));
if (table->field[2]->field_length == 8 && if (table->field[2]->field_length == 8 &&
protocol_version == PROTOCOL_VERSION) protocol_version == PROTOCOL_VERSION)
{ {
...@@ -236,7 +236,7 @@ int acl_init(bool dont_read_acl_tables) ...@@ -236,7 +236,7 @@ int acl_init(bool dont_read_acl_tables)
freeze_size(&acl_users); freeze_size(&acl_users);
init_read_record(&read_record_info,thd,table=tables[2].table,NULL,1,0); init_read_record(&read_record_info,thd,table=tables[2].table,NULL,1,0);
VOID(init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100)); VOID(my_init_dynamic_array(&acl_dbs,sizeof(ACL_DB),50,100));
while (!(read_record_info.read_record(&read_record_info))) while (!(read_record_info.read_record(&read_record_info)))
{ {
ACL_DB db; ACL_DB db;
...@@ -688,7 +688,7 @@ int wild_case_compare(const char *str,const char *wildstr) ...@@ -688,7 +688,7 @@ int wild_case_compare(const char *str,const char *wildstr)
static void init_check_host(void) static void init_check_host(void)
{ {
DBUG_ENTER("init_check_host"); DBUG_ENTER("init_check_host");
VOID(init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip), VOID(my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip),
acl_users.elements,1)); acl_users.elements,1));
VOID(hash_init(&acl_check_hosts,acl_users.elements,0,0, VOID(hash_init(&acl_check_hosts,acl_users.elements,0,0,
(hash_get_key) check_get_key,0,HASH_CASE_INSENSITIVE)); (hash_get_key) check_get_key,0,HASH_CASE_INSENSITIVE));
......
...@@ -1462,7 +1462,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, ...@@ -1462,7 +1462,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
join_tab[i].table->map); join_tab[i].table->map);
} }
} }
if (init_dynamic_array(keyuse,sizeof(KEYUSE),20,64)) if (my_init_dynamic_array(keyuse,sizeof(KEYUSE),20,64))
return TRUE; return TRUE;
/* fill keyuse with found key parts */ /* fill keyuse with found key parts */
for (KEY_FIELD *field=key_fields ; field != end ; field++) for (KEY_FIELD *field=key_fields ; field != end ; field++)
......
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