summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-01-15 16:41:10 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-01-15 16:41:10 +0200
commit39f236a2f532fc3364c5594739ef74489fb24478 (patch)
treefee7537c649aa02213d98c81381c50133bec439f /sql
parent68e5d6a9416b2923e78123cbc67e1755b8a21806 (diff)
parent9c6fc7b644da912a0e68c720f2234a8554bbfeb9 (diff)
downloadmariadb-git-39f236a2f532fc3364c5594739ef74489fb24478.tar.gz
Merge 10.2 into bb-10.2-ext
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/item_sum.cc4
-rw-r--r--sql/key.cc20
-rw-r--r--sql/log.cc2
-rw-r--r--sql/log_event.cc6
-rw-r--r--sql/mdl.h5
6 files changed, 16 insertions, 23 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index a6134c009d5..7368aebcadf 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2723,7 +2723,7 @@ bool Item_func_min_max::get_date_native(MYSQL_TIME *ltime, ulonglong fuzzy_date)
ltime->hour+= (ltime->month * 32 + ltime->day) * 24;
ltime->year= ltime->month= ltime->day= 0;
if (adjust_time_range_with_warn(ltime,
- std::min<uint>(decimals, TIME_SECOND_PART_DIGITS)))
+ MY_MIN(decimals, TIME_SECOND_PART_DIGITS)))
return (null_value= true);
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 23e63f709cd..234e9dad0b3 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -2211,7 +2211,7 @@ bool Item_sum_bit::remove_as_window(ulonglong value)
}
// Prevent overflow;
- num_values_added = std::min(num_values_added, num_values_added - 1);
+ num_values_added = MY_MIN(num_values_added, num_values_added - 1);
set_bits_from_counters();
return 0;
}
@@ -2224,7 +2224,7 @@ bool Item_sum_bit::add_as_window(ulonglong value)
bit_counters[i]+= (value & (1ULL << i)) ? 1 : 0;
}
// Prevent overflow;
- num_values_added = std::max(num_values_added, num_values_added + 1);
+ num_values_added = MY_MAX(num_values_added, num_values_added + 1);
set_bits_from_counters();
return 0;
}
diff --git a/sql/key.cc b/sql/key.cc
index db44e4780c4..14d29e8b125 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,9 +22,6 @@
#include "key.h" // key_rec_cmp
#include "field.h" // Field
-using std::min;
-using std::max;
-
/*
Search after a key that starts with 'field'
@@ -135,7 +133,7 @@ void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info,
Don't copy data for null values
The -1 below is to subtract the null byte which is already handled
*/
- length= min<uint>(key_length, key_part->store_length-1);
+ length= MY_MIN(key_length, uint(key_part->store_length)-1);
if (with_zerofill)
bzero((char*) to_key, length);
continue;
@@ -145,7 +143,7 @@ void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info,
key_part->key_part_flag & HA_VAR_LENGTH_PART)
{
key_length-= HA_KEY_BLOB_LENGTH;
- length= min<uint>(key_length, key_part->length);
+ length= MY_MIN(key_length, key_part->length);
uint bytes= key_part->field->get_key_image(to_key, length, Field::itRAW);
if (with_zerofill && bytes < length)
bzero((char*) to_key + bytes, length - bytes);
@@ -153,7 +151,7 @@ void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info,
}
else
{
- length= min<uint>(key_length, key_part->length);
+ length= MY_MIN(key_length, key_part->length);
Field *field= key_part->field;
CHARSET_INFO *cs= field->charset();
uint bytes= field->get_key_image(to_key, length, Field::itRAW);
@@ -205,7 +203,7 @@ void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info,
Don't copy data for null bytes
The -1 below is to subtract the null byte which is already handled
*/
- length= min<uint>(key_length, key_part->store_length-1);
+ length= MY_MIN(key_length, uint(key_part->store_length)-1);
continue;
}
}
@@ -247,7 +245,7 @@ void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info,
my_ptrdiff_t ptrdiff= to_record - field->table->record[0];
field->move_field_offset(ptrdiff);
key_length-= HA_KEY_BLOB_LENGTH;
- length= min<uint>(key_length, key_part->length);
+ length= MY_MIN(key_length, key_part->length);
old_map= dbug_tmp_use_all_columns(field->table, field->table->write_set);
field->set_key_image(from_key, length);
dbug_tmp_restore_column_map(field->table->write_set, old_map);
@@ -256,7 +254,7 @@ void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info,
}
else
{
- length= min<uint>(key_length, key_part->length);
+ length= MY_MIN(key_length, key_part->length);
/* skip the byte with 'uneven' bits, if used */
memcpy(to_record + key_part->offset, from_key + used_uneven_bits
, (size_t) length - used_uneven_bits);
@@ -314,7 +312,7 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
return 1;
continue;
}
- length= min((uint) (key_end-key), store_length);
+ length= MY_MIN((uint) (key_end-key), store_length);
if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+
FIELDFLAG_PACK)))
{
@@ -392,7 +390,7 @@ void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
tmp.length(charpos);
}
if (max_length < field->pack_length())
- tmp.length(min(tmp.length(),max_length));
+ tmp.length(MY_MIN(tmp.length(),max_length));
ErrConvString err(&tmp);
to->append(err.ptr());
}
diff --git a/sql/log.cc b/sql/log.cc
index e632fe629f5..62d98b9c0da 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -7083,7 +7083,7 @@ int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
int4store(ev + EVENT_LEN_OFFSET, ev_len + writer.checksum_len);
writer.remains= ev_len;
- if (writer.write(ev, std::min<uint>(ev_len, length - hdr_offs)))
+ if (writer.write(ev, MY_MIN(ev_len, length - hdr_offs)))
DBUG_RETURN(ER_ERROR_ON_WRITE);
/* next event header at ... */
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 1449befc748..44376a008f6 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -55,8 +55,6 @@
#define my_b_write_string(A, B) my_b_write((A), (uchar*)(B), (uint) (sizeof(B) - 1))
-using std::max;
-
/**
BINLOG_CHECKSUM variable.
*/
@@ -1798,8 +1796,8 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
if (data_len < LOG_EVENT_MINIMAL_HEADER_LEN)
DBUG_RETURN(LOG_READ_BOGUS);
- if (data_len > max(max_allowed_packet,
- opt_binlog_rows_event_max_size + MAX_LOG_EVENT_HEADER))
+ if (data_len > MY_MAX(max_allowed_packet,
+ opt_binlog_rows_event_max_size + MAX_LOG_EVENT_HEADER))
DBUG_RETURN(LOG_READ_TOO_LARGE);
if (likely(data_len > LOG_EVENT_MINIMAL_HEADER_LEN))
diff --git a/sql/mdl.h b/sql/mdl.h
index 97216b8e7b1..2aeaef89f26 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -21,8 +21,6 @@
#include <mysql_com.h>
#include <lf.h>
-#include <algorithm>
-
class THD;
class MDL_context;
@@ -373,8 +371,7 @@ public:
character set is utf-8, we can safely assume that no
character starts with a zero byte.
*/
- using std::min;
- return memcmp(m_ptr, rhs->m_ptr, min(m_length, rhs->m_length));
+ return memcmp(m_ptr, rhs->m_ptr, MY_MIN(m_length, rhs->m_length));
}
MDL_key(const MDL_key *rhs)