[Commits] 69684af: MDEV-8719 - Obsolete sql_memdup() in favor of THD::memdup() and thd_memdup()

Sergey Vojtovich svoj at mariadb.org
Wed Nov 18 17:22:56 EET 2015


revision-id: 69684af19caa3cc7d9b42ccd1f7a19ddca2671f3 (mariadb-10.1.8-50-g69684af)
parent(s): a55cb5c1d1547f66b10d90efd012cb909653d1a7
committer: Sergey Vojtovich
timestamp: 2015-11-18 19:21:30 +0400
message:

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

---
 sql/opt_range.h       | 1 -
 sql/partition_info.cc | 6 +++---
 sql/partition_info.h  | 2 +-
 sql/sql_yacc.yy       | 4 ++--
 sql/thr_malloc.cc     | 9 ---------
 sql/thr_malloc.h      | 1 -
 6 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/sql/opt_range.h b/sql/opt_range.h
index 0c49563..80f4064 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -24,7 +24,6 @@
 #pragma interface			/* gcc class implementation */
 #endif
 
-#include "thr_malloc.h"                         /* sql_memdup */
 #include "records.h"                            /* READ_RECORD */
 #include "queues.h"                             /* QUEUE */
 /*
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index a92c768..36bb251 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -1940,11 +1940,11 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
     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)
 {
   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)
   {
@@ -3153,7 +3153,7 @@ part_column_list_val *partition_info::add_column_value(THD *thd)
   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)
 {
   (void)start_token;
diff --git a/sql/partition_info.h b/sql/partition_info.h
index df7010b..c58fa8b 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -332,7 +332,7 @@ class partition_info : public Sql_alloc
   void init_col_val(part_column_list_val *col_val, Item *item);
   int reorganize_into_single_field_col_val(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);
   static int compare_column_values(const void *a, const void *b);
   bool set_up_charset_field_preps(THD *thd);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index bd2adc3..5cc905e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -5052,7 +5052,7 @@ part_func:
           '(' remember_name part_func_expr remember_end ')'
           {
             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; }
             part_info->num_columns= 1;
             part_info->column_list= FALSE;
@@ -5062,7 +5062,7 @@ part_func:
 sub_part_func:
           '(' 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; }
           }
         ;
diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc
index b82d29e..4468de6 100644
--- a/sql/thr_malloc.cc
+++ b/sql/thr_malloc.cc
@@ -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,
 			       CHARSET_INFO *from_cs,
 			       size_t max_res_length,
diff --git a/sql/thr_malloc.h b/sql/thr_malloc.h
index 0b17c5c..4c42baa 100644
--- a/sql/thr_malloc.h
+++ b/sql/thr_malloc.h
@@ -26,7 +26,6 @@ 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);
-void *sql_memdup(const void * ptr, size_t size);
 char *sql_strmake_with_convert(const char *str, size_t arg_length,
 			       CHARSET_INFO *from_cs,
 			       size_t max_res_length,


More information about the commits mailing list