summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_berkeley.cc4
-rw-r--r--sql/hostname.cc15
-rw-r--r--sql/item.cc2
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/password.c2
-rw-r--r--sql/slave.cc12
-rw-r--r--sql/sql_acl.cc2
-rw-r--r--sql/sql_base.cc5
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/sql_repl.cc2
-rw-r--r--sql/sql_table.cc1
11 files changed, 28 insertions, 23 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 0c5f09c4b36..944b335016e 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -247,9 +247,9 @@ int berkeley_show_logs(THD *thd)
my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root);
if ((error= log_archive(db_env, &all_logs, DB_ARCH_ABS | DB_ARCH_LOG,
- (void* (*)(unsigned int)) sql_alloc)) ||
+ (void* (*)(size_t)) sql_alloc)) ||
(error= log_archive(db_env, &free_logs, DB_ARCH_ABS,
- (void* (*)(unsigned int)) sql_alloc)))
+ (void* (*)(size_t)) sql_alloc)))
{
DBUG_PRINT("error", ("log_archive failed (error %d)", error));
db_env->err(db_env, error, "log_archive: DB_ARCH_ABS");
diff --git a/sql/hostname.cc b/sql/hostname.cc
index fcf8d2753b8..90938c41ee9 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -48,6 +48,7 @@ public:
};
static hash_filo *hostname_cache;
+static pthread_mutex_t LOCK_hostname;
void hostname_cache_refresh()
{
@@ -56,6 +57,7 @@ void hostname_cache_refresh()
bool hostname_cache_init()
{
+ (void) pthread_mutex_init(&LOCK_hostname,NULL);
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE,offsetof(host_entry,ip),
sizeof(struct in_addr),NULL,
(void (*)(void*)) free)))
@@ -66,6 +68,7 @@ bool hostname_cache_init()
void hostname_cache_free()
{
+ (void) pthread_mutex_destroy(&LOCK_hostname);
delete hostname_cache;
}
@@ -97,7 +100,7 @@ static void add_hostname(struct in_addr *in,const char *name)
}
-static inline void add_wrong_ip(struct in_addr *in)
+inline void add_wrong_ip(struct in_addr *in)
{
add_hostname(in,NullS);
}
@@ -180,26 +183,26 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
DBUG_RETURN(0); // out of memory
#else
- VOID(pthread_mutex_lock(&hostname_cache->lock));
+ VOID(pthread_mutex_lock(&LOCK_hostname));
if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))
{
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ VOID(pthread_mutex_unlock(&LOCK_hostname));
DBUG_PRINT("error",("gethostbyaddr returned %d",errno));
goto err;
}
if (!hp->h_name[0]) // Don't allow empty hostnames
{
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ VOID(pthread_mutex_unlock(&LOCK_hostname));
DBUG_PRINT("error",("Got an empty hostname"));
goto err;
}
if (!(name=my_strdup(hp->h_name,MYF(0))))
{
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ VOID(pthread_mutex_unlock(&LOCK_hostname));
DBUG_RETURN(0); // out of memory
}
check=gethostbyname(name);
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ VOID(pthread_mutex_unlock(&LOCK_hostname));
if (!check)
{
DBUG_PRINT("error",("gethostbyname returned %d",errno));
diff --git a/sql/item.cc b/sql/item.cc
index db4ce792b27..10d1c6d0560 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -471,7 +471,7 @@ bool Item_real::save_in_field(Field *field)
** In number context this is a longlong value.
****************************************************************************/
-static inline uint char_val(char X)
+inline uint char_val(char X)
{
return (uint) (X >= '0' && X <= '9' ? X-'0' :
X >= 'A' && X <= 'Z' ? X-'A'+10 :
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 34c2922da60..5e7abd5d9a7 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -74,7 +74,7 @@ typedef my_bool ALARM;
#define thr_alarm_in_use(A) (*(A))
#define thr_end_alarm(A)
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
-static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
+inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
{
*A=1;
return 0;
diff --git a/sql/password.c b/sql/password.c
index 63ab9def651..1c88aabcce2 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -91,7 +91,7 @@ void make_scrambled_password(char *to,const char *password)
sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]);
}
-static inline uint char_val(char X)
+inline uint char_val(char X)
{
return (uint) (X >= '0' && X <= '9' ? X-'0' :
X >= 'A' && X <= 'Z' ? X-'A'+10 :
diff --git a/sql/slave.cc b/sql/slave.cc
index 58d1d173968..22d76c54ecd 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -48,8 +48,8 @@ static int stuck_count = 0;
#endif
-static inline void skip_load_data_infile(NET* net);
-static inline bool slave_killed(THD* thd);
+inline void skip_load_data_infile(NET* net);
+inline bool slave_killed(THD* thd);
static int init_slave_thread(THD* thd);
static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi);
static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi);
@@ -57,7 +57,7 @@ static int safe_sleep(THD* thd, int sec);
static int request_table_dump(MYSQL* mysql, char* db, char* table);
static int create_table_from_dump(THD* thd, NET* net, const char* db,
const char* table_name);
-static inline char* rewrite_db(char* db);
+inline char* rewrite_db(char* db);
static void free_table_ent(TABLE_RULE_ENT* e)
{
my_free((gptr) e, MYF(0));
@@ -197,12 +197,12 @@ void end_slave()
free_string_array(&replicate_wild_ignore_table);
}
-static inline bool slave_killed(THD* thd)
+inline bool slave_killed(THD* thd)
{
return abort_slave || abort_loop || thd->killed;
}
-static inline void skip_load_data_infile(NET* net)
+inline void skip_load_data_infile(NET* net)
{
(void)my_net_write(net, "\xfb/dev/null", 10);
(void)net_flush(net);
@@ -210,7 +210,7 @@ static inline void skip_load_data_infile(NET* net)
send_ok(net); // the master expects it
}
-static inline char* rewrite_db(char* db)
+inline char* rewrite_db(char* db)
{
if(replicate_rewrite_db.is_empty() || !db) return db;
I_List_iterator<i_string_pair> it(replicate_rewrite_db);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 2317c896dfd..0f3ee483400 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1287,7 +1287,7 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
-static inline GRANT_COLUMN *
+inline GRANT_COLUMN *
column_hash_search(GRANT_TABLE *t, const char *cname,
uint length)
{
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 28f509d3c81..96d6ea660aa 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -187,7 +187,8 @@ query_table_status(THD *thd,const char *db,const char *table_name)
** Sum fields has table name empty and field_name.
** flag is a bit mask with the following functions:
** 1 send number of rows
-** 2 send default values; Don't convert field names
+** 2 send default values
+** 4 Don't convert field names
******************************************************************************/
bool
@@ -196,7 +197,7 @@ send_fields(THD *thd,List<Item> &list,uint flag)
List_iterator<Item> it(list);
Item *item;
char buff[80];
- CONVERT *convert= (flag & 2) ? (CONVERT*) 0 : thd->convert_set;
+ CONVERT *convert= (flag & 4) ? (CONVERT*) 0 : thd->convert_set;
String tmp((char*) buff,sizeof(buff)),*res,*packet= &thd->packet;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a43b10e9ad0..495b00217ef 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -71,7 +71,7 @@ static void init_signals(void)
}
#endif
-static inline bool end_active_trans(THD *thd)
+inline bool end_active_trans(THD *thd)
{
int error=0;
if (thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN))
@@ -496,7 +496,7 @@ end:
}
-static inline void free_items(THD *thd)
+inline void free_items(THD *thd)
{
/* This works because items are allocated with sql_alloc() */
for (Item *item=thd->free_list ; item ; item=item->next)
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index edf4727c2f1..4f0112bac26 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -237,7 +237,7 @@ binlog purge"; break;
break;
case LOG_INFO_MEM: errmsg = "Out of memory"; break;
case LOG_INFO_FATAL: errmsg = "Fatal error during purge"; break;
- case LOG_INFO_IN_USE: errmsg = "A purgable log is in use, will not purge";
+ case LOG_INFO_IN_USE: errmsg = "A purgeable log is in use, will not purge";
break;
default:
errmsg = "Unknown error during purge"; break;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 3e1a0eb9fa1..a666fa26545 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1690,6 +1690,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
found_count++;
}
end_read_record(&info);
+ free_io_cache(from);
delete [] copy;
uint tmp_error;
if ((tmp_error=to->file->extra(HA_EXTRA_NO_CACHE)))