List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:September 23 2011 9:23am
Subject:bzr push into mysql-trunk branch (tor.didriksen:3448 to 3449)
View as plain text  
 3449 Tor Didriksen	2011-09-23
      Cleanup some min/max usage.
      Fix memory leak of all_early_options.

    modified:
      sql/handler.h
      sql/item_timefunc.h
      sql/mdl.h
      sql/mysqld.cc
      sql/opt_range.h
      sql/spatial.h
 3448 Tor Didriksen	2011-09-22 [merge]
      merge trunk => wl5825

    removed:
      support-files/config.huge.ini.sh
      support-files/config.medium.ini.sh
      support-files/config.small.ini.sh
      support-files/ndb-config-2-node.ini.sh
    modified:
      client/mysqltest.cc
      extra/perror.c
      plugin/auth/qa_auth_interface.c
      storage/innobase/include/srv0mon.h
      storage/innobase/os/os0file.c
      storage/innobase/read/read0read.c
      storage/innobase/trx/trx0purge.c
      support-files/CMakeLists.txt
      tests/mysql_client_test.c
=== modified file 'sql/handler.h'
--- a/sql/handler.h	2011-09-12 13:56:50 +0000
+++ b/sql/handler.h	2011-09-23 09:23:16 +0000
@@ -1987,15 +1987,30 @@ public:
   { return (HA_ERR_WRONG_COMMAND); }
 
   uint max_record_length() const
-  { return std::min<uint>(HA_MAX_REC_LENGTH, max_supported_record_length()); }
+  {
+    using std::min;
+    return min(HA_MAX_REC_LENGTH, max_supported_record_length());
+  }
   uint max_keys() const
-  { return std::min<uint>(MAX_KEY, max_supported_keys()); }
+  {
+    using std::min;
+    return min(MAX_KEY, max_supported_keys());
+  }
   uint max_key_parts() const
-  { return std::min<uint>(MAX_REF_PARTS, max_supported_key_parts()); }
+  {
+    using std::min;
+    return min(MAX_REF_PARTS, max_supported_key_parts());
+  }
   uint max_key_length() const
-  { return std::min<uint>(MAX_KEY_LENGTH, max_supported_key_length()); }
+  {
+    using std::min;
+    return min(MAX_KEY_LENGTH, max_supported_key_length());
+  }
   uint max_key_part_length() const
-  { return std::min<uint>(MAX_KEY_LENGTH, max_supported_key_part_length()); }
+  {
+    using std::min;
+    return min(MAX_KEY_LENGTH, max_supported_key_part_length());
+  }
 
   virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }
   virtual uint max_supported_keys() const { return 0; }

=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h	2011-08-30 12:57:45 +0000
+++ b/sql/item_timefunc.h	2011-09-23 09:23:16 +0000
@@ -19,6 +19,8 @@
 
 /* Function items used by mysql */
 
+#include <algorithm>
+
 class MY_LOCALE;
 
 enum date_time_format_types 
@@ -96,9 +98,10 @@ public:
 
   bool intro_version(uchar *int_arg)
   {
+    using std::max;
     int *input_version= (int*)int_arg;
     /* This function was introduced in 5.5 */
-    int output_version= std::max<int>(*input_version, 50500);
+    int output_version= max(*input_version, 50500);
     *input_version= output_version;
     return 0;
   }

=== modified file 'sql/mdl.h'
--- a/sql/mdl.h	2011-08-30 12:57:45 +0000
+++ b/sql/mdl.h	2011-09-23 09:23:16 +0000
@@ -350,7 +350,8 @@ public:
       character set is utf-8, we can safely assume that no
       character starts with a zero byte.
     */
-    return memcmp(m_ptr, rhs->m_ptr, std::min<uint16>(m_length, rhs->m_length));
+    using std::min;
+    return memcmp(m_ptr, rhs->m_ptr, min(m_length, rhs->m_length));
   }
 
   MDL_key(const MDL_key *rhs)

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-09-22 07:48:56 +0000
+++ b/sql/mysqld.cc	2011-09-23 09:23:16 +0000
@@ -4694,7 +4694,9 @@ int mysqld_main(int argc, char **argv)
 
   ho_error= handle_options(&remaining_argc, &remaining_argv,
                            &all_early_options[0], NULL);
-  all_early_options.clear();
+  // Swap with an empty vector, i.e. delete elements and free allocated space.
+  vector<my_option>().swap(all_early_options);
+
   if (ho_error == 0)
   {
     /* Add back the program name handle_options removes */

=== modified file 'sql/opt_range.h'
--- a/sql/opt_range.h	2011-08-30 12:57:45 +0000
+++ b/sql/opt_range.h	2011-09-23 09:23:16 +0000
@@ -94,8 +94,9 @@ class QUICK_RANGE :public Sql_alloc {
   */
   void make_min_endpoint(key_range *kr, uint prefix_length, 
                          key_part_map keypart_map) {
+    using std::min;
     make_min_endpoint(kr);
-    kr->length= std::min<uint>(kr->length, prefix_length);
+    kr->length= min(kr->length, prefix_length);
     kr->keypart_map&= keypart_map;
   }
   
@@ -132,8 +133,9 @@ class QUICK_RANGE :public Sql_alloc {
   */
   void make_max_endpoint(key_range *kr, uint prefix_length, 
                          key_part_map keypart_map) {
+    using std::min;
     make_max_endpoint(kr);
-    kr->length= std::min<uint>(kr->length, prefix_length);
+    kr->length= min(kr->length, prefix_length);
     kr->keypart_map&= keypart_map;
   }
 

=== modified file 'sql/spatial.h'
--- a/sql/spatial.h	2011-08-30 12:57:45 +0000
+++ b/sql/spatial.h	2011-09-23 09:23:16 +0000
@@ -187,10 +187,10 @@ struct MBR
     if (d != mbr->dimension() || d <= 0 || contains(mbr) || within(mbr))
       return 0;
 
-    MBR intersection(std::max<double>(xmin, mbr->xmin),
-                     std::max<double>(ymin, mbr->ymin),
-                     std::min<double>(xmax, mbr->xmax),
-                     std::min<double>(ymax, mbr->ymax));
+    using std::min;
+    using std::max;
+    MBR intersection(max(xmin, mbr->xmin), max(ymin, mbr->ymin),
+                     min(xmax, mbr->xmax), min(ymax, mbr->ymax));
 
     return (d == intersection.dimension());
   }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (tor.didriksen:3448 to 3449) Tor Didriksen23 Sep