summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2015-11-18 19:50:53 +0400
committerSergey Vojtovich <svoj@mariadb.org>2015-11-26 11:34:16 +0400
commit464394bf478a7f3b397ec7045627f827a34c1f09 (patch)
treeb918fc9567dc2ddc87ab93ef84a3ca2d7614ce4c
parent13af8650a82f9452d36fe001c42b0b2c794f98d4 (diff)
downloadmariadb-git-464394bf478a7f3b397ec7045627f827a34c1f09.tar.gz
MDEV-8717 - Obsolete sql_strdup() in favor of THD::strdup() and thd_strdup()
-rw-r--r--sql/sql_table.cc9
-rw-r--r--sql/thr_malloc.cc10
-rw-r--r--sql/thr_malloc.h1
-rw-r--r--storage/archive/ha_archive.cc2
4 files changed, 6 insertions, 16 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 50c9063611f..a165cfdf866 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -63,7 +63,8 @@
const char *primary_key_name="PRIMARY";
static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end);
-static char *make_unique_key_name(const char *field_name,KEY *start,KEY *end);
+static char *make_unique_key_name(THD *thd, const char *field_name, KEY *start,
+ KEY *end);
static int copy_data_between_tables(THD *thd, TABLE *from,TABLE *to,
List<Create_field> &create, bool ignore,
uint order_num, ORDER *order,
@@ -4026,7 +4027,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
primary_key=1;
}
else if (!(key_name= key->name.str))
- key_name=make_unique_key_name(sql_field->field_name,
+ key_name=make_unique_key_name(thd, sql_field->field_name,
*key_info_buffer, key_info);
if (check_if_keyname_exists(key_name, *key_info_buffer, key_info))
{
@@ -5068,7 +5069,7 @@ check_if_keyname_exists(const char *name, KEY *start, KEY *end)
static char *
-make_unique_key_name(const char *field_name,KEY *start,KEY *end)
+make_unique_key_name(THD *thd, const char *field_name,KEY *start,KEY *end)
{
char buff[MAX_FIELD_NAME],*buff_end;
@@ -5086,7 +5087,7 @@ make_unique_key_name(const char *field_name,KEY *start,KEY *end)
*buff_end= '_';
int10_to_str(i, buff_end+1, 10);
if (!check_if_keyname_exists(buff,start,end))
- return sql_strdup(buff);
+ return thd->strdup(buff);
}
return (char*) "not_specified"; // Should never happen
}
diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc
index 4468de69542..f43acd23abc 100644
--- a/sql/thr_malloc.cc
+++ b/sql/thr_malloc.cc
@@ -84,16 +84,6 @@ void *sql_calloc(size_t size)
}
-char *sql_strdup(const char *str)
-{
- size_t len= strlen(str)+1;
- char *pos;
- if ((pos= (char*) sql_alloc(len)))
- memcpy(pos,str,len);
- return pos;
-}
-
-
char *sql_strmake(const char *str, size_t len)
{
char *pos;
diff --git a/sql/thr_malloc.h b/sql/thr_malloc.h
index 4c42baa70d5..97ab7638afd 100644
--- a/sql/thr_malloc.h
+++ b/sql/thr_malloc.h
@@ -24,7 +24,6 @@ void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size,
myf my_flags);
void *sql_alloc(size_t);
void *sql_calloc(size_t);
-char *sql_strdup(const char *str);
char *sql_strmake(const char *str, size_t len);
char *sql_strmake_with_convert(const char *str, size_t arg_length,
CHARSET_INFO *from_cs,
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 93276d2f278..bbce62e0641 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -1645,7 +1645,7 @@ void ha_archive::update_create_info(HA_CREATE_INFO *create_info)
}
if (!(my_readlink(tmp_real_path, share->data_file_name, MYF(0))))
- create_info->data_file_name= sql_strdup(tmp_real_path);
+ create_info->data_file_name= thd_strdup(ha_thd(), tmp_real_path);
DBUG_VOID_RETURN;
}