Commit 13af8650 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-8719 - Obsolete sql_memdup() in favor of THD::memdup() and thd_memdup()

parent 55e67c3e
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
#include "thr_malloc.h" /* sql_memdup */
#include "records.h" /* READ_RECORD */ #include "records.h" /* READ_RECORD */
#include "queues.h" /* QUEUE */ #include "queues.h" /* QUEUE */
/* /*
......
...@@ -1940,11 +1940,11 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag) ...@@ -1940,11 +1940,11 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
FALSE Success FALSE Success
*/ */
bool partition_info::set_part_expr(char *start_token, Item *item_ptr, bool partition_info::set_part_expr(THD *thd, char *start_token, Item *item_ptr,
char *end_token, bool is_subpart) char *end_token, bool is_subpart)
{ {
uint expr_len= end_token - start_token; uint expr_len= end_token - start_token;
char *func_string= (char*) sql_memdup(start_token, expr_len); char *func_string= (char*) thd->memdup(start_token, expr_len);
if (!func_string) if (!func_string)
{ {
...@@ -3153,7 +3153,7 @@ part_column_list_val *partition_info::add_column_value(THD *thd) ...@@ -3153,7 +3153,7 @@ part_column_list_val *partition_info::add_column_value(THD *thd)
return NULL; return NULL;
} }
bool partition_info::set_part_expr(char *start_token, Item *item_ptr, bool partition_info::set_part_expr(THD *thd, char *start_token, Item *item_ptr,
char *end_token, bool is_subpart) char *end_token, bool is_subpart)
{ {
(void)start_token; (void)start_token;
......
...@@ -332,7 +332,7 @@ class partition_info : public Sql_alloc ...@@ -332,7 +332,7 @@ class partition_info : public Sql_alloc
void init_col_val(part_column_list_val *col_val, Item *item); void init_col_val(part_column_list_val *col_val, Item *item);
int reorganize_into_single_field_col_val(THD *thd); int reorganize_into_single_field_col_val(THD *thd);
part_column_list_val *add_column_value(THD *thd); part_column_list_val *add_column_value(THD *thd);
bool set_part_expr(char *start_token, Item *item_ptr, bool set_part_expr(THD *thd, char *start_token, Item *item_ptr,
char *end_token, bool is_subpart); char *end_token, bool is_subpart);
static int compare_column_values(const void *a, const void *b); static int compare_column_values(const void *a, const void *b);
bool set_up_charset_field_preps(THD *thd); bool set_up_charset_field_preps(THD *thd);
......
...@@ -5055,7 +5055,7 @@ part_func: ...@@ -5055,7 +5055,7 @@ part_func:
'(' remember_name part_func_expr remember_end ')' '(' remember_name part_func_expr remember_end ')'
{ {
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
if (part_info->set_part_expr($2+1, $3, $4, FALSE)) if (part_info->set_part_expr(thd, $2 + 1, $3, $4, FALSE))
{ MYSQL_YYABORT; } { MYSQL_YYABORT; }
part_info->num_columns= 1; part_info->num_columns= 1;
part_info->column_list= FALSE; part_info->column_list= FALSE;
...@@ -5065,7 +5065,7 @@ part_func: ...@@ -5065,7 +5065,7 @@ part_func:
sub_part_func: sub_part_func:
'(' remember_name part_func_expr remember_end ')' '(' remember_name part_func_expr remember_end ')'
{ {
if (Lex->part_info->set_part_expr($2+1, $3, $4, TRUE)) if (Lex->part_info->set_part_expr(thd, $2 + 1, $3, $4, TRUE))
{ MYSQL_YYABORT; } { MYSQL_YYABORT; }
} }
; ;
......
...@@ -106,15 +106,6 @@ char *sql_strmake(const char *str, size_t len) ...@@ -106,15 +106,6 @@ char *sql_strmake(const char *str, size_t len)
} }
void* sql_memdup(const void *ptr, size_t len)
{
void *pos;
if ((pos= sql_alloc(len)))
memcpy(pos,ptr,len);
return pos;
}
char *sql_strmake_with_convert(const char *str, size_t arg_length, char *sql_strmake_with_convert(const char *str, size_t arg_length,
CHARSET_INFO *from_cs, CHARSET_INFO *from_cs,
size_t max_res_length, size_t max_res_length,
......
...@@ -26,7 +26,6 @@ void *sql_alloc(size_t); ...@@ -26,7 +26,6 @@ void *sql_alloc(size_t);
void *sql_calloc(size_t); void *sql_calloc(size_t);
char *sql_strdup(const char *str); char *sql_strdup(const char *str);
char *sql_strmake(const char *str, size_t len); char *sql_strmake(const char *str, size_t len);
void *sql_memdup(const void * ptr, size_t size);
char *sql_strmake_with_convert(const char *str, size_t arg_length, char *sql_strmake_with_convert(const char *str, size_t arg_length,
CHARSET_INFO *from_cs, CHARSET_INFO *from_cs,
size_t max_res_length, size_t max_res_length,
......
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