1 |
commit: 88ee41001b53e6cd8be352e537b8925f99a995d6 |
2 |
Author: Robin H. Johnson <robbat2 <AT> orbis-terrarum <DOT> net> |
3 |
AuthorDate: Fri Nov 18 23:47:49 2011 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Nov 18 23:47:49 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/mysql-extras.git;a=commit;h=88ee4100 |
7 |
|
8 |
Another patch port. |
9 |
|
10 |
--- |
11 |
00000_index.txt | 8 +- |
12 |
07110_all_mysql_gcc-4.2_5.1.60.patch | 3859 ++++++++++++++++++++++++++++++++++ |
13 |
2 files changed, 3866 insertions(+), 1 deletions(-) |
14 |
|
15 |
diff --git a/00000_index.txt b/00000_index.txt |
16 |
index 2577963..23e76ca 100644 |
17 |
--- a/00000_index.txt |
18 |
+++ b/00000_index.txt |
19 |
@@ -540,7 +540,13 @@ |
20 |
@@ FIXME: Testing patch - applies cleanly |
21 |
|
22 |
@patch 07110_all_mysql_gcc-4.2_5.1.58.patch |
23 |
-@ver 5.01.58.00 to 5.01.99.99 |
24 |
+@ver 5.01.58.00 to 5.01.59.99 |
25 |
+@pn mysql |
26 |
+@@ Replace max() and min() macro with MYSQL_MIN() and MYSQL_MAX() |
27 |
+@@ FIXME: Testing patch - applies cleanly |
28 |
+ |
29 |
+@patch 07110_all_mysql_gcc-4.2_5.1.60.patch |
30 |
+@ver 5.01.60.00 to 5.01.99.99 |
31 |
@pn mysql |
32 |
@@ Replace max() and min() macro with MYSQL_MIN() and MYSQL_MAX() |
33 |
@@ FIXME: Testing patch - applies cleanly |
34 |
|
35 |
diff --git a/07110_all_mysql_gcc-4.2_5.1.60.patch b/07110_all_mysql_gcc-4.2_5.1.60.patch |
36 |
new file mode 100644 |
37 |
index 0000000..c7bb844 |
38 |
--- /dev/null |
39 |
+++ b/07110_all_mysql_gcc-4.2_5.1.60.patch |
40 |
@@ -0,0 +1,3859 @@ |
41 |
+X-Gentoo-Bug: 280843 |
42 |
+X-Upstream-Bug: 30866 |
43 |
+X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=280843 |
44 |
+X-Upstream-Bug-URL: http://bugs.mysql.com/bug.php?id=30866 |
45 |
+ |
46 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/client/mysqlbinlog.cc mysql/client/mysqlbinlog.cc |
47 |
+--- mysql.orig/client/mysqlbinlog.cc 2011-10-29 11:09:49.000000000 -0700 |
48 |
++++ mysql/client/mysqlbinlog.cc 2011-11-18 15:43:16.995773774 -0800 |
49 |
+@@ -1954,7 +1954,7 @@ |
50 |
+ my_off_t length,tmp; |
51 |
+ for (length= start_position_mot ; length > 0 ; length-=tmp) |
52 |
+ { |
53 |
+- tmp=min(length,sizeof(buff)); |
54 |
++ tmp=MYSQL_MIN(length,sizeof(buff)); |
55 |
+ if (my_b_read(file, buff, (uint) tmp)) |
56 |
+ { |
57 |
+ error("Failed reading from file."); |
58 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/client/mysql.cc mysql/client/mysql.cc |
59 |
+--- mysql.orig/client/mysql.cc 2011-10-29 11:09:47.000000000 -0700 |
60 |
++++ mysql/client/mysql.cc 2011-11-18 15:43:16.997773806 -0800 |
61 |
+@@ -3334,9 +3334,9 @@ |
62 |
+ { |
63 |
+ uint length= column_names ? field->name_length : 0; |
64 |
+ if (quick) |
65 |
+- length=max(length,field->length); |
66 |
++ length=MYSQL_MAX(length,field->length); |
67 |
+ else |
68 |
+- length=max(length,field->max_length); |
69 |
++ length=MYSQL_MAX(length,field->max_length); |
70 |
+ if (length < 4 && !IS_NOT_NULL(field->flags)) |
71 |
+ length=4; // Room for "NULL" |
72 |
+ field->max_length=length; |
73 |
+@@ -3356,7 +3356,7 @@ |
74 |
+ field->name, |
75 |
+ field->name + name_length); |
76 |
+ uint display_length= field->max_length + name_length - numcells; |
77 |
+- tee_fprintf(PAGER, " %-*s |",(int) min(display_length, |
78 |
++ tee_fprintf(PAGER, " %-*s |",(int) MYSQL_MIN(display_length, |
79 |
+ MAX_COLUMN_LENGTH), |
80 |
+ field->name); |
81 |
+ num_flag[off]= IS_NUM(field->type); |
82 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/client/mysqldump.c mysql/client/mysqldump.c |
83 |
+--- mysql.orig/client/mysqldump.c 2011-10-29 11:09:49.000000000 -0700 |
84 |
++++ mysql/client/mysqldump.c 2011-11-18 15:43:16.999773837 -0800 |
85 |
+@@ -833,7 +833,7 @@ |
86 |
+ &err_ptr, &err_len); |
87 |
+ if (err_len) |
88 |
+ { |
89 |
+- strmake(buff, err_ptr, min(sizeof(buff) - 1, err_len)); |
90 |
++ strmake(buff, err_ptr, MYSQL_MIN(sizeof(buff) - 1, err_len)); |
91 |
+ fprintf(stderr, "Invalid mode to --compatible: %s\n", buff); |
92 |
+ exit(1); |
93 |
+ } |
94 |
+@@ -4526,7 +4526,7 @@ |
95 |
+ |
96 |
+ for (; pos != end && *pos != ','; pos++) ; |
97 |
+ var_len= (uint) (pos - start); |
98 |
+- strmake(buff, start, min(sizeof(buff) - 1, var_len)); |
99 |
++ strmake(buff, start, MYSQL_MIN(sizeof(buff) - 1, var_len)); |
100 |
+ find= find_type(buff, lib, var_len); |
101 |
+ if (!find) |
102 |
+ { |
103 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/client/mysqltest.cc mysql/client/mysqltest.cc |
104 |
+--- mysql.orig/client/mysqltest.cc 2011-10-29 11:09:47.000000000 -0700 |
105 |
++++ mysql/client/mysqltest.cc 2011-11-18 15:43:17.002773882 -0800 |
106 |
+@@ -5666,9 +5666,9 @@ |
107 |
+ } |
108 |
+ else if ((c == '{' && |
109 |
+ (!my_strnncoll_simple(charset_info, (const uchar*) "while", 5, |
110 |
+- (uchar*) buf, min(5, p - buf), 0) || |
111 |
++ (uchar*) buf, MYSQL_MIN(5, p - buf), 0) || |
112 |
+ !my_strnncoll_simple(charset_info, (const uchar*) "if", 2, |
113 |
+- (uchar*) buf, min(2, p - buf), 0)))) |
114 |
++ (uchar*) buf, MYSQL_MIN(2, p - buf), 0)))) |
115 |
+ { |
116 |
+ /* Only if and while commands can be terminated by { */ |
117 |
+ *p++= c; |
118 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/client/mysql_upgrade.c mysql/client/mysql_upgrade.c |
119 |
+--- mysql.orig/client/mysql_upgrade.c 2011-10-29 11:09:49.000000000 -0700 |
120 |
++++ mysql/client/mysql_upgrade.c 2011-11-18 15:43:17.003773897 -0800 |
121 |
+@@ -533,7 +533,7 @@ |
122 |
+ if ((value_end= strchr(value_start, '\n')) == NULL) |
123 |
+ return 1; /* Unexpected result */ |
124 |
+ |
125 |
+- strncpy(value, value_start, min(FN_REFLEN, value_end-value_start)); |
126 |
++ strncpy(value, value_start, MYSQL_MIN(FN_REFLEN, value_end-value_start)); |
127 |
+ return 0; |
128 |
+ } |
129 |
+ |
130 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/client/sql_string.cc mysql/client/sql_string.cc |
131 |
+--- mysql.orig/client/sql_string.cc 2011-10-29 11:09:49.000000000 -0700 |
132 |
++++ mysql/client/sql_string.cc 2011-11-18 15:43:17.003773897 -0800 |
133 |
+@@ -664,7 +664,7 @@ |
134 |
+ { |
135 |
+ if (Alloced_length < str_length + space_needed) |
136 |
+ { |
137 |
+- if (realloc(Alloced_length + max(space_needed, grow_by) - 1)) |
138 |
++ if (realloc(Alloced_length + MYSQL_MAX(space_needed, grow_by) - 1)) |
139 |
+ return TRUE; |
140 |
+ } |
141 |
+ return FALSE; |
142 |
+@@ -750,7 +750,7 @@ |
143 |
+ |
144 |
+ int stringcmp(const String *s,const String *t) |
145 |
+ { |
146 |
+- uint32 s_len=s->length(),t_len=t->length(),len=min(s_len,t_len); |
147 |
++ uint32 s_len=s->length(),t_len=t->length(),len=MYSQL_MIN(s_len,t_len); |
148 |
+ int cmp= memcmp(s->ptr(), t->ptr(), len); |
149 |
+ return (cmp) ? cmp : (int) (s_len - t_len); |
150 |
+ } |
151 |
+@@ -767,7 +767,7 @@ |
152 |
+ } |
153 |
+ if (to->realloc(from_length)) |
154 |
+ return from; // Actually an error |
155 |
+- if ((to->str_length=min(from->str_length,from_length))) |
156 |
++ if ((to->str_length=MYSQL_MIN(from->str_length,from_length))) |
157 |
+ memcpy(to->Ptr,from->Ptr,to->str_length); |
158 |
+ to->str_charset=from->str_charset; |
159 |
+ return to; |
160 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/dbug/dbug.c mysql/dbug/dbug.c |
161 |
+--- mysql.orig/dbug/dbug.c 2011-10-29 11:09:48.000000000 -0700 |
162 |
++++ mysql/dbug/dbug.c 2011-11-18 15:43:17.004773912 -0800 |
163 |
+@@ -1205,7 +1205,7 @@ |
164 |
+ if (TRACING) |
165 |
+ { |
166 |
+ Indent(cs, cs->level + 1); |
167 |
+- pos= min(max(cs->level-cs->stack->sub_level,0)*INDENT,80); |
168 |
++ pos= MYSQL_MIN(MYSQL_MAX(cs->level-cs->stack->sub_level,0)*INDENT,80); |
169 |
+ } |
170 |
+ else |
171 |
+ { |
172 |
+@@ -1690,7 +1690,7 @@ |
173 |
+ { |
174 |
+ REGISTER int count; |
175 |
+ |
176 |
+- indent= max(indent-1-cs->stack->sub_level,0)*INDENT; |
177 |
++ indent= MYSQL_MAX(indent-1-cs->stack->sub_level,0)*INDENT; |
178 |
+ for (count= 0; count < indent ; count++) |
179 |
+ { |
180 |
+ if ((count % INDENT) == 0) |
181 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/extra/yassl/src/ssl.cpp mysql/extra/yassl/src/ssl.cpp |
182 |
+--- mysql.orig/extra/yassl/src/ssl.cpp 2011-10-29 11:09:49.000000000 -0700 |
183 |
++++ mysql/extra/yassl/src/ssl.cpp 2011-11-18 15:43:17.004773912 -0800 |
184 |
+@@ -38,6 +38,7 @@ |
185 |
+ #include "file.hpp" // for TaoCrypt Source |
186 |
+ #include "coding.hpp" // HexDecoder |
187 |
+ #include "helpers.hpp" // for placement new hack |
188 |
++#include "my_global.h" |
189 |
+ #include <stdio.h> |
190 |
+ |
191 |
+ #ifdef _WIN32 |
192 |
+@@ -113,7 +114,7 @@ |
193 |
+ // use file's salt for key derivation, but not real iv |
194 |
+ TaoCrypt::Source source(info.iv, info.ivSz); |
195 |
+ TaoCrypt::HexDecoder dec(source); |
196 |
+- memcpy(info.iv, source.get_buffer(), min((uint)sizeof(info.iv), |
197 |
++ memcpy(info.iv, source.get_buffer(), MYSQL_MIN((uint)sizeof(info.iv), |
198 |
+ source.size())); |
199 |
+ EVP_BytesToKey(info.name, "MD5", info.iv, (byte*)password, |
200 |
+ passwordSz, 1, key, iv); |
201 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/extra/yassl/taocrypt/include/pwdbased.hpp mysql/extra/yassl/taocrypt/include/pwdbased.hpp |
202 |
+--- mysql.orig/extra/yassl/taocrypt/include/pwdbased.hpp 2011-10-29 11:09:53.000000000 -0700 |
203 |
++++ mysql/extra/yassl/taocrypt/include/pwdbased.hpp 2011-11-18 15:43:17.005773927 -0800 |
204 |
+@@ -67,7 +67,7 @@ |
205 |
+ } |
206 |
+ hmac.Final(buffer.get_buffer()); |
207 |
+ |
208 |
+- word32 segmentLen = min(dLen, buffer.size()); |
209 |
++ word32 segmentLen = MYSQL_MIN(dLen, buffer.size()); |
210 |
+ memcpy(derived, buffer.get_buffer(), segmentLen); |
211 |
+ |
212 |
+ for (j = 1; j < iterations; j++) { |
213 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/extra/yassl/taocrypt/src/dh.cpp mysql/extra/yassl/taocrypt/src/dh.cpp |
214 |
+--- mysql.orig/extra/yassl/taocrypt/src/dh.cpp 2011-10-29 11:09:51.000000000 -0700 |
215 |
++++ mysql/extra/yassl/taocrypt/src/dh.cpp 2011-11-18 15:43:17.005773927 -0800 |
216 |
+@@ -23,6 +23,7 @@ |
217 |
+ #include "runtime.hpp" |
218 |
+ #include "dh.hpp" |
219 |
+ #include "asn.hpp" |
220 |
++#include "my_global.h" |
221 |
+ #include <math.h> |
222 |
+ |
223 |
+ namespace TaoCrypt { |
224 |
+@@ -54,7 +55,7 @@ |
225 |
+ // Generate private value |
226 |
+ void DH::GeneratePrivate(RandomNumberGenerator& rng, byte* priv) |
227 |
+ { |
228 |
+- Integer x(rng, Integer::One(), min(p_ - 1, |
229 |
++ Integer x(rng, Integer::One(), MYSQL_MIN(p_ - 1, |
230 |
+ Integer::Power2(2*DiscreteLogWorkFactor(p_.BitCount())) ) ); |
231 |
+ x.Encode(priv, p_.ByteCount()); |
232 |
+ } |
233 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/include/my_global.h mysql/include/my_global.h |
234 |
+--- mysql.orig/include/my_global.h 2011-10-29 11:09:49.000000000 -0700 |
235 |
++++ mysql/include/my_global.h 2011-11-18 15:43:17.005773927 -0800 |
236 |
+@@ -586,10 +586,8 @@ |
237 |
+ #endif |
238 |
+ |
239 |
+ /* Define some useful general macros */ |
240 |
+-#if !defined(max) |
241 |
+-#define max(a, b) ((a) > (b) ? (a) : (b)) |
242 |
+-#define min(a, b) ((a) < (b) ? (a) : (b)) |
243 |
+-#endif |
244 |
++#define MYSQL_MAX(a, b) ((a) > (b) ? (a) : (b)) |
245 |
++#define MYSQL_MIN(a, b) ((a) < (b) ? (a) : (b)) |
246 |
+ |
247 |
+ #if !defined(HAVE_UINT) |
248 |
+ #undef HAVE_UINT |
249 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/libmysql/libmysql.c mysql/libmysql/libmysql.c |
250 |
+--- mysql.orig/libmysql/libmysql.c 2011-10-29 11:09:49.000000000 -0700 |
251 |
++++ mysql/libmysql/libmysql.c 2011-11-18 15:43:17.006773942 -0800 |
252 |
+@@ -1572,7 +1572,7 @@ |
253 |
+ my_net_set_read_timeout(net, CLIENT_NET_READ_TIMEOUT); |
254 |
+ my_net_set_write_timeout(net, CLIENT_NET_WRITE_TIMEOUT); |
255 |
+ net->retry_count= 1; |
256 |
+- net->max_packet_size= max(net_buffer_length, max_allowed_packet); |
257 |
++ net->max_packet_size= MYSQL_MAX(net_buffer_length, max_allowed_packet); |
258 |
+ } |
259 |
+ |
260 |
+ /* |
261 |
+@@ -3622,7 +3622,7 @@ |
262 |
+ copy_length= end - start; |
263 |
+ /* We've got some data beyond offset: copy up to buffer_length bytes */ |
264 |
+ if (param->buffer_length) |
265 |
+- memcpy(buffer, start, min(copy_length, param->buffer_length)); |
266 |
++ memcpy(buffer, start, MYSQL_MIN(copy_length, param->buffer_length)); |
267 |
+ } |
268 |
+ else |
269 |
+ copy_length= 0; |
270 |
+@@ -3855,9 +3855,9 @@ |
271 |
+ precisions. This will ensure that on the same machine you get the |
272 |
+ same value as a string independent of the protocol you use. |
273 |
+ */ |
274 |
+- sprintf(buff, "%-*.*g", (int) min(sizeof(buff)-1, |
275 |
++ sprintf(buff, "%-*.*g", (int) MYSQL_MIN(sizeof(buff)-1, |
276 |
+ param->buffer_length), |
277 |
+- min(DBL_DIG, width), value); |
278 |
++ MYSQL_MIN(DBL_DIG,width), value); |
279 |
+ end= strcend(buff, ' '); |
280 |
+ *end= 0; |
281 |
+ } |
282 |
+@@ -4175,7 +4175,7 @@ |
283 |
+ uchar **row) |
284 |
+ { |
285 |
+ ulong length= net_field_length(row); |
286 |
+- ulong copy_length= min(length, param->buffer_length); |
287 |
++ ulong copy_length= MYSQL_MIN(length, param->buffer_length); |
288 |
+ memcpy(param->buffer, (char *)*row, copy_length); |
289 |
+ *param->length= length; |
290 |
+ *param->error= copy_length < length; |
291 |
+@@ -4187,7 +4187,7 @@ |
292 |
+ uchar **row) |
293 |
+ { |
294 |
+ ulong length= net_field_length(row); |
295 |
+- ulong copy_length= min(length, param->buffer_length); |
296 |
++ ulong copy_length= MYSQL_MIN(length, param->buffer_length); |
297 |
+ memcpy(param->buffer, (char *)*row, copy_length); |
298 |
+ /* Add an end null if there is room in the buffer */ |
299 |
+ if (copy_length != param->buffer_length) |
300 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/libmysqld/lib_sql.cc mysql/libmysqld/lib_sql.cc |
301 |
+--- mysql.orig/libmysqld/lib_sql.cc 2011-10-29 11:09:49.000000000 -0700 |
302 |
++++ mysql/libmysqld/lib_sql.cc 2011-11-18 15:43:17.007773958 -0800 |
303 |
+@@ -848,7 +848,7 @@ |
304 |
+ is cleared between substatements, and mysqltest gets confused |
305 |
+ */ |
306 |
+ thd->cur_data->embedded_info->warning_count= |
307 |
+- (thd->spcont ? 0 : min(total_warn_count, 65535)); |
308 |
++ (thd->spcont ? 0 : MYSQL_MIN(total_warn_count, 65535)); |
309 |
+ return FALSE; |
310 |
+ } |
311 |
+ |
312 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/array.c mysql/mysys/array.c |
313 |
+--- mysql.orig/mysys/array.c 2011-10-29 11:09:49.000000000 -0700 |
314 |
++++ mysql/mysys/array.c 2011-11-18 15:43:17.007773958 -0800 |
315 |
+@@ -50,7 +50,7 @@ |
316 |
+ DBUG_ENTER("init_dynamic_array"); |
317 |
+ if (!alloc_increment) |
318 |
+ { |
319 |
+- alloc_increment=max((8192-MALLOC_OVERHEAD)/element_size,16); |
320 |
++ alloc_increment=MYSQL_MAX((8192-MALLOC_OVERHEAD)/element_size,16); |
321 |
+ if (init_alloc > 8 && alloc_increment > init_alloc * 2) |
322 |
+ alloc_increment=init_alloc*2; |
323 |
+ } |
324 |
+@@ -344,7 +344,7 @@ |
325 |
+ |
326 |
+ void freeze_size(DYNAMIC_ARRAY *array) |
327 |
+ { |
328 |
+- uint elements=max(array->elements,1); |
329 |
++ uint elements=MYSQL_MAX(array->elements,1); |
330 |
+ |
331 |
+ /* |
332 |
+ Do nothing if we are using a static buffer |
333 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/default.c mysql/mysys/default.c |
334 |
+--- mysql.orig/mysys/default.c 2011-10-29 11:09:49.000000000 -0700 |
335 |
++++ mysql/mysys/default.c 2011-11-18 15:43:17.008773974 -0800 |
336 |
+@@ -796,7 +796,7 @@ |
337 |
+ for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ; |
338 |
+ end[0]=0; |
339 |
+ |
340 |
+- strmake(curr_gr, ptr, min((size_t) (end-ptr)+1, sizeof(curr_gr)-1)); |
341 |
++ strmake(curr_gr, ptr, MYSQL_MIN((size_t) (end-ptr)+1, sizeof(curr_gr)-1)); |
342 |
+ |
343 |
+ /* signal that a new group is found */ |
344 |
+ opt_handler(handler_ctx, curr_gr, NULL); |
345 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/mf_format.c mysql/mysys/mf_format.c |
346 |
+--- mysql.orig/mysys/mf_format.c 2011-10-29 11:09:49.000000000 -0700 |
347 |
++++ mysql/mysys/mf_format.c 2011-11-18 15:43:17.008773974 -0800 |
348 |
+@@ -86,7 +86,7 @@ |
349 |
+ tmp_length= strlength(startpos); |
350 |
+ DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %u",dev,ext, |
351 |
+ (uint) length)); |
352 |
+- (void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1)); |
353 |
++ (void) strmake(to,startpos,MYSQL_MIN(tmp_length,FN_REFLEN-1)); |
354 |
+ } |
355 |
+ else |
356 |
+ { |
357 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/mf_iocache.c mysql/mysys/mf_iocache.c |
358 |
+--- mysql.orig/mysys/mf_iocache.c 2011-10-29 11:09:49.000000000 -0700 |
359 |
++++ mysql/mysys/mf_iocache.c 2011-11-18 15:43:17.008773974 -0800 |
360 |
+@@ -1099,7 +1099,7 @@ |
361 |
+ */ |
362 |
+ while (write_length) |
363 |
+ { |
364 |
+- size_t copy_length= min(write_length, write_cache->buffer_length); |
365 |
++ size_t copy_length= MYSQL_MIN(write_length, write_cache->buffer_length); |
366 |
+ int __attribute__((unused)) rc; |
367 |
+ |
368 |
+ rc= lock_io_cache(write_cache, write_cache->pos_in_file); |
369 |
+@@ -1258,7 +1258,7 @@ |
370 |
+ TODO: figure out if the assert below is needed or correct. |
371 |
+ */ |
372 |
+ DBUG_ASSERT(pos_in_file == info->end_of_file); |
373 |
+- copy_len=min(Count, len_in_buff); |
374 |
++ copy_len=MYSQL_MIN(Count, len_in_buff); |
375 |
+ memcpy(Buffer, info->append_read_pos, copy_len); |
376 |
+ info->append_read_pos += copy_len; |
377 |
+ Count -= copy_len; |
378 |
+@@ -1367,7 +1367,7 @@ |
379 |
+ } |
380 |
+ #endif |
381 |
+ /* Copy found bytes to buffer */ |
382 |
+- length=min(Count,read_length); |
383 |
++ length=MYSQL_MIN(Count,read_length); |
384 |
+ memcpy(Buffer,info->read_pos,(size_t) length); |
385 |
+ Buffer+=length; |
386 |
+ Count-=length; |
387 |
+@@ -1401,7 +1401,7 @@ |
388 |
+ if ((read_length=my_read(info->file,info->request_pos, |
389 |
+ read_length, info->myflags)) == (size_t) -1) |
390 |
+ return info->error= -1; |
391 |
+- use_length=min(Count,read_length); |
392 |
++ use_length=MYSQL_MIN(Count,read_length); |
393 |
+ memcpy(Buffer,info->request_pos,(size_t) use_length); |
394 |
+ info->read_pos=info->request_pos+Count; |
395 |
+ info->read_end=info->request_pos+read_length; |
396 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/my_alloc.c mysql/mysys/my_alloc.c |
397 |
+--- mysql.orig/mysys/my_alloc.c 2011-10-29 11:09:49.000000000 -0700 |
398 |
++++ mysql/mysys/my_alloc.c 2011-11-18 15:43:17.009773990 -0800 |
399 |
+@@ -214,7 +214,7 @@ |
400 |
+ { /* Time to alloc new block */ |
401 |
+ block_size= mem_root->block_size * (mem_root->block_num >> 2); |
402 |
+ get_size= length+ALIGN_SIZE(sizeof(USED_MEM)); |
403 |
+- get_size= max(get_size, block_size); |
404 |
++ get_size= MYSQL_MAX(get_size, block_size); |
405 |
+ |
406 |
+ if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME)))) |
407 |
+ { |
408 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/my_bitmap.c mysql/mysys/my_bitmap.c |
409 |
+--- mysql.orig/mysys/my_bitmap.c 2011-10-29 11:09:49.000000000 -0700 |
410 |
++++ mysql/mysys/my_bitmap.c 2011-11-18 15:43:17.009773990 -0800 |
411 |
+@@ -425,7 +425,7 @@ |
412 |
+ |
413 |
+ DBUG_ASSERT(map->bitmap && map2->bitmap); |
414 |
+ |
415 |
+- end= to+min(len,len2); |
416 |
++ end= to+MYSQL_MIN(len,len2); |
417 |
+ for (; to < end; to++, from++) |
418 |
+ *to &= *from; |
419 |
+ |
420 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/my_compare.c mysql/mysys/my_compare.c |
421 |
+--- mysql.orig/mysys/my_compare.c 2011-10-29 11:09:49.000000000 -0700 |
422 |
++++ mysql/mysys/my_compare.c 2011-11-18 15:43:17.010774005 -0800 |
423 |
+@@ -30,7 +30,7 @@ |
424 |
+ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length, |
425 |
+ my_bool part_key, my_bool skip_end_space) |
426 |
+ { |
427 |
+- uint length= min(a_length,b_length); |
428 |
++ uint length= MYSQL_MIN(a_length,b_length); |
429 |
+ uchar *end= a+ length; |
430 |
+ int flag; |
431 |
+ |
432 |
+@@ -158,7 +158,7 @@ |
433 |
+ continue; /* To next key part */ |
434 |
+ } |
435 |
+ } |
436 |
+- end= a+ min(keyseg->length,key_length); |
437 |
++ end= a+ MYSQL_MIN(keyseg->length,key_length); |
438 |
+ next_key_length=key_length-keyseg->length; |
439 |
+ |
440 |
+ switch ((enum ha_base_keytype) keyseg->type) { |
441 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/my_compress.c mysql/mysys/my_compress.c |
442 |
+--- mysql.orig/mysys/my_compress.c 2011-10-29 11:09:52.000000000 -0700 |
443 |
++++ mysql/mysys/my_compress.c 2011-11-18 15:43:17.010774005 -0800 |
444 |
+@@ -244,7 +244,7 @@ |
445 |
+ |
446 |
+ if (ver != 1) |
447 |
+ DBUG_RETURN(1); |
448 |
+- if (!(data= my_malloc(max(orglen, complen), MYF(MY_WME)))) |
449 |
++ if (!(data= my_malloc(MYSQL_MAX(orglen, complen), MYF(MY_WME)))) |
450 |
+ DBUG_RETURN(2); |
451 |
+ memcpy(data, pack_data + BLOB_HEADER, complen); |
452 |
+ |
453 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/my_conio.c mysql/mysys/my_conio.c |
454 |
+--- mysql.orig/mysys/my_conio.c 2011-10-29 11:09:52.000000000 -0700 |
455 |
++++ mysql/mysys/my_conio.c 2011-11-18 15:43:17.010774005 -0800 |
456 |
+@@ -165,13 +165,13 @@ |
457 |
+ though it is known it should not be more than 64K |
458 |
+ so we cut 64K and try first size of screen buffer |
459 |
+ if it is still to large we cut half of it and try again |
460 |
+- later we may want to cycle from min(clen, 65535) to allowed size |
461 |
++ later we may want to cycle from MYSQL_MIN(clen, 65535) to allowed size |
462 |
+ with small decrement to determine exact allowed buffer |
463 |
+ */ |
464 |
+- clen= min(clen, 65535); |
465 |
++ clen= MYSQL_MIN(clen, 65535); |
466 |
+ do |
467 |
+ { |
468 |
+- clen= min(clen, (size_t) csbi.dwSize.X*csbi.dwSize.Y); |
469 |
++ clen= MYSQL_MIN(clen, (size_t) csbi.dwSize.X*csbi.dwSize.Y); |
470 |
+ if (!ReadConsole((HANDLE)my_coninpfh, (LPVOID)buffer, (DWORD) clen - 1, &plen_res, |
471 |
+ NULL)) |
472 |
+ { |
473 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/my_file.c mysql/mysys/my_file.c |
474 |
+--- mysql.orig/mysys/my_file.c 2011-10-29 11:09:49.000000000 -0700 |
475 |
++++ mysql/mysys/my_file.c 2011-11-18 15:43:17.010774005 -0800 |
476 |
+@@ -77,7 +77,7 @@ |
477 |
+ static uint set_max_open_files(uint max_file_limit) |
478 |
+ { |
479 |
+ /* We don't know the limit. Return best guess */ |
480 |
+- return min(max_file_limit, OS_FILE_LIMIT); |
481 |
++ return MYSQL_MIN(max_file_limit, OS_FILE_LIMIT); |
482 |
+ } |
483 |
+ #endif |
484 |
+ |
485 |
+@@ -99,7 +99,7 @@ |
486 |
+ DBUG_ENTER("my_set_max_open_files"); |
487 |
+ DBUG_PRINT("enter",("files: %u my_file_limit: %u", files, my_file_limit)); |
488 |
+ |
489 |
+- files= set_max_open_files(min(files, OS_FILE_LIMIT)); |
490 |
++ files= set_max_open_files(MYSQL_MIN(files, OS_FILE_LIMIT)); |
491 |
+ if (files <= MY_NFILE) |
492 |
+ DBUG_RETURN(files); |
493 |
+ |
494 |
+@@ -109,9 +109,9 @@ |
495 |
+ |
496 |
+ /* Copy any initialized files */ |
497 |
+ memcpy((char*) tmp, (char*) my_file_info, |
498 |
+- sizeof(*tmp) * min(my_file_limit, files)); |
499 |
++ sizeof(*tmp) * MYSQL_MIN(my_file_limit, files)); |
500 |
+ bzero((char*) (tmp + my_file_limit), |
501 |
+- max((int) (files- my_file_limit), 0)*sizeof(*tmp)); |
502 |
++ MYSQL_MAX((int) (files- my_file_limit), 0)*sizeof(*tmp)); |
503 |
+ my_free_open_file_info(); /* Free if already allocated */ |
504 |
+ my_file_info= tmp; |
505 |
+ my_file_limit= files; |
506 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/my_getopt.c mysql/mysys/my_getopt.c |
507 |
+--- mysql.orig/mysys/my_getopt.c 2011-10-29 11:09:49.000000000 -0700 |
508 |
++++ mysql/mysys/my_getopt.c 2011-11-18 15:43:17.011774020 -0800 |
509 |
+@@ -985,7 +985,7 @@ |
510 |
+ } |
511 |
+ if (optp->max_value && num > (double) optp->max_value) |
512 |
+ num= (double) optp->max_value; |
513 |
+- return max(num, (double) optp->min_value); |
514 |
++ return MYSQL_MAX(num, (double) optp->min_value); |
515 |
+ } |
516 |
+ |
517 |
+ /* |
518 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/my_static.h mysql/mysys/my_static.h |
519 |
+--- mysql.orig/mysys/my_static.h 2011-10-29 11:09:52.000000000 -0700 |
520 |
++++ mysql/mysys/my_static.h 2011-11-18 15:43:17.011774020 -0800 |
521 |
+@@ -22,7 +22,7 @@ |
522 |
+ #include <signal.h> |
523 |
+ |
524 |
+ #define MAX_SIGNALS 10 /* Max signals under a dont-allow */ |
525 |
+-#define MIN_KEYBLOCK (min(IO_SIZE,1024)) |
526 |
++#define MIN_KEYBLOCK (MYSQL_MIN(IO_SIZE,1024)) |
527 |
+ #define MAX_KEYBLOCK 8192 /* Max keyblocklength == 8*IO_SIZE */ |
528 |
+ #define MAX_BLOCK_TYPES MAX_KEYBLOCK/MIN_KEYBLOCK |
529 |
+ |
530 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/safemalloc.c mysql/mysys/safemalloc.c |
531 |
+--- mysql.orig/mysys/safemalloc.c 2011-10-29 11:09:49.000000000 -0700 |
532 |
++++ mysql/mysys/safemalloc.c 2011-11-18 15:43:17.011774020 -0800 |
533 |
+@@ -250,7 +250,7 @@ |
534 |
+ |
535 |
+ if ((data= _mymalloc(size,filename,lineno,MyFlags))) /* Allocate new area */ |
536 |
+ { |
537 |
+- size=min(size, irem->datasize); /* Move as much as possibly */ |
538 |
++ size=MYSQL_MIN(size, irem->datasize); /* Move as much as possibly */ |
539 |
+ memcpy((uchar*) data, ptr, (size_t) size); /* Copy old data */ |
540 |
+ _myfree(ptr, filename, lineno, 0); /* Free not needed area */ |
541 |
+ } |
542 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/mysys/stacktrace.c mysql/mysys/stacktrace.c |
543 |
+--- mysql.orig/mysys/stacktrace.c 2011-10-29 11:09:49.000000000 -0700 |
544 |
++++ mysql/mysys/stacktrace.c 2011-11-18 15:43:17.012774035 -0800 |
545 |
+@@ -98,7 +98,7 @@ |
546 |
+ /* Read up to the maximum number of bytes. */ |
547 |
+ while (total) |
548 |
+ { |
549 |
+- count= min(sizeof(buf), total); |
550 |
++ count= MYSQL_MIN(sizeof(buf), total); |
551 |
+ |
552 |
+ if ((nbytes= pread(fd, buf, count, offset)) < 0) |
553 |
+ { |
554 |
+@@ -326,7 +326,7 @@ |
555 |
+ |
556 |
+ if (!stack_bottom || (uchar*) stack_bottom > (uchar*) &fp) |
557 |
+ { |
558 |
+- ulong tmp= min(0x10000,thread_stack); |
559 |
++ ulong tmp= MYSQL_MIN(0x10000,thread_stack); |
560 |
+ /* Assume that the stack starts at the previous even 65K */ |
561 |
+ stack_bottom= (uchar*) (((ulong) &fp + tmp) & |
562 |
+ ~(ulong) 0xFFFF); |
563 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/server-tools/instance-manager/buffer.cc mysql/server-tools/instance-manager/buffer.cc |
564 |
+--- mysql.orig/server-tools/instance-manager/buffer.cc 2011-10-29 11:09:49.000000000 -0700 |
565 |
++++ mysql/server-tools/instance-manager/buffer.cc 2011-11-18 15:43:17.012774035 -0800 |
566 |
+@@ -86,8 +86,8 @@ |
567 |
+ if (position + len_arg >= buffer_size) |
568 |
+ { |
569 |
+ buffer= (uchar*) my_realloc(buffer, |
570 |
+- min(MAX_BUFFER_SIZE, |
571 |
+- max((uint) (buffer_size*1.5), |
572 |
++ MYSQL_MIN(MAX_BUFFER_SIZE, |
573 |
++ MYSQL_MAX((uint) (buffer_size*1.5), |
574 |
+ position + len_arg)), MYF(0)); |
575 |
+ if (!(buffer)) |
576 |
+ goto err; |
577 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/server-tools/instance-manager/listener.cc mysql/server-tools/instance-manager/listener.cc |
578 |
+--- mysql.orig/server-tools/instance-manager/listener.cc 2011-10-29 11:09:49.000000000 -0700 |
579 |
++++ mysql/server-tools/instance-manager/listener.cc 2011-11-18 15:43:17.012774035 -0800 |
580 |
+@@ -106,7 +106,7 @@ |
581 |
+ |
582 |
+ /* II. Listen sockets and spawn childs */ |
583 |
+ for (i= 0; i < num_sockets; i++) |
584 |
+- n= max(n, sockets[i]); |
585 |
++ n= MYSQL_MAX(n, sockets[i]); |
586 |
+ n++; |
587 |
+ |
588 |
+ timeval tv; |
589 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/debug_sync.cc mysql/sql/debug_sync.cc |
590 |
+--- mysql.orig/sql/debug_sync.cc 2011-10-29 11:09:48.000000000 -0700 |
591 |
++++ mysql/sql/debug_sync.cc 2011-11-18 15:43:17.013774050 -0800 |
592 |
+@@ -1036,7 +1036,7 @@ |
593 |
+ DBUG_ASSERT(action); |
594 |
+ DBUG_ASSERT(ds_control); |
595 |
+ |
596 |
+- action->activation_count= max(action->hit_limit, action->execute); |
597 |
++ action->activation_count= MYSQL_MAX(action->hit_limit, action->execute); |
598 |
+ if (!action->activation_count) |
599 |
+ { |
600 |
+ debug_sync_remove_action(ds_control, action); |
601 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/field.cc mysql/sql/field.cc |
602 |
+--- mysql.orig/sql/field.cc 2011-10-29 11:09:49.000000000 -0700 |
603 |
++++ mysql/sql/field.cc 2011-11-18 15:43:17.015774080 -0800 |
604 |
+@@ -55,7 +55,7 @@ |
605 |
+ #define LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE 128 |
606 |
+ #define DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE 128 |
607 |
+ #define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \ |
608 |
+-((ulong) ((LL(1) << min(arg, 4) * 8) - LL(1))) |
609 |
++((ulong) ((LL(1) << MYSQL_MIN(arg, 4) * 8) - LL(1))) |
610 |
+ |
611 |
+ #define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))) |
612 |
+ #define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index))) |
613 |
+@@ -2073,7 +2073,7 @@ |
614 |
+ tmp_uint=tmp_dec+(uint)(int_digits_end-int_digits_from); |
615 |
+ else if (expo_sign_char == '-') |
616 |
+ { |
617 |
+- tmp_uint=min(exponent,(uint)(int_digits_end-int_digits_from)); |
618 |
++ tmp_uint=MYSQL_MIN(exponent,(uint)(int_digits_end-int_digits_from)); |
619 |
+ frac_digits_added_zeros=exponent-tmp_uint; |
620 |
+ int_digits_end -= tmp_uint; |
621 |
+ frac_digits_head_end=int_digits_end+tmp_uint; |
622 |
+@@ -2081,7 +2081,7 @@ |
623 |
+ } |
624 |
+ else // (expo_sign_char=='+') |
625 |
+ { |
626 |
+- tmp_uint=min(exponent,(uint)(frac_digits_end-frac_digits_from)); |
627 |
++ tmp_uint=MYSQL_MIN(exponent,(uint)(frac_digits_end-frac_digits_from)); |
628 |
+ int_digits_added_zeros=exponent-tmp_uint; |
629 |
+ int_digits_tail_from=frac_digits_from; |
630 |
+ frac_digits_from=frac_digits_from+tmp_uint; |
631 |
+@@ -2506,7 +2506,7 @@ |
632 |
+ { |
633 |
+ signed int overflow; |
634 |
+ |
635 |
+- dec= min(dec, DECIMAL_MAX_SCALE); |
636 |
++ dec= MYSQL_MIN(dec, DECIMAL_MAX_SCALE); |
637 |
+ |
638 |
+ /* |
639 |
+ If the value still overflows the field with the corrected dec, |
640 |
+@@ -2522,7 +2522,7 @@ |
641 |
+ overflow= required_length - len; |
642 |
+ |
643 |
+ if (overflow > 0) |
644 |
+- dec= max(0, dec - overflow); // too long, discard fract |
645 |
++ dec= MYSQL_MAX(0, dec - overflow); // too long, discard fract |
646 |
+ else |
647 |
+ /* Corrected value fits. */ |
648 |
+ len= required_length; |
649 |
+@@ -3092,7 +3092,7 @@ |
650 |
+ ASSERT_COLUMN_MARKED_FOR_READ; |
651 |
+ CHARSET_INFO *cs= &my_charset_bin; |
652 |
+ uint length; |
653 |
+- uint mlength=max(field_length+1,5*cs->mbmaxlen); |
654 |
++ uint mlength=MYSQL_MAX(field_length+1,5*cs->mbmaxlen); |
655 |
+ val_buffer->alloc(mlength); |
656 |
+ char *to=(char*) val_buffer->ptr(); |
657 |
+ |
658 |
+@@ -3304,7 +3304,7 @@ |
659 |
+ ASSERT_COLUMN_MARKED_FOR_READ; |
660 |
+ CHARSET_INFO *cs= &my_charset_bin; |
661 |
+ uint length; |
662 |
+- uint mlength=max(field_length+1,7*cs->mbmaxlen); |
663 |
++ uint mlength=MYSQL_MAX(field_length+1,7*cs->mbmaxlen); |
664 |
+ val_buffer->alloc(mlength); |
665 |
+ char *to=(char*) val_buffer->ptr(); |
666 |
+ short j; |
667 |
+@@ -3521,7 +3521,7 @@ |
668 |
+ ASSERT_COLUMN_MARKED_FOR_READ; |
669 |
+ CHARSET_INFO *cs= &my_charset_bin; |
670 |
+ uint length; |
671 |
+- uint mlength=max(field_length+1,10*cs->mbmaxlen); |
672 |
++ uint mlength=MYSQL_MAX(field_length+1,10*cs->mbmaxlen); |
673 |
+ val_buffer->alloc(mlength); |
674 |
+ char *to=(char*) val_buffer->ptr(); |
675 |
+ long j= unsigned_flag ? (long) uint3korr(ptr) : sint3korr(ptr); |
676 |
+@@ -3740,7 +3740,7 @@ |
677 |
+ ASSERT_COLUMN_MARKED_FOR_READ; |
678 |
+ CHARSET_INFO *cs= &my_charset_bin; |
679 |
+ uint length; |
680 |
+- uint mlength=max(field_length+1,12*cs->mbmaxlen); |
681 |
++ uint mlength=MYSQL_MAX(field_length+1,12*cs->mbmaxlen); |
682 |
+ val_buffer->alloc(mlength); |
683 |
+ char *to=(char*) val_buffer->ptr(); |
684 |
+ int32 j; |
685 |
+@@ -3981,7 +3981,7 @@ |
686 |
+ { |
687 |
+ CHARSET_INFO *cs= &my_charset_bin; |
688 |
+ uint length; |
689 |
+- uint mlength=max(field_length+1,22*cs->mbmaxlen); |
690 |
++ uint mlength=MYSQL_MAX(field_length+1,22*cs->mbmaxlen); |
691 |
+ val_buffer->alloc(mlength); |
692 |
+ char *to=(char*) val_buffer->ptr(); |
693 |
+ longlong j; |
694 |
+@@ -4204,7 +4204,7 @@ |
695 |
+ #endif |
696 |
+ memcpy_fixed((uchar*) &nr,ptr,sizeof(nr)); |
697 |
+ |
698 |
+- uint to_length=max(field_length,70); |
699 |
++ uint to_length=MYSQL_MAX(field_length,70); |
700 |
+ val_buffer->alloc(to_length); |
701 |
+ char *to=(char*) val_buffer->ptr(); |
702 |
+ |
703 |
+@@ -6443,13 +6443,13 @@ |
704 |
+ calculate the maximum number of significant digits if the 'f'-format |
705 |
+ would be used (+1 for decimal point if the number has a fractional part). |
706 |
+ */ |
707 |
+- digits= max(1, (int) max_length - fractional); |
708 |
++ digits= MYSQL_MAX(1, (int) max_length - fractional); |
709 |
+ /* |
710 |
+ If the exponent is negative, decrease digits by the number of leading zeros |
711 |
+ after the decimal point that do not count as significant digits. |
712 |
+ */ |
713 |
+ if (exp < 0) |
714 |
+- digits= max(1, (int) digits + exp); |
715 |
++ digits= MYSQL_MAX(1, (int) digits + exp); |
716 |
+ /* |
717 |
+ 'e'-format is used only if the exponent is less than -4 or greater than or |
718 |
+ equal to the precision. In this case we need to adjust the number of |
719 |
+@@ -6457,7 +6457,7 @@ |
720 |
+ We also have to reserve one additional character if abs(exp) >= 100. |
721 |
+ */ |
722 |
+ if (exp >= (int) digits || exp < -4) |
723 |
+- digits= max(1, (int) (max_length - 5 - (exp >= 100 || exp <= -100))); |
724 |
++ digits= MYSQL_MAX(1, (int) (max_length - 5 - (exp >= 100 || exp <= -100))); |
725 |
+ |
726 |
+ /* Limit precision to DBL_DIG to avoid garbage past significant digits */ |
727 |
+ set_if_smaller(digits, DBL_DIG); |
728 |
+@@ -6715,7 +6715,7 @@ |
729 |
+ uint max_length, |
730 |
+ bool low_byte_first __attribute__((unused))) |
731 |
+ { |
732 |
+- uint length= min(field_length,max_length); |
733 |
++ uint length= MYSQL_MIN(field_length,max_length); |
734 |
+ uint local_char_length= max_length/field_charset->mbmaxlen; |
735 |
+ if (length > local_char_length) |
736 |
+ local_char_length= my_charpos(field_charset, from, from+length, |
737 |
+@@ -7709,7 +7709,7 @@ |
738 |
+ from= tmpstr.ptr(); |
739 |
+ } |
740 |
+ |
741 |
+- new_length= min(max_data_length(), field_charset->mbmaxlen * length); |
742 |
++ new_length= MYSQL_MIN(max_data_length(), field_charset->mbmaxlen * length); |
743 |
+ if (value.alloc(new_length)) |
744 |
+ goto oom_error; |
745 |
+ |
746 |
+@@ -7869,7 +7869,7 @@ |
747 |
+ b_length=get_length(b_ptr); |
748 |
+ if (b_length > max_length) |
749 |
+ b_length=max_length; |
750 |
+- diff=memcmp(a,b,min(a_length,b_length)); |
751 |
++ diff=memcmp(a,b,MYSQL_MIN(a_length,b_length)); |
752 |
+ return diff ? diff : (int) (a_length - b_length); |
753 |
+ } |
754 |
+ |
755 |
+@@ -8065,7 +8065,7 @@ |
756 |
+ length given is smaller than the actual length of the blob, we |
757 |
+ just store the initial bytes of the blob. |
758 |
+ */ |
759 |
+- store_length(to, packlength, min(length, max_length), low_byte_first); |
760 |
++ store_length(to, packlength, MYSQL_MIN(length, max_length), low_byte_first); |
761 |
+ |
762 |
+ /* |
763 |
+ Store the actual blob data, which will occupy 'length' bytes. |
764 |
+@@ -9112,7 +9112,7 @@ |
765 |
+ { |
766 |
+ ASSERT_COLUMN_MARKED_FOR_READ; |
767 |
+ char buff[sizeof(longlong)]; |
768 |
+- uint length= min(pack_length(), sizeof(longlong)); |
769 |
++ uint length= MYSQL_MIN(pack_length(), sizeof(longlong)); |
770 |
+ ulonglong bits= val_int(); |
771 |
+ mi_int8store(buff,bits); |
772 |
+ |
773 |
+@@ -9198,7 +9198,7 @@ |
774 |
+ *buff++= bits; |
775 |
+ length--; |
776 |
+ } |
777 |
+- uint data_length = min(length, bytes_in_rec); |
778 |
++ uint data_length = MYSQL_MIN(length, bytes_in_rec); |
779 |
+ memcpy(buff, ptr, data_length); |
780 |
+ return data_length + 1; |
781 |
+ } |
782 |
+@@ -9326,7 +9326,7 @@ |
783 |
+ uchar bits= get_rec_bits(bit_ptr + (from - ptr), bit_ofs, bit_len); |
784 |
+ *to++= bits; |
785 |
+ } |
786 |
+- length= min(bytes_in_rec, max_length - (bit_len > 0)); |
787 |
++ length= MYSQL_MIN(bytes_in_rec, max_length - (bit_len > 0)); |
788 |
+ memcpy(to, from, length); |
789 |
+ return to + length; |
790 |
+ } |
791 |
+@@ -9783,7 +9783,7 @@ |
792 |
+ DBUG_ASSERT(MAX_DATETIME_COMPRESSED_WIDTH < UINT_MAX); |
793 |
+ if (length != UINT_MAX) /* avoid overflow; is safe because of min() */ |
794 |
+ length= ((length+1)/2)*2; |
795 |
+- length= min(length, MAX_DATETIME_COMPRESSED_WIDTH); |
796 |
++ length= MYSQL_MIN(length, MAX_DATETIME_COMPRESSED_WIDTH); |
797 |
+ } |
798 |
+ flags|= ZEROFILL_FLAG | UNSIGNED_FLAG; |
799 |
+ /* |
800 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/filesort.cc mysql/sql/filesort.cc |
801 |
+--- mysql.orig/sql/filesort.cc 2011-10-29 11:09:47.000000000 -0700 |
802 |
++++ mysql/sql/filesort.cc 2011-11-18 15:43:17.015774080 -0800 |
803 |
+@@ -193,7 +193,7 @@ |
804 |
+ #ifdef CAN_TRUST_RANGE |
805 |
+ if (select && select->quick && select->quick->records > 0L) |
806 |
+ { |
807 |
+- records=min((ha_rows) (select->quick->records*2+EXTRA_RECORDS*2), |
808 |
++ records=MYSQL_MIN((ha_rows) (select->quick->records*2+EXTRA_RECORDS*2), |
809 |
+ table->file->stats.records)+EXTRA_RECORDS; |
810 |
+ selected_records_file=0; |
811 |
+ } |
812 |
+@@ -215,12 +215,12 @@ |
813 |
+ goto err; |
814 |
+ |
815 |
+ memavl= thd->variables.sortbuff_size; |
816 |
+- min_sort_memory= max(MIN_SORT_MEMORY, param.sort_length*MERGEBUFF2); |
817 |
++ min_sort_memory= MYSQL_MAX(MIN_SORT_MEMORY, param.sort_length*MERGEBUFF2); |
818 |
+ while (memavl >= min_sort_memory) |
819 |
+ { |
820 |
+ ulong old_memavl; |
821 |
+ ulong keys= memavl/(param.rec_length+sizeof(char*)); |
822 |
+- param.keys=(uint) min(records+1, keys); |
823 |
++ param.keys=(uint) MYSQL_MIN(records+1, keys); |
824 |
+ if ((table_sort.sort_keys= |
825 |
+ (uchar **) make_char_array((char **) table_sort.sort_keys, |
826 |
+ param.keys, param.rec_length, MYF(0)))) |
827 |
+@@ -1109,7 +1109,7 @@ |
828 |
+ register uint count; |
829 |
+ uint length; |
830 |
+ |
831 |
+- if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count))) |
832 |
++ if ((count=(uint) MYSQL_MIN((ha_rows) buffpek->max_keys,buffpek->count))) |
833 |
+ { |
834 |
+ if (my_pread(fromfile->file,(uchar*) buffpek->base, |
835 |
+ (length= rec_length*count),buffpek->file_pos,MYF_RW)) |
836 |
+@@ -1372,7 +1372,7 @@ |
837 |
+ != -1 && error != 0); |
838 |
+ |
839 |
+ end: |
840 |
+- lastbuff->count= min(org_max_rows-max_rows, param->max_rows); |
841 |
++ lastbuff->count= MYSQL_MIN(org_max_rows-max_rows, param->max_rows); |
842 |
+ lastbuff->file_pos= to_start_filepos; |
843 |
+ err: |
844 |
+ delete_queue(&queue); |
845 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/ha_ndbcluster.cc mysql/sql/ha_ndbcluster.cc |
846 |
+--- mysql.orig/sql/ha_ndbcluster.cc 2011-10-29 11:09:49.000000000 -0700 |
847 |
++++ mysql/sql/ha_ndbcluster.cc 2011-11-18 15:43:17.017774112 -0800 |
848 |
+@@ -799,7 +799,7 @@ |
849 |
+ |
850 |
+ DBUG_PRINT("value", ("set blob ptr: 0x%lx len: %u", |
851 |
+ (long) blob_ptr, blob_len)); |
852 |
+- DBUG_DUMP("value", blob_ptr, min(blob_len, 26)); |
853 |
++ DBUG_DUMP("value", blob_ptr, MYSQL_MIN(blob_len, 26)); |
854 |
+ |
855 |
+ if (set_blob_value) |
856 |
+ *set_blob_value= TRUE; |
857 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/handler.h mysql/sql/handler.h |
858 |
+--- mysql.orig/sql/handler.h 2011-10-29 11:09:49.000000000 -0700 |
859 |
++++ mysql/sql/handler.h 2011-11-18 15:43:17.018774127 -0800 |
860 |
+@@ -1607,15 +1607,15 @@ |
861 |
+ { return (HA_ERR_WRONG_COMMAND); } |
862 |
+ |
863 |
+ uint max_record_length() const |
864 |
+- { return min(HA_MAX_REC_LENGTH, max_supported_record_length()); } |
865 |
++ { return MYSQL_MIN(HA_MAX_REC_LENGTH, max_supported_record_length()); } |
866 |
+ uint max_keys() const |
867 |
+- { return min(MAX_KEY, max_supported_keys()); } |
868 |
++ { return MYSQL_MIN(MAX_KEY, max_supported_keys()); } |
869 |
+ uint max_key_parts() const |
870 |
+- { return min(MAX_REF_PARTS, max_supported_key_parts()); } |
871 |
++ { return MYSQL_MIN(MAX_REF_PARTS, max_supported_key_parts()); } |
872 |
+ uint max_key_length() const |
873 |
+- { return min(MAX_KEY_LENGTH, max_supported_key_length()); } |
874 |
++ { return MYSQL_MIN(MAX_KEY_LENGTH, max_supported_key_length()); } |
875 |
+ uint max_key_part_length() const |
876 |
+- { return min(MAX_KEY_LENGTH, max_supported_key_part_length()); } |
877 |
++ { return MYSQL_MIN(MAX_KEY_LENGTH, max_supported_key_part_length()); } |
878 |
+ |
879 |
+ virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } |
880 |
+ virtual uint max_supported_keys() const { return 0; } |
881 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/ha_partition.cc mysql/sql/ha_partition.cc |
882 |
+--- mysql.orig/sql/ha_partition.cc 2011-10-29 11:09:47.000000000 -0700 |
883 |
++++ mysql/sql/ha_partition.cc 2011-11-18 15:43:17.019774142 -0800 |
884 |
+@@ -6138,7 +6138,7 @@ |
885 |
+ { |
886 |
+ *first= bitmap_get_first_set(&(m_part_info->used_partitions)); |
887 |
+ *num_used_parts= bitmap_bits_set(&(m_part_info->used_partitions)); |
888 |
+- *check_min_num= min(MAX_PARTS_FOR_OPTIMIZER_CALLS, *num_used_parts); |
889 |
++ *check_min_num= MYSQL_MIN(MAX_PARTS_FOR_OPTIMIZER_CALLS, *num_used_parts); |
890 |
+ } |
891 |
+ |
892 |
+ |
893 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/item_buff.cc mysql/sql/item_buff.cc |
894 |
+--- mysql.orig/sql/item_buff.cc 2011-10-29 11:09:49.000000000 -0700 |
895 |
++++ mysql/sql/item_buff.cc 2011-11-18 15:43:17.020774157 -0800 |
896 |
+@@ -61,7 +61,7 @@ |
897 |
+ |
898 |
+ Cached_item_str::Cached_item_str(THD *thd, Item *arg) |
899 |
+ :item(arg), |
900 |
+- value_max_length(min(arg->max_length, thd->variables.max_sort_length)), |
901 |
++ value_max_length(MYSQL_MIN(arg->max_length, thd->variables.max_sort_length)), |
902 |
+ value(value_max_length) |
903 |
+ {} |
904 |
+ |
905 |
+@@ -71,7 +71,7 @@ |
906 |
+ bool tmp; |
907 |
+ |
908 |
+ if ((res=item->val_str(&tmp_value))) |
909 |
+- res->length(min(res->length(), value_max_length)); |
910 |
++ res->length(MYSQL_MIN(res->length(), value_max_length)); |
911 |
+ if (null_value != item->null_value) |
912 |
+ { |
913 |
+ if ((null_value= item->null_value)) |
914 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/item.cc mysql/sql/item.cc |
915 |
+--- mysql.orig/sql/item.cc 2011-10-29 11:09:49.000000000 -0700 |
916 |
++++ mysql/sql/item.cc 2011-11-18 15:43:17.021774172 -0800 |
917 |
+@@ -76,7 +76,7 @@ |
918 |
+ Hybrid_type_traits_decimal::fix_length_and_dec(Item *item, Item *arg) const |
919 |
+ { |
920 |
+ item->decimals= arg->decimals; |
921 |
+- item->max_length= min(arg->max_length + DECIMAL_LONGLONG_DIGITS, |
922 |
++ item->max_length= MYSQL_MIN(arg->max_length + DECIMAL_LONGLONG_DIGITS, |
923 |
+ DECIMAL_MAX_STR_LENGTH); |
924 |
+ } |
925 |
+ |
926 |
+@@ -444,9 +444,9 @@ |
927 |
+ { |
928 |
+ uint prec= |
929 |
+ my_decimal_length_to_precision(max_length, decimals, unsigned_flag); |
930 |
+- return min(prec, DECIMAL_MAX_PRECISION); |
931 |
++ return MYSQL_MIN(prec, DECIMAL_MAX_PRECISION); |
932 |
+ } |
933 |
+- return min(max_length, DECIMAL_MAX_PRECISION); |
934 |
++ return MYSQL_MIN(max_length, DECIMAL_MAX_PRECISION); |
935 |
+ } |
936 |
+ |
937 |
+ |
938 |
+@@ -752,7 +752,7 @@ |
939 |
+ &res_length); |
940 |
+ } |
941 |
+ else |
942 |
+- name= sql_strmake(str, (name_length= min(length,MAX_ALIAS_NAME))); |
943 |
++ name= sql_strmake(str, (name_length= MYSQL_MIN(length,MAX_ALIAS_NAME))); |
944 |
+ } |
945 |
+ |
946 |
+ |
947 |
+@@ -5416,7 +5416,7 @@ |
948 |
+ // following assert is redundant, because fixed=1 assigned in constructor |
949 |
+ DBUG_ASSERT(fixed == 1); |
950 |
+ char *end=(char*) str_value.ptr()+str_value.length(), |
951 |
+- *ptr=end-min(str_value.length(),sizeof(longlong)); |
952 |
++ *ptr=end-MYSQL_MIN(str_value.length(),sizeof(longlong)); |
953 |
+ |
954 |
+ ulonglong value=0; |
955 |
+ for (; ptr != end ; ptr++) |
956 |
+@@ -5471,7 +5471,7 @@ |
957 |
+ void Item_hex_string::print(String *str, enum_query_type query_type) |
958 |
+ { |
959 |
+ char *end= (char*) str_value.ptr() + str_value.length(), |
960 |
+- *ptr= end - min(str_value.length(), sizeof(longlong)); |
961 |
++ *ptr= end - MYSQL_MIN(str_value.length(), sizeof(longlong)); |
962 |
+ str->append("0x"); |
963 |
+ for (; ptr != end ; ptr++) |
964 |
+ { |
965 |
+@@ -7561,14 +7561,14 @@ |
966 |
+ /* fix variable decimals which always is NOT_FIXED_DEC */ |
967 |
+ if (Field::result_merge_type(fld_type) == INT_RESULT) |
968 |
+ item_decimals= 0; |
969 |
+- decimals= max(decimals, item_decimals); |
970 |
++ decimals= MYSQL_MAX(decimals, item_decimals); |
971 |
+ } |
972 |
+ if (Field::result_merge_type(fld_type) == DECIMAL_RESULT) |
973 |
+ { |
974 |
+- decimals= min(max(decimals, item->decimals), DECIMAL_MAX_SCALE); |
975 |
++ decimals= MYSQL_MIN(MYSQL_MAX(decimals, item->decimals), DECIMAL_MAX_SCALE); |
976 |
+ int item_int_part= item->decimal_int_part(); |
977 |
+- int item_prec = max(prev_decimal_int_part, item_int_part) + decimals; |
978 |
+- int precision= min(item_prec, DECIMAL_MAX_PRECISION); |
979 |
++ int item_prec = MYSQL_MAX(prev_decimal_int_part, item_int_part) + decimals; |
980 |
++ int precision= MYSQL_MIN(item_prec, DECIMAL_MAX_PRECISION); |
981 |
+ unsigned_flag&= item->unsigned_flag; |
982 |
+ max_length= my_decimal_precision_to_length_no_truncation(precision, |
983 |
+ decimals, |
984 |
+@@ -7599,7 +7599,7 @@ |
985 |
+ */ |
986 |
+ if (collation.collation != &my_charset_bin) |
987 |
+ { |
988 |
+- max_length= max(old_max_chars * collation.collation->mbmaxlen, |
989 |
++ max_length= MYSQL_MAX(old_max_chars * collation.collation->mbmaxlen, |
990 |
+ display_length(item) / |
991 |
+ item->collation.collation->mbmaxlen * |
992 |
+ collation.collation->mbmaxlen); |
993 |
+@@ -7621,7 +7621,7 @@ |
994 |
+ { |
995 |
+ int delta1= max_length_orig - decimals_orig; |
996 |
+ int delta2= item->max_length - item->decimals; |
997 |
+- max_length= max(delta1, delta2) + decimals; |
998 |
++ max_length= MYSQL_MAX(delta1, delta2) + decimals; |
999 |
+ if (fld_type == MYSQL_TYPE_FLOAT && max_length > FLT_DIG + 2) |
1000 |
+ { |
1001 |
+ max_length= MAX_FLOAT_STR_LENGTH; |
1002 |
+@@ -7639,7 +7639,7 @@ |
1003 |
+ break; |
1004 |
+ } |
1005 |
+ default: |
1006 |
+- max_length= max(max_length, display_length(item)); |
1007 |
++ max_length= MYSQL_MAX(max_length, display_length(item)); |
1008 |
+ }; |
1009 |
+ maybe_null|= item->maybe_null; |
1010 |
+ get_full_info(item); |
1011 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/item_cmpfunc.cc mysql/sql/item_cmpfunc.cc |
1012 |
+--- mysql.orig/sql/item_cmpfunc.cc 2011-10-29 11:09:49.000000000 -0700 |
1013 |
++++ mysql/sql/item_cmpfunc.cc 2011-11-18 15:43:17.022774187 -0800 |
1014 |
+@@ -628,7 +628,7 @@ |
1015 |
+ { |
1016 |
+ if ((*a)->decimals < NOT_FIXED_DEC && (*b)->decimals < NOT_FIXED_DEC) |
1017 |
+ { |
1018 |
+- precision= 5 / log_10[max((*a)->decimals, (*b)->decimals) + 1]; |
1019 |
++ precision= 5 / log_10[MYSQL_MAX((*a)->decimals, (*b)->decimals) + 1]; |
1020 |
+ if (func == &Arg_comparator::compare_real) |
1021 |
+ func= &Arg_comparator::compare_real_fixed; |
1022 |
+ else if (func == &Arg_comparator::compare_e_real) |
1023 |
+@@ -1315,7 +1315,7 @@ |
1024 |
+ owner->null_value= 0; |
1025 |
+ uint res1_length= res1->length(); |
1026 |
+ uint res2_length= res2->length(); |
1027 |
+- int cmp= memcmp(res1->ptr(), res2->ptr(), min(res1_length,res2_length)); |
1028 |
++ int cmp= memcmp(res1->ptr(), res2->ptr(), MYSQL_MIN(res1_length,res2_length)); |
1029 |
+ return cmp ? cmp : (int) (res1_length - res2_length); |
1030 |
+ } |
1031 |
+ } |
1032 |
+@@ -2447,7 +2447,7 @@ |
1033 |
+ { |
1034 |
+ agg_result_type(&hybrid_type, args, 2); |
1035 |
+ maybe_null=args[1]->maybe_null; |
1036 |
+- decimals= max(args[0]->decimals, args[1]->decimals); |
1037 |
++ decimals= MYSQL_MAX(args[0]->decimals, args[1]->decimals); |
1038 |
+ unsigned_flag= args[0]->unsigned_flag && args[1]->unsigned_flag; |
1039 |
+ |
1040 |
+ if (hybrid_type == DECIMAL_RESULT || hybrid_type == INT_RESULT) |
1041 |
+@@ -2458,10 +2458,10 @@ |
1042 |
+ int len1= args[1]->max_length - args[1]->decimals |
1043 |
+ - (args[1]->unsigned_flag ? 0 : 1); |
1044 |
+ |
1045 |
+- max_length= max(len0, len1) + decimals + (unsigned_flag ? 0 : 1); |
1046 |
++ max_length= MYSQL_MAX(len0, len1) + decimals + (unsigned_flag ? 0 : 1); |
1047 |
+ } |
1048 |
+ else |
1049 |
+- max_length= max(args[0]->max_length, args[1]->max_length); |
1050 |
++ max_length= MYSQL_MAX(args[0]->max_length, args[1]->max_length); |
1051 |
+ |
1052 |
+ switch (hybrid_type) { |
1053 |
+ case STRING_RESULT: |
1054 |
+@@ -2485,9 +2485,9 @@ |
1055 |
+ { |
1056 |
+ int arg0_int_part= args[0]->decimal_int_part(); |
1057 |
+ int arg1_int_part= args[1]->decimal_int_part(); |
1058 |
+- int max_int_part= max(arg0_int_part, arg1_int_part); |
1059 |
++ int max_int_part= MYSQL_MAX(arg0_int_part, arg1_int_part); |
1060 |
+ int precision= max_int_part + decimals; |
1061 |
+- return min(precision, DECIMAL_MAX_PRECISION); |
1062 |
++ return MYSQL_MIN(precision, DECIMAL_MAX_PRECISION); |
1063 |
+ } |
1064 |
+ |
1065 |
+ |
1066 |
+@@ -2615,7 +2615,7 @@ |
1067 |
+ Item_func_if::fix_length_and_dec() |
1068 |
+ { |
1069 |
+ maybe_null=args[1]->maybe_null || args[2]->maybe_null; |
1070 |
+- decimals= max(args[1]->decimals, args[2]->decimals); |
1071 |
++ decimals= MYSQL_MAX(args[1]->decimals, args[2]->decimals); |
1072 |
+ unsigned_flag=args[1]->unsigned_flag && args[2]->unsigned_flag; |
1073 |
+ |
1074 |
+ enum Item_result arg1_type=args[1]->result_type(); |
1075 |
+@@ -2659,10 +2659,10 @@ |
1076 |
+ int len2= args[2]->max_length - args[2]->decimals |
1077 |
+ - (args[2]->unsigned_flag ? 0 : 1); |
1078 |
+ |
1079 |
+- max_length=max(len1, len2) + decimals + (unsigned_flag ? 0 : 1); |
1080 |
++ max_length=MYSQL_MAX(len1, len2) + decimals + (unsigned_flag ? 0 : 1); |
1081 |
+ } |
1082 |
+ else |
1083 |
+- max_length= max(args[1]->max_length, args[2]->max_length); |
1084 |
++ max_length= MYSQL_MAX(args[1]->max_length, args[2]->max_length); |
1085 |
+ } |
1086 |
+ |
1087 |
+ |
1088 |
+@@ -2670,8 +2670,8 @@ |
1089 |
+ { |
1090 |
+ int arg1_prec= args[1]->decimal_int_part(); |
1091 |
+ int arg2_prec= args[2]->decimal_int_part(); |
1092 |
+- int precision=max(arg1_prec,arg2_prec) + decimals; |
1093 |
+- return min(precision, DECIMAL_MAX_PRECISION); |
1094 |
++ int precision=MYSQL_MAX(arg1_prec,arg2_prec) + decimals; |
1095 |
++ return MYSQL_MIN(precision, DECIMAL_MAX_PRECISION); |
1096 |
+ } |
1097 |
+ |
1098 |
+ |
1099 |
+@@ -3081,7 +3081,7 @@ |
1100 |
+ |
1101 |
+ if (else_expr_num != -1) |
1102 |
+ set_if_bigger(max_int_part, args[else_expr_num]->decimal_int_part()); |
1103 |
+- return min(max_int_part + decimals, DECIMAL_MAX_PRECISION); |
1104 |
++ return MYSQL_MIN(max_int_part + decimals, DECIMAL_MAX_PRECISION); |
1105 |
+ } |
1106 |
+ |
1107 |
+ |
1108 |
+@@ -4979,7 +4979,7 @@ |
1109 |
+ else |
1110 |
+ { |
1111 |
+ if (i < g) |
1112 |
+- g = i; // g = min(i, g) |
1113 |
++ g = i; // g = MYSQL_MIN(i, g) |
1114 |
+ f = i; |
1115 |
+ while (g >= 0 && pattern[g] == pattern[g + plm1 - f]) |
1116 |
+ g--; |
1117 |
+@@ -4998,7 +4998,7 @@ |
1118 |
+ else |
1119 |
+ { |
1120 |
+ if (i < g) |
1121 |
+- g = i; // g = min(i, g) |
1122 |
++ g = i; // g = MYSQL_MIN(i, g) |
1123 |
+ f = i; |
1124 |
+ while (g >= 0 && |
1125 |
+ likeconv(cs, pattern[g]) == likeconv(cs, pattern[g + plm1 - f])) |
1126 |
+@@ -5119,14 +5119,14 @@ |
1127 |
+ register const int v = plm1 - i; |
1128 |
+ turboShift = u - v; |
1129 |
+ bcShift = bmBc[(uint) (uchar) text[i + j]] - plm1 + i; |
1130 |
+- shift = max(turboShift, bcShift); |
1131 |
+- shift = max(shift, bmGs[i]); |
1132 |
++ shift = MYSQL_MAX(turboShift, bcShift); |
1133 |
++ shift = MYSQL_MAX(shift, bmGs[i]); |
1134 |
+ if (shift == bmGs[i]) |
1135 |
+- u = min(pattern_len - shift, v); |
1136 |
++ u = MYSQL_MIN(pattern_len - shift, v); |
1137 |
+ else |
1138 |
+ { |
1139 |
+ if (turboShift < bcShift) |
1140 |
+- shift = max(shift, u + 1); |
1141 |
++ shift = MYSQL_MAX(shift, u + 1); |
1142 |
+ u = 0; |
1143 |
+ } |
1144 |
+ j+= shift; |
1145 |
+@@ -5150,14 +5150,14 @@ |
1146 |
+ register const int v = plm1 - i; |
1147 |
+ turboShift = u - v; |
1148 |
+ bcShift = bmBc[(uint) likeconv(cs, text[i + j])] - plm1 + i; |
1149 |
+- shift = max(turboShift, bcShift); |
1150 |
+- shift = max(shift, bmGs[i]); |
1151 |
++ shift = MYSQL_MAX(turboShift, bcShift); |
1152 |
++ shift = MYSQL_MAX(shift, bmGs[i]); |
1153 |
+ if (shift == bmGs[i]) |
1154 |
+- u = min(pattern_len - shift, v); |
1155 |
++ u = MYSQL_MIN(pattern_len - shift, v); |
1156 |
+ else |
1157 |
+ { |
1158 |
+ if (turboShift < bcShift) |
1159 |
+- shift = max(shift, u + 1); |
1160 |
++ shift = MYSQL_MAX(shift, u + 1); |
1161 |
+ u = 0; |
1162 |
+ } |
1163 |
+ j+= shift; |
1164 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/item_func.cc mysql/sql/item_func.cc |
1165 |
+--- mysql.orig/sql/item_func.cc 2011-10-29 11:09:49.000000000 -0700 |
1166 |
++++ mysql/sql/item_func.cc 2011-11-18 15:43:17.025774233 -0800 |
1167 |
+@@ -549,7 +549,7 @@ |
1168 |
+ set_if_bigger(max_int_part, args[i]->decimal_int_part()); |
1169 |
+ set_if_smaller(unsigned_flag, args[i]->unsigned_flag); |
1170 |
+ } |
1171 |
+- int precision= min(max_int_part + decimals, DECIMAL_MAX_PRECISION); |
1172 |
++ int precision= MYSQL_MIN(max_int_part + decimals, DECIMAL_MAX_PRECISION); |
1173 |
+ max_length= my_decimal_precision_to_length_no_truncation(precision, decimals, |
1174 |
+ unsigned_flag); |
1175 |
+ } |
1176 |
+@@ -1143,10 +1143,10 @@ |
1177 |
+ */ |
1178 |
+ void Item_func_additive_op::result_precision() |
1179 |
+ { |
1180 |
+- decimals= max(args[0]->decimals, args[1]->decimals); |
1181 |
++ decimals= MYSQL_MAX(args[0]->decimals, args[1]->decimals); |
1182 |
+ int arg1_int= args[0]->decimal_precision() - args[0]->decimals; |
1183 |
+ int arg2_int= args[1]->decimal_precision() - args[1]->decimals; |
1184 |
+- int precision= max(arg1_int, arg2_int) + 1 + decimals; |
1185 |
++ int precision= MYSQL_MAX(arg1_int, arg2_int) + 1 + decimals; |
1186 |
+ |
1187 |
+ /* Integer operations keep unsigned_flag if one of arguments is unsigned */ |
1188 |
+ if (result_type() == INT_RESULT) |
1189 |
+@@ -1256,9 +1256,9 @@ |
1190 |
+ unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag; |
1191 |
+ else |
1192 |
+ unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag; |
1193 |
+- decimals= min(args[0]->decimals + args[1]->decimals, DECIMAL_MAX_SCALE); |
1194 |
++ decimals= MYSQL_MIN(args[0]->decimals + args[1]->decimals, DECIMAL_MAX_SCALE); |
1195 |
+ uint est_prec = args[0]->decimal_precision() + args[1]->decimal_precision(); |
1196 |
+- uint precision= min(est_prec, DECIMAL_MAX_PRECISION); |
1197 |
++ uint precision= MYSQL_MIN(est_prec, DECIMAL_MAX_PRECISION); |
1198 |
+ max_length= my_decimal_precision_to_length_no_truncation(precision, decimals, |
1199 |
+ unsigned_flag); |
1200 |
+ } |
1201 |
+@@ -1306,7 +1306,7 @@ |
1202 |
+ |
1203 |
+ void Item_func_div::result_precision() |
1204 |
+ { |
1205 |
+- uint precision=min(args[0]->decimal_precision() + |
1206 |
++ uint precision=MYSQL_MIN(args[0]->decimal_precision() + |
1207 |
+ args[1]->decimals + prec_increment, |
1208 |
+ DECIMAL_MAX_PRECISION); |
1209 |
+ |
1210 |
+@@ -1315,7 +1315,7 @@ |
1211 |
+ unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag; |
1212 |
+ else |
1213 |
+ unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag; |
1214 |
+- decimals= min(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE); |
1215 |
++ decimals= MYSQL_MIN(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE); |
1216 |
+ max_length= my_decimal_precision_to_length_no_truncation(precision, decimals, |
1217 |
+ unsigned_flag); |
1218 |
+ } |
1219 |
+@@ -1329,7 +1329,7 @@ |
1220 |
+ switch(hybrid_type) { |
1221 |
+ case REAL_RESULT: |
1222 |
+ { |
1223 |
+- decimals=max(args[0]->decimals,args[1]->decimals)+prec_increment; |
1224 |
++ decimals=MYSQL_MAX(args[0]->decimals,args[1]->decimals)+prec_increment; |
1225 |
+ set_if_smaller(decimals, NOT_FIXED_DEC); |
1226 |
+ uint tmp=float_length(decimals); |
1227 |
+ if (decimals == NOT_FIXED_DEC) |
1228 |
+@@ -1460,8 +1460,8 @@ |
1229 |
+ |
1230 |
+ void Item_func_mod::result_precision() |
1231 |
+ { |
1232 |
+- decimals= max(args[0]->decimals, args[1]->decimals); |
1233 |
+- max_length= max(args[0]->max_length, args[1]->max_length); |
1234 |
++ decimals= MYSQL_MAX(args[0]->decimals, args[1]->decimals); |
1235 |
++ max_length= MYSQL_MAX(args[0]->max_length, args[1]->max_length); |
1236 |
+ } |
1237 |
+ |
1238 |
+ |
1239 |
+@@ -1983,7 +1983,7 @@ |
1240 |
+ |
1241 |
+ if (args[0]->decimals == NOT_FIXED_DEC) |
1242 |
+ { |
1243 |
+- decimals= min(decimals_to_set, NOT_FIXED_DEC); |
1244 |
++ decimals= MYSQL_MIN(decimals_to_set, NOT_FIXED_DEC); |
1245 |
+ max_length= float_length(decimals); |
1246 |
+ hybrid_type= REAL_RESULT; |
1247 |
+ return; |
1248 |
+@@ -1993,7 +1993,7 @@ |
1249 |
+ case REAL_RESULT: |
1250 |
+ case STRING_RESULT: |
1251 |
+ hybrid_type= REAL_RESULT; |
1252 |
+- decimals= min(decimals_to_set, NOT_FIXED_DEC); |
1253 |
++ decimals= MYSQL_MIN(decimals_to_set, NOT_FIXED_DEC); |
1254 |
+ max_length= float_length(decimals); |
1255 |
+ break; |
1256 |
+ case INT_RESULT: |
1257 |
+@@ -2010,13 +2010,13 @@ |
1258 |
+ case DECIMAL_RESULT: |
1259 |
+ { |
1260 |
+ hybrid_type= DECIMAL_RESULT; |
1261 |
+- decimals_to_set= min(DECIMAL_MAX_SCALE, decimals_to_set); |
1262 |
++ decimals_to_set= MYSQL_MIN(DECIMAL_MAX_SCALE, decimals_to_set); |
1263 |
+ int decimals_delta= args[0]->decimals - decimals_to_set; |
1264 |
+ int precision= args[0]->decimal_precision(); |
1265 |
+ int length_increase= ((decimals_delta <= 0) || truncate) ? 0:1; |
1266 |
+ |
1267 |
+ precision-= decimals_delta - length_increase; |
1268 |
+- decimals= min(decimals_to_set, DECIMAL_MAX_SCALE); |
1269 |
++ decimals= MYSQL_MIN(decimals_to_set, DECIMAL_MAX_SCALE); |
1270 |
+ max_length= my_decimal_precision_to_length_no_truncation(precision, |
1271 |
+ decimals, |
1272 |
+ unsigned_flag); |
1273 |
+@@ -2117,7 +2117,7 @@ |
1274 |
+ my_decimal val, *value= args[0]->val_decimal(&val); |
1275 |
+ longlong dec= args[1]->val_int(); |
1276 |
+ if (dec >= 0 || args[1]->unsigned_flag) |
1277 |
+- dec= min((ulonglong) dec, decimals); |
1278 |
++ dec= MYSQL_MIN((ulonglong) dec, decimals); |
1279 |
+ else if (dec < INT_MIN) |
1280 |
+ dec= INT_MIN; |
1281 |
+ |
1282 |
+@@ -2989,7 +2989,7 @@ |
1283 |
+ free_udf(u_d); |
1284 |
+ DBUG_RETURN(TRUE); |
1285 |
+ } |
1286 |
+- func->max_length=min(initid.max_length,MAX_BLOB_WIDTH); |
1287 |
++ func->max_length=MYSQL_MIN(initid.max_length,MAX_BLOB_WIDTH); |
1288 |
+ func->maybe_null=initid.maybe_null; |
1289 |
+ const_item_cache=initid.const_item; |
1290 |
+ /* |
1291 |
+@@ -2998,7 +2998,7 @@ |
1292 |
+ */ |
1293 |
+ if (!const_item_cache && !used_tables_cache) |
1294 |
+ used_tables_cache= RAND_TABLE_BIT; |
1295 |
+- func->decimals=min(initid.decimals,NOT_FIXED_DEC); |
1296 |
++ func->decimals=MYSQL_MIN(initid.decimals,NOT_FIXED_DEC); |
1297 |
+ } |
1298 |
+ initialized=1; |
1299 |
+ if (error) |
1300 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/item_func.h mysql/sql/item_func.h |
1301 |
+--- mysql.orig/sql/item_func.h 2011-10-29 11:09:49.000000000 -0700 |
1302 |
++++ mysql/sql/item_func.h 2011-11-18 15:43:17.026774249 -0800 |
1303 |
+@@ -421,7 +421,7 @@ |
1304 |
+ const char *func_name() const { return "cast_as_unsigned"; } |
1305 |
+ void fix_length_and_dec() |
1306 |
+ { |
1307 |
+- max_length= min(args[0]->max_length, DECIMAL_MAX_PRECISION + 2); |
1308 |
++ max_length= MYSQL_MIN(args[0]->max_length, DECIMAL_MAX_PRECISION + 2); |
1309 |
+ unsigned_flag=1; |
1310 |
+ } |
1311 |
+ longlong val_int(); |
1312 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/item_strfunc.cc mysql/sql/item_strfunc.cc |
1313 |
+--- mysql.orig/sql/item_strfunc.cc 2011-10-29 11:09:49.000000000 -0700 |
1314 |
++++ mysql/sql/item_strfunc.cc 2011-11-18 15:43:17.028774280 -0800 |
1315 |
+@@ -389,7 +389,7 @@ |
1316 |
+ } |
1317 |
+ else |
1318 |
+ { |
1319 |
+- uint new_len = max(tmp_value.alloced_length() * 2, concat_len); |
1320 |
++ uint new_len = MYSQL_MAX(tmp_value.alloced_length() * 2, concat_len); |
1321 |
+ |
1322 |
+ if (tmp_value.realloc(new_len)) |
1323 |
+ goto null; |
1324 |
+@@ -750,7 +750,7 @@ |
1325 |
+ } |
1326 |
+ else |
1327 |
+ { |
1328 |
+- uint new_len = max(tmp_value.alloced_length() * 2, concat_len); |
1329 |
++ uint new_len = MYSQL_MAX(tmp_value.alloced_length() * 2, concat_len); |
1330 |
+ |
1331 |
+ if (tmp_value.realloc(new_len)) |
1332 |
+ goto null; |
1333 |
+@@ -1251,7 +1251,7 @@ |
1334 |
+ |
1335 |
+ length= res->charpos((int) length, (uint32) start); |
1336 |
+ tmp_length= res->length() - start; |
1337 |
+- length= min(length, tmp_length); |
1338 |
++ length= MYSQL_MIN(length, tmp_length); |
1339 |
+ |
1340 |
+ if (!start && (longlong) res->length() == length) |
1341 |
+ return res; |
1342 |
+@@ -1271,7 +1271,7 @@ |
1343 |
+ if (start < 0) |
1344 |
+ max_length= ((uint)(-start) > max_length) ? 0 : (uint)(-start); |
1345 |
+ else |
1346 |
+- max_length-= min((uint)(start - 1), max_length); |
1347 |
++ max_length-= MYSQL_MIN((uint)(start - 1), max_length); |
1348 |
+ } |
1349 |
+ if (arg_count == 3 && args[2]->const_item()) |
1350 |
+ { |
1351 |
+@@ -1962,7 +1962,7 @@ |
1352 |
+ if ((null_value= args[0]->null_value)) |
1353 |
+ return 0; /* purecov: inspected */ |
1354 |
+ |
1355 |
+- if (tmp_value.alloc(max(res->length(), 4 * cs->mbminlen))) |
1356 |
++ if (tmp_value.alloc(MYSQL_MAX(res->length(), 4 * cs->mbminlen))) |
1357 |
+ return str; /* purecov: inspected */ |
1358 |
+ char *to= (char *) tmp_value.ptr(); |
1359 |
+ char *to_end= to + tmp_value.alloced_length(); |
1360 |
+@@ -3114,11 +3114,11 @@ |
1361 |
+ |
1362 |
+ void Item_func_export_set::fix_length_and_dec() |
1363 |
+ { |
1364 |
+- uint length=max(args[1]->max_length,args[2]->max_length); |
1365 |
++ uint length=MYSQL_MAX(args[1]->max_length,args[2]->max_length); |
1366 |
+ uint sep_length=(arg_count > 3 ? args[3]->max_length : 1); |
1367 |
+ max_length=length*64+sep_length*63; |
1368 |
+ |
1369 |
+- if (agg_arg_charsets(collation, args+1, min(4,arg_count)-1, |
1370 |
++ if (agg_arg_charsets(collation, args+1, MYSQL_MIN(4,arg_count)-1, |
1371 |
+ MY_COLL_ALLOW_CONV, 1)) |
1372 |
+ return; |
1373 |
+ } |
1374 |
+@@ -3582,7 +3582,7 @@ |
1375 |
+ /* |
1376 |
+ -1 so we won't make tv= uuid_time for nanoseq >= (tv - uuid_time) |
1377 |
+ */ |
1378 |
+- ulong delta= min(nanoseq, (ulong) (tv - uuid_time -1)); |
1379 |
++ ulong delta= MYSQL_MIN(nanoseq, (ulong) (tv - uuid_time -1)); |
1380 |
+ tv-= delta; |
1381 |
+ nanoseq-= delta; |
1382 |
+ } |
1383 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/item_strfunc.h mysql/sql/item_strfunc.h |
1384 |
+--- mysql.orig/sql/item_strfunc.h 2011-10-29 11:09:49.000000000 -0700 |
1385 |
++++ mysql/sql/item_strfunc.h 2011-11-18 15:43:17.029774295 -0800 |
1386 |
+@@ -709,7 +709,7 @@ |
1387 |
+ collation.set(args[0]->collation); |
1388 |
+ ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 + |
1389 |
+ 2 * collation.collation->mbmaxlen; |
1390 |
+- max_length= (uint32) min(max_result_length, MAX_BLOB_WIDTH); |
1391 |
++ max_length= (uint32) MYSQL_MIN(max_result_length, MAX_BLOB_WIDTH); |
1392 |
+ } |
1393 |
+ }; |
1394 |
+ |
1395 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/item_sum.cc mysql/sql/item_sum.cc |
1396 |
+--- mysql.orig/sql/item_sum.cc 2011-10-29 11:09:49.000000000 -0700 |
1397 |
++++ mysql/sql/item_sum.cc 2011-11-18 15:43:17.031774325 -0800 |
1398 |
+@@ -1139,7 +1139,7 @@ |
1399 |
+ AVG() will divide val by count. We need to reserve digits |
1400 |
+ after decimal point as the result can be fractional. |
1401 |
+ */ |
1402 |
+- decimals= min(decimals + prec_increment, NOT_FIXED_DEC); |
1403 |
++ decimals= MYSQL_MIN(decimals + prec_increment, NOT_FIXED_DEC); |
1404 |
+ } |
1405 |
+ |
1406 |
+ |
1407 |
+@@ -1202,16 +1202,16 @@ |
1408 |
+ if (hybrid_type == DECIMAL_RESULT) |
1409 |
+ { |
1410 |
+ int precision= args[0]->decimal_precision() + prec_increment; |
1411 |
+- decimals= min(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE); |
1412 |
++ decimals= MYSQL_MIN(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE); |
1413 |
+ max_length= my_decimal_precision_to_length_no_truncation(precision, |
1414 |
+ decimals, |
1415 |
+ unsigned_flag); |
1416 |
+- f_precision= min(precision+DECIMAL_LONGLONG_DIGITS, DECIMAL_MAX_PRECISION); |
1417 |
++ f_precision= MYSQL_MIN(precision+DECIMAL_LONGLONG_DIGITS, DECIMAL_MAX_PRECISION); |
1418 |
+ f_scale= args[0]->decimals; |
1419 |
+ dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale); |
1420 |
+ } |
1421 |
+ else { |
1422 |
+- decimals= min(args[0]->decimals + prec_increment, NOT_FIXED_DEC); |
1423 |
++ decimals= MYSQL_MIN(args[0]->decimals + prec_increment, NOT_FIXED_DEC); |
1424 |
+ max_length= args[0]->max_length + prec_increment; |
1425 |
+ } |
1426 |
+ } |
1427 |
+@@ -1402,13 +1402,13 @@ |
1428 |
+ switch (args[0]->result_type()) { |
1429 |
+ case REAL_RESULT: |
1430 |
+ case STRING_RESULT: |
1431 |
+- decimals= min(args[0]->decimals + 4, NOT_FIXED_DEC); |
1432 |
++ decimals= MYSQL_MIN(args[0]->decimals + 4, NOT_FIXED_DEC); |
1433 |
+ break; |
1434 |
+ case INT_RESULT: |
1435 |
+ case DECIMAL_RESULT: |
1436 |
+ { |
1437 |
+ int precision= args[0]->decimal_precision()*2 + prec_increment; |
1438 |
+- decimals= min(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE); |
1439 |
++ decimals= MYSQL_MIN(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE); |
1440 |
+ max_length= my_decimal_precision_to_length_no_truncation(precision, |
1441 |
+ decimals, |
1442 |
+ unsigned_flag); |
1443 |
+@@ -3345,7 +3345,7 @@ |
1444 |
+ syntax of this function). If there is no ORDER BY clause, we don't |
1445 |
+ create this tree. |
1446 |
+ */ |
1447 |
+- init_tree(tree, (uint) min(thd->variables.max_heap_table_size, |
1448 |
++ init_tree(tree, (uint) MYSQL_MIN(thd->variables.max_heap_table_size, |
1449 |
+ thd->variables.sortbuff_size/16), 0, |
1450 |
+ tree_key_length, |
1451 |
+ group_concat_key_cmp_with_order , 0, NULL, (void*) this); |
1452 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/item_timefunc.cc mysql/sql/item_timefunc.cc |
1453 |
+--- mysql.orig/sql/item_timefunc.cc 2011-10-29 11:09:49.000000000 -0700 |
1454 |
++++ mysql/sql/item_timefunc.cc 2011-11-18 15:43:17.032774340 -0800 |
1455 |
+@@ -310,14 +310,14 @@ |
1456 |
+ switch (*++ptr) { |
1457 |
+ /* Year */ |
1458 |
+ case 'Y': |
1459 |
+- tmp= (char*) val + min(4, val_len); |
1460 |
++ tmp= (char*) val + MYSQL_MIN(4, val_len); |
1461 |
+ l_time->year= (int) my_strtoll10(val, &tmp, &error); |
1462 |
+ if ((int) (tmp-val) <= 2) |
1463 |
+ l_time->year= year_2000_handling(l_time->year); |
1464 |
+ val= tmp; |
1465 |
+ break; |
1466 |
+ case 'y': |
1467 |
+- tmp= (char*) val + min(2, val_len); |
1468 |
++ tmp= (char*) val + MYSQL_MIN(2, val_len); |
1469 |
+ l_time->year= (int) my_strtoll10(val, &tmp, &error); |
1470 |
+ val= tmp; |
1471 |
+ l_time->year= year_2000_handling(l_time->year); |
1472 |
+@@ -326,7 +326,7 @@ |
1473 |
+ /* Month */ |
1474 |
+ case 'm': |
1475 |
+ case 'c': |
1476 |
+- tmp= (char*) val + min(2, val_len); |
1477 |
++ tmp= (char*) val + MYSQL_MIN(2, val_len); |
1478 |
+ l_time->month= (int) my_strtoll10(val, &tmp, &error); |
1479 |
+ val= tmp; |
1480 |
+ break; |
1481 |
+@@ -343,15 +343,15 @@ |
1482 |
+ /* Day */ |
1483 |
+ case 'd': |
1484 |
+ case 'e': |
1485 |
+- tmp= (char*) val + min(2, val_len); |
1486 |
++ tmp= (char*) val + MYSQL_MIN(2, val_len); |
1487 |
+ l_time->day= (int) my_strtoll10(val, &tmp, &error); |
1488 |
+ val= tmp; |
1489 |
+ break; |
1490 |
+ case 'D': |
1491 |
+- tmp= (char*) val + min(2, val_len); |
1492 |
++ tmp= (char*) val + MYSQL_MIN(2, val_len); |
1493 |
+ l_time->day= (int) my_strtoll10(val, &tmp, &error); |
1494 |
+ /* Skip 'st, 'nd, 'th .. */ |
1495 |
+- val= tmp + min((int) (val_end-tmp), 2); |
1496 |
++ val= tmp + MYSQL_MIN((int) (val_end-tmp), 2); |
1497 |
+ break; |
1498 |
+ |
1499 |
+ /* Hour */ |
1500 |
+@@ -362,14 +362,14 @@ |
1501 |
+ /* fall through */ |
1502 |
+ case 'k': |
1503 |
+ case 'H': |
1504 |
+- tmp= (char*) val + min(2, val_len); |
1505 |
++ tmp= (char*) val + MYSQL_MIN(2, val_len); |
1506 |
+ l_time->hour= (int) my_strtoll10(val, &tmp, &error); |
1507 |
+ val= tmp; |
1508 |
+ break; |
1509 |
+ |
1510 |
+ /* Minute */ |
1511 |
+ case 'i': |
1512 |
+- tmp= (char*) val + min(2, val_len); |
1513 |
++ tmp= (char*) val + MYSQL_MIN(2, val_len); |
1514 |
+ l_time->minute= (int) my_strtoll10(val, &tmp, &error); |
1515 |
+ val= tmp; |
1516 |
+ break; |
1517 |
+@@ -377,7 +377,7 @@ |
1518 |
+ /* Second */ |
1519 |
+ case 's': |
1520 |
+ case 'S': |
1521 |
+- tmp= (char*) val + min(2, val_len); |
1522 |
++ tmp= (char*) val + MYSQL_MIN(2, val_len); |
1523 |
+ l_time->second= (int) my_strtoll10(val, &tmp, &error); |
1524 |
+ val= tmp; |
1525 |
+ break; |
1526 |
+@@ -429,7 +429,7 @@ |
1527 |
+ val= tmp; |
1528 |
+ break; |
1529 |
+ case 'j': |
1530 |
+- tmp= (char*) val + min(val_len, 3); |
1531 |
++ tmp= (char*) val + MYSQL_MIN(val_len, 3); |
1532 |
+ yearday= (int) my_strtoll10(val, &tmp, &error); |
1533 |
+ val= tmp; |
1534 |
+ break; |
1535 |
+@@ -441,7 +441,7 @@ |
1536 |
+ case 'u': |
1537 |
+ sunday_first_n_first_week_non_iso= (*ptr=='U' || *ptr== 'V'); |
1538 |
+ strict_week_number= (*ptr=='V' || *ptr=='v'); |
1539 |
+- tmp= (char*) val + min(val_len, 2); |
1540 |
++ tmp= (char*) val + MYSQL_MIN(val_len, 2); |
1541 |
+ if ((week_number= (int) my_strtoll10(val, &tmp, &error)) < 0 || |
1542 |
+ (strict_week_number && !week_number) || |
1543 |
+ week_number > 53) |
1544 |
+@@ -453,7 +453,7 @@ |
1545 |
+ case 'X': |
1546 |
+ case 'x': |
1547 |
+ strict_week_number_year_type= (*ptr=='X'); |
1548 |
+- tmp= (char*) val + min(4, val_len); |
1549 |
++ tmp= (char*) val + MYSQL_MIN(4, val_len); |
1550 |
+ strict_week_number_year= (int) my_strtoll10(val, &tmp, &error); |
1551 |
+ val= tmp; |
1552 |
+ break; |
1553 |
+@@ -598,7 +598,7 @@ |
1554 |
+ err: |
1555 |
+ { |
1556 |
+ char buff[128]; |
1557 |
+- strmake(buff, val_begin, min(length, sizeof(buff)-1)); |
1558 |
++ strmake(buff, val_begin, MYSQL_MIN(length, sizeof(buff)-1)); |
1559 |
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, |
1560 |
+ ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE), |
1561 |
+ date_time_type, buff, "str_to_date"); |
1562 |
+@@ -1830,7 +1830,7 @@ |
1563 |
+ else |
1564 |
+ { |
1565 |
+ fixed_length=0; |
1566 |
+- max_length=min(arg1->max_length, MAX_BLOB_WIDTH) * 10 * |
1567 |
++ max_length=MYSQL_MIN(arg1->max_length, MAX_BLOB_WIDTH) * 10 * |
1568 |
+ collation.collation->mbmaxlen; |
1569 |
+ set_if_smaller(max_length,MAX_BLOB_WIDTH); |
1570 |
+ } |
1571 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/key.cc mysql/sql/key.cc |
1572 |
+--- mysql.orig/sql/key.cc 2011-10-29 11:09:49.000000000 -0700 |
1573 |
++++ mysql/sql/key.cc 2011-11-18 15:43:17.033774355 -0800 |
1574 |
+@@ -128,13 +128,13 @@ |
1575 |
+ key_part->key_part_flag & HA_VAR_LENGTH_PART) |
1576 |
+ { |
1577 |
+ key_length-= HA_KEY_BLOB_LENGTH; |
1578 |
+- length= min(key_length, key_part->length); |
1579 |
++ length= MYSQL_MIN(key_length, key_part->length); |
1580 |
+ key_part->field->get_key_image(to_key, length, Field::itRAW); |
1581 |
+ to_key+= HA_KEY_BLOB_LENGTH; |
1582 |
+ } |
1583 |
+ else |
1584 |
+ { |
1585 |
+- length= min(key_length, key_part->length); |
1586 |
++ length= MYSQL_MIN(key_length, key_part->length); |
1587 |
+ Field *field= key_part->field; |
1588 |
+ CHARSET_INFO *cs= field->charset(); |
1589 |
+ uint bytes= field->get_key_image(to_key, length, Field::itRAW); |
1590 |
+@@ -218,7 +218,7 @@ |
1591 |
+ my_ptrdiff_t ptrdiff= to_record - field->table->record[0]; |
1592 |
+ field->move_field_offset(ptrdiff); |
1593 |
+ key_length-= HA_KEY_BLOB_LENGTH; |
1594 |
+- length= min(key_length, key_part->length); |
1595 |
++ length= MYSQL_MIN(key_length, key_part->length); |
1596 |
+ old_map= dbug_tmp_use_all_columns(field->table, field->table->write_set); |
1597 |
+ field->set_key_image(from_key, length); |
1598 |
+ dbug_tmp_restore_column_map(field->table->write_set, old_map); |
1599 |
+@@ -227,7 +227,7 @@ |
1600 |
+ } |
1601 |
+ else |
1602 |
+ { |
1603 |
+- length= min(key_length, key_part->length); |
1604 |
++ length= MYSQL_MIN(key_length, key_part->length); |
1605 |
+ /* skip the byte with 'uneven' bits, if used */ |
1606 |
+ memcpy(to_record + key_part->offset, from_key + used_uneven_bits |
1607 |
+ , (size_t) length - used_uneven_bits); |
1608 |
+@@ -288,7 +288,7 @@ |
1609 |
+ return 1; |
1610 |
+ continue; |
1611 |
+ } |
1612 |
+- length= min((uint) (key_end-key), store_length); |
1613 |
++ length= MYSQL_MIN((uint) (key_end-key), store_length); |
1614 |
+ if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+ |
1615 |
+ FIELDFLAG_PACK))) |
1616 |
+ { |
1617 |
+@@ -354,7 +354,7 @@ |
1618 |
+ { |
1619 |
+ field->val_str(&tmp); |
1620 |
+ if (key_part->length < field->pack_length()) |
1621 |
+- tmp.length(min(tmp.length(),key_part->length)); |
1622 |
++ tmp.length(MYSQL_MIN(tmp.length(),key_part->length)); |
1623 |
+ to->append(tmp); |
1624 |
+ } |
1625 |
+ else |
1626 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/log.cc mysql/sql/log.cc |
1627 |
+--- mysql.orig/sql/log.cc 2011-10-29 11:09:49.000000000 -0700 |
1628 |
++++ mysql/sql/log.cc 2011-11-18 15:43:17.034774370 -0800 |
1629 |
+@@ -597,11 +597,11 @@ |
1630 |
+ t.neg= 0; |
1631 |
+ |
1632 |
+ /* fill in query_time field */ |
1633 |
+- calc_time_from_sec(&t, (long) min(query_time, (longlong) TIME_MAX_VALUE_SECONDS), 0); |
1634 |
++ calc_time_from_sec(&t, (long) MYSQL_MIN(query_time, (longlong) TIME_MAX_VALUE_SECONDS), 0); |
1635 |
+ if (table->field[2]->store_time(&t, MYSQL_TIMESTAMP_TIME)) |
1636 |
+ goto err; |
1637 |
+ /* lock_time */ |
1638 |
+- calc_time_from_sec(&t, (long) min(lock_time, (longlong) TIME_MAX_VALUE_SECONDS), 0); |
1639 |
++ calc_time_from_sec(&t, (long) MYSQL_MIN(lock_time, (longlong) TIME_MAX_VALUE_SECONDS), 0); |
1640 |
+ if (table->field[3]->store_time(&t, MYSQL_TIMESTAMP_TIME)) |
1641 |
+ goto err; |
1642 |
+ /* rows_sent */ |
1643 |
+@@ -2429,7 +2429,7 @@ |
1644 |
+ { |
1645 |
+ char *p= fn_ext(log_name); |
1646 |
+ uint length= (uint) (p - log_name); |
1647 |
+- strmake(buff, log_name, min(length, FN_REFLEN-1)); |
1648 |
++ strmake(buff, log_name, MYSQL_MIN(length, FN_REFLEN-1)); |
1649 |
+ return (const char*)buff; |
1650 |
+ } |
1651 |
+ return log_name; |
1652 |
+@@ -5237,7 +5237,7 @@ |
1653 |
+ DBUG_ENTER("print_buffer_to_nt_eventlog"); |
1654 |
+ |
1655 |
+ /* Add ending CR/LF's to string, overwrite last chars if necessary */ |
1656 |
+- strmov(buffptr+min(length, buffLen-5), "\r\n\r\n"); |
1657 |
++ strmov(buffptr+MYSQL_MIN(length, buffLen-5), "\r\n\r\n"); |
1658 |
+ |
1659 |
+ setup_windows_event_source(); |
1660 |
+ if ((event= RegisterEventSource(NULL,"MySQL"))) |
1661 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/log_event.cc mysql/sql/log_event.cc |
1662 |
+--- mysql.orig/sql/log_event.cc 2011-10-29 11:09:49.000000000 -0700 |
1663 |
++++ mysql/sql/log_event.cc 2011-11-18 15:43:17.036774401 -0800 |
1664 |
+@@ -1082,7 +1082,7 @@ |
1665 |
+ of 13 bytes, whereas LOG_EVENT_MINIMAL_HEADER_LEN is 19 bytes (it's |
1666 |
+ "minimal" over the set {MySQL >=4.0}). |
1667 |
+ */ |
1668 |
+- uint header_size= min(description_event->common_header_len, |
1669 |
++ uint header_size= MYSQL_MIN(description_event->common_header_len, |
1670 |
+ LOG_EVENT_MINIMAL_HEADER_LEN); |
1671 |
+ |
1672 |
+ LOCK_MUTEX; |
1673 |
+@@ -2678,7 +2678,7 @@ |
1674 |
+ be even bigger, but this will suffice to catch most corruption |
1675 |
+ errors that can lead to a crash. |
1676 |
+ */ |
1677 |
+- if (status_vars_len > min(data_len, MAX_SIZE_LOG_EVENT_STATUS)) |
1678 |
++ if (status_vars_len > MYSQL_MIN(data_len, MAX_SIZE_LOG_EVENT_STATUS)) |
1679 |
+ { |
1680 |
+ DBUG_PRINT("info", ("status_vars_len (%u) > data_len (%lu); query= 0", |
1681 |
+ status_vars_len, data_len)); |
1682 |
+@@ -5595,7 +5595,7 @@ |
1683 |
+ char buf[UV_NAME_LEN_SIZE]; |
1684 |
+ char buf1[UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + |
1685 |
+ UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE]; |
1686 |
+- uchar buf2[max(8, DECIMAL_MAX_FIELD_SIZE + 2)], *pos= buf2; |
1687 |
++ uchar buf2[MYSQL_MAX(8, DECIMAL_MAX_FIELD_SIZE + 2)], *pos= buf2; |
1688 |
+ uint buf1_length; |
1689 |
+ ulong event_length; |
1690 |
+ |
1691 |
+@@ -7322,7 +7322,7 @@ |
1692 |
+ trigger false warnings. |
1693 |
+ */ |
1694 |
+ #ifndef HAVE_purify |
1695 |
+- DBUG_DUMP("row_data", row_data, min(length, 32)); |
1696 |
++ DBUG_DUMP("row_data", row_data, MYSQL_MIN(length, 32)); |
1697 |
+ #endif |
1698 |
+ |
1699 |
+ DBUG_ASSERT(m_rows_buf <= m_rows_cur); |
1700 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/log_event_old.cc mysql/sql/log_event_old.cc |
1701 |
+--- mysql.orig/sql/log_event_old.cc 2011-10-29 11:09:49.000000000 -0700 |
1702 |
++++ mysql/sql/log_event_old.cc 2011-11-18 15:43:17.037774417 -0800 |
1703 |
+@@ -1434,7 +1434,7 @@ |
1704 |
+ trigger false warnings. |
1705 |
+ */ |
1706 |
+ #ifndef HAVE_purify |
1707 |
+- DBUG_DUMP("row_data", row_data, min(length, 32)); |
1708 |
++ DBUG_DUMP("row_data", row_data, MYSQL_MIN(length, 32)); |
1709 |
+ #endif |
1710 |
+ |
1711 |
+ DBUG_ASSERT(m_rows_buf <= m_rows_cur); |
1712 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/mysqld.cc mysql/sql/mysqld.cc |
1713 |
+--- mysql.orig/sql/mysqld.cc 2011-10-29 11:09:49.000000000 -0700 |
1714 |
++++ mysql/sql/mysqld.cc 2011-11-18 15:43:17.039774448 -0800 |
1715 |
+@@ -3397,7 +3397,7 @@ |
1716 |
+ can't get max_connections*5 but still got no less than was |
1717 |
+ requested (value of wanted_files). |
1718 |
+ */ |
1719 |
+- max_open_files= max(max(wanted_files, max_connections*5), |
1720 |
++ max_open_files= MYSQL_MAX(MYSQL_MAX(wanted_files, max_connections*5), |
1721 |
+ open_files_limit); |
1722 |
+ files= my_set_max_open_files(max_open_files); |
1723 |
+ |
1724 |
+@@ -3409,15 +3409,15 @@ |
1725 |
+ If we have requested too much file handles than we bring |
1726 |
+ max_connections in supported bounds. |
1727 |
+ */ |
1728 |
+- max_connections= (ulong) min(files-10-TABLE_OPEN_CACHE_MIN*2, |
1729 |
++ max_connections= (ulong) MYSQL_MIN(files-10-TABLE_OPEN_CACHE_MIN*2, |
1730 |
+ max_connections); |
1731 |
+ /* |
1732 |
+ Decrease table_cache_size according to max_connections, but |
1733 |
+- not below TABLE_OPEN_CACHE_MIN. Outer min() ensures that we |
1734 |
++ not below TABLE_OPEN_CACHE_MIN. Outer MYSQL_MIN() ensures that we |
1735 |
+ never increase table_cache_size automatically (that could |
1736 |
+ happen if max_connections is decreased above). |
1737 |
+ */ |
1738 |
+- table_cache_size= (ulong) min(max((files-10-max_connections)/2, |
1739 |
++ table_cache_size= (ulong) MYSQL_MIN(MYSQL_MAX((files-10-max_connections)/2, |
1740 |
+ TABLE_OPEN_CACHE_MIN), |
1741 |
+ table_cache_size); |
1742 |
+ DBUG_PRINT("warning", |
1743 |
+@@ -5099,7 +5099,7 @@ |
1744 |
+ { |
1745 |
+ my_socket sock,new_sock; |
1746 |
+ uint error_count=0; |
1747 |
+- uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1); |
1748 |
++ uint max_used_connection= (uint) (MYSQL_MAX(ip_sock,unix_sock)+1); |
1749 |
+ fd_set readFDs,clientFDs; |
1750 |
+ THD *thd; |
1751 |
+ struct sockaddr_in cAddr; |
1752 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/net_serv.cc mysql/sql/net_serv.cc |
1753 |
+--- mysql.orig/sql/net_serv.cc 2011-10-29 11:09:49.000000000 -0700 |
1754 |
++++ mysql/sql/net_serv.cc 2011-11-18 15:43:17.039774448 -0800 |
1755 |
+@@ -755,7 +755,7 @@ |
1756 |
+ { |
1757 |
+ while (remain > 0) |
1758 |
+ { |
1759 |
+- size_t length= min(remain, net->max_packet); |
1760 |
++ size_t length= MYSQL_MIN(remain, net->max_packet); |
1761 |
+ if (net_safe_read(net, net->buff, length, alarmed)) |
1762 |
+ DBUG_RETURN(1); |
1763 |
+ update_statistics(thd_increment_bytes_received(length)); |
1764 |
+@@ -946,7 +946,7 @@ |
1765 |
+ len=uint3korr(net->buff+net->where_b); |
1766 |
+ if (!len) /* End of big multi-packet */ |
1767 |
+ goto end; |
1768 |
+- helping = max(len,*complen) + net->where_b; |
1769 |
++ helping = MYSQL_MAX(len,*complen) + net->where_b; |
1770 |
+ /* The necessary size of net->buff */ |
1771 |
+ if (helping >= net->max_packet) |
1772 |
+ { |
1773 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/opt_range.cc mysql/sql/opt_range.cc |
1774 |
+--- mysql.orig/sql/opt_range.cc 2011-10-29 11:09:49.000000000 -0700 |
1775 |
++++ mysql/sql/opt_range.cc 2011-11-18 15:43:17.041774478 -0800 |
1776 |
+@@ -2347,7 +2347,7 @@ |
1777 |
+ group_trp= get_best_group_min_max(¶m, tree); |
1778 |
+ if (group_trp) |
1779 |
+ { |
1780 |
+- param.table->quick_condition_rows= min(group_trp->records, |
1781 |
++ param.table->quick_condition_rows= MYSQL_MIN(group_trp->records, |
1782 |
+ head->file->stats.records); |
1783 |
+ if (group_trp->read_cost < best_read_time) |
1784 |
+ { |
1785 |
+@@ -3823,7 +3823,7 @@ |
1786 |
+ { |
1787 |
+ imerge_trp->read_cost= imerge_cost; |
1788 |
+ imerge_trp->records= non_cpk_scan_records + cpk_scan_records; |
1789 |
+- imerge_trp->records= min(imerge_trp->records, |
1790 |
++ imerge_trp->records= MYSQL_MIN(imerge_trp->records, |
1791 |
+ param->table->file->stats.records); |
1792 |
+ imerge_trp->range_scans= range_scans; |
1793 |
+ imerge_trp->range_scans_end= range_scans + n_child_scans; |
1794 |
+@@ -7471,7 +7471,7 @@ |
1795 |
+ param->table->quick_key_parts[key]=param->max_key_part+1; |
1796 |
+ param->table->quick_n_ranges[key]= param->n_ranges; |
1797 |
+ param->table->quick_condition_rows= |
1798 |
+- min(param->table->quick_condition_rows, records); |
1799 |
++ MYSQL_MIN(param->table->quick_condition_rows, records); |
1800 |
+ } |
1801 |
+ /* |
1802 |
+ Need to save quick_rows in any case as it is used when calculating |
1803 |
+@@ -7540,7 +7540,7 @@ |
1804 |
+ uchar *tmp_min_key, *tmp_max_key; |
1805 |
+ uint8 save_first_null_comp= param->first_null_comp; |
1806 |
+ |
1807 |
+- param->max_key_part=max(param->max_key_part,key_tree->part); |
1808 |
++ param->max_key_part=MYSQL_MAX(param->max_key_part,key_tree->part); |
1809 |
+ if (key_tree->left != &null_element) |
1810 |
+ { |
1811 |
+ /* |
1812 |
+@@ -8462,13 +8462,13 @@ |
1813 |
+ /* Do not allocate the buffers twice. */ |
1814 |
+ if (multi_range_length) |
1815 |
+ { |
1816 |
+- DBUG_ASSERT(multi_range_length == min(multi_range_count, ranges.elements)); |
1817 |
++ DBUG_ASSERT(multi_range_length == MYSQL_MIN(multi_range_count, ranges.elements)); |
1818 |
+ DBUG_RETURN(0); |
1819 |
+ } |
1820 |
+ |
1821 |
+ /* Allocate the ranges array. */ |
1822 |
+ DBUG_ASSERT(ranges.elements); |
1823 |
+- multi_range_length= min(multi_range_count, ranges.elements); |
1824 |
++ multi_range_length= MYSQL_MIN(multi_range_count, ranges.elements); |
1825 |
+ DBUG_ASSERT(multi_range_length > 0); |
1826 |
+ while (multi_range_length && ! (multi_range= (KEY_MULTI_RANGE*) |
1827 |
+ my_malloc(multi_range_length * |
1828 |
+@@ -8487,7 +8487,7 @@ |
1829 |
+ /* Allocate the handler buffer if necessary. */ |
1830 |
+ if (file->ha_table_flags() & HA_NEED_READ_RANGE_BUFFER) |
1831 |
+ { |
1832 |
+- mrange_bufsiz= min(multi_range_bufsiz, |
1833 |
++ mrange_bufsiz= MYSQL_MIN(multi_range_bufsiz, |
1834 |
+ ((uint)QUICK_SELECT_I::records + 1)* head->s->reclength); |
1835 |
+ |
1836 |
+ while (mrange_bufsiz && |
1837 |
+@@ -8568,7 +8568,7 @@ |
1838 |
+ goto end; |
1839 |
+ } |
1840 |
+ |
1841 |
+- uint count= min(multi_range_length, ranges.elements - |
1842 |
++ uint count= MYSQL_MIN(multi_range_length, ranges.elements - |
1843 |
+ (cur_range - (QUICK_RANGE**) ranges.buffer)); |
1844 |
+ if (count == 0) |
1845 |
+ { |
1846 |
+@@ -9270,7 +9270,7 @@ |
1847 |
+ |
1848 |
+ TODO |
1849 |
+ - What happens if the query groups by the MIN/MAX field, and there is no |
1850 |
+- other field as in: "select min(a) from t1 group by a" ? |
1851 |
++ other field as in: "select MYSQL_MIN(a) from t1 group by a" ? |
1852 |
+ - We assume that the general correctness of the GROUP-BY query was checked |
1853 |
+ before this point. Is this correct, or do we have to check it completely? |
1854 |
+ - Lift the limitation in condition (B3), that is, make this access method |
1855 |
+@@ -9496,7 +9496,7 @@ |
1856 |
+ cur_group_prefix_len+= cur_part->store_length; |
1857 |
+ used_key_parts_map.set_bit(key_part_nr); |
1858 |
+ ++cur_group_key_parts; |
1859 |
+- max_key_part= max(max_key_part,key_part_nr); |
1860 |
++ max_key_part= MYSQL_MAX(max_key_part,key_part_nr); |
1861 |
+ } |
1862 |
+ /* |
1863 |
+ Check that used key parts forms a prefix of the index. |
1864 |
+@@ -10132,9 +10132,9 @@ |
1865 |
+ { |
1866 |
+ double blocks_per_group= (double) num_blocks / (double) num_groups; |
1867 |
+ p_overlap= (blocks_per_group * (keys_per_subgroup - 1)) / keys_per_group; |
1868 |
+- p_overlap= min(p_overlap, 1.0); |
1869 |
++ p_overlap= MYSQL_MIN(p_overlap, 1.0); |
1870 |
+ } |
1871 |
+- io_cost= (double) min(num_groups * (1 + p_overlap), num_blocks); |
1872 |
++ io_cost= (double) MYSQL_MIN(num_groups * (1 + p_overlap), num_blocks); |
1873 |
+ } |
1874 |
+ else |
1875 |
+ io_cost= (keys_per_group > keys_per_block) ? |
1876 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/opt_range.h mysql/sql/opt_range.h |
1877 |
+--- mysql.orig/sql/opt_range.h 2011-10-29 11:09:49.000000000 -0700 |
1878 |
++++ mysql/sql/opt_range.h 2011-11-18 15:43:17.042774493 -0800 |
1879 |
+@@ -85,7 +85,7 @@ |
1880 |
+ void make_min_endpoint(key_range *kr, uint prefix_length, |
1881 |
+ key_part_map keypart_map) { |
1882 |
+ make_min_endpoint(kr); |
1883 |
+- kr->length= min(kr->length, prefix_length); |
1884 |
++ kr->length= MYSQL_MIN(kr->length, prefix_length); |
1885 |
+ kr->keypart_map&= keypart_map; |
1886 |
+ } |
1887 |
+ |
1888 |
+@@ -123,7 +123,7 @@ |
1889 |
+ void make_max_endpoint(key_range *kr, uint prefix_length, |
1890 |
+ key_part_map keypart_map) { |
1891 |
+ make_max_endpoint(kr); |
1892 |
+- kr->length= min(kr->length, prefix_length); |
1893 |
++ kr->length= MYSQL_MIN(kr->length, prefix_length); |
1894 |
+ kr->keypart_map&= keypart_map; |
1895 |
+ } |
1896 |
+ |
1897 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/protocol.cc mysql/sql/protocol.cc |
1898 |
+--- mysql.orig/sql/protocol.cc 2011-10-29 11:09:49.000000000 -0700 |
1899 |
++++ mysql/sql/protocol.cc 2011-11-18 15:43:17.042774493 -0800 |
1900 |
+@@ -168,7 +168,7 @@ |
1901 |
+ pos+=2; |
1902 |
+ |
1903 |
+ /* We can only return up to 65535 warnings in two bytes */ |
1904 |
+- uint tmp= min(total_warn_count, 65535); |
1905 |
++ uint tmp= MYSQL_MIN(total_warn_count, 65535); |
1906 |
+ int2store(pos, tmp); |
1907 |
+ pos+= 2; |
1908 |
+ } |
1909 |
+@@ -263,7 +263,7 @@ |
1910 |
+ Don't send warn count during SP execution, as the warn_list |
1911 |
+ is cleared between substatements, and mysqltest gets confused |
1912 |
+ */ |
1913 |
+- uint tmp= min(total_warn_count, 65535); |
1914 |
++ uint tmp= MYSQL_MIN(total_warn_count, 65535); |
1915 |
+ buff[0]= 254; |
1916 |
+ int2store(buff+1, tmp); |
1917 |
+ /* |
1918 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/rpl_record.cc mysql/sql/rpl_record.cc |
1919 |
+--- mysql.orig/sql/rpl_record.cc 2011-10-29 11:09:49.000000000 -0700 |
1920 |
++++ mysql/sql/rpl_record.cc 2011-11-18 15:43:17.043774508 -0800 |
1921 |
+@@ -287,7 +287,7 @@ |
1922 |
+ /* |
1923 |
+ throw away master's extra fields |
1924 |
+ */ |
1925 |
+- uint max_cols= min(tabledef->size(), cols->n_bits); |
1926 |
++ uint max_cols= MYSQL_MIN(tabledef->size(), cols->n_bits); |
1927 |
+ for (; i < max_cols; i++) |
1928 |
+ { |
1929 |
+ if (bitmap_is_set(cols, i)) |
1930 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/rpl_rli.cc mysql/sql/rpl_rli.cc |
1931 |
+--- mysql.orig/sql/rpl_rli.cc 2011-10-29 11:09:49.000000000 -0700 |
1932 |
++++ mysql/sql/rpl_rli.cc 2011-11-18 15:43:17.043774508 -0800 |
1933 |
+@@ -688,7 +688,7 @@ |
1934 |
+ ulong log_name_extension; |
1935 |
+ char log_name_tmp[FN_REFLEN]; //make a char[] from String |
1936 |
+ |
1937 |
+- strmake(log_name_tmp, log_name->ptr(), min(log_name->length(), FN_REFLEN-1)); |
1938 |
++ strmake(log_name_tmp, log_name->ptr(), MYSQL_MIN(log_name->length(), FN_REFLEN-1)); |
1939 |
+ |
1940 |
+ char *p= fn_ext(log_name_tmp); |
1941 |
+ char *p_end; |
1942 |
+@@ -698,7 +698,7 @@ |
1943 |
+ goto err; |
1944 |
+ } |
1945 |
+ // Convert 0-3 to 4 |
1946 |
+- log_pos= max(log_pos, BIN_LOG_HEADER_SIZE); |
1947 |
++ log_pos= MYSQL_MAX(log_pos, BIN_LOG_HEADER_SIZE); |
1948 |
+ /* p points to '.' */ |
1949 |
+ log_name_extension= strtoul(++p, &p_end, 10); |
1950 |
+ /* |
1951 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/rpl_utility.cc mysql/sql/rpl_utility.cc |
1952 |
+--- mysql.orig/sql/rpl_utility.cc 2011-10-29 11:09:49.000000000 -0700 |
1953 |
++++ mysql/sql/rpl_utility.cc 2011-11-18 15:43:17.044774523 -0800 |
1954 |
+@@ -182,7 +182,7 @@ |
1955 |
+ /* |
1956 |
+ We only check the initial columns for the tables. |
1957 |
+ */ |
1958 |
+- uint const cols_to_check= min(table->s->fields, size()); |
1959 |
++ uint const cols_to_check= MYSQL_MIN(table->s->fields, size()); |
1960 |
+ int error= 0; |
1961 |
+ Relay_log_info const *rli= const_cast<Relay_log_info*>(rli_arg); |
1962 |
+ |
1963 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/rpl_utility.h mysql/sql/rpl_utility.h |
1964 |
+--- mysql.orig/sql/rpl_utility.h 2011-10-29 11:09:49.000000000 -0700 |
1965 |
++++ mysql/sql/rpl_utility.h 2011-11-18 15:43:17.044774523 -0800 |
1966 |
+@@ -297,7 +297,7 @@ |
1967 |
+ do { \ |
1968 |
+ char buf[256]; \ |
1969 |
+ uint i; \ |
1970 |
+- for (i = 0 ; i < min(sizeof(buf) - 1, (BS)->n_bits) ; i++) \ |
1971 |
++ for (i = 0 ; i < MYSQL_MIN(sizeof(buf) - 1, (BS)->n_bits) ; i++) \ |
1972 |
+ buf[i] = bitmap_is_set((BS), i) ? '1' : '0'; \ |
1973 |
+ buf[i] = '\0'; \ |
1974 |
+ DBUG_PRINT((N), ((FRM), buf)); \ |
1975 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/set_var.cc mysql/sql/set_var.cc |
1976 |
+--- mysql.orig/sql/set_var.cc 2011-10-29 11:09:49.000000000 -0700 |
1977 |
++++ mysql/sql/set_var.cc 2011-11-18 15:43:17.045774539 -0800 |
1978 |
+@@ -1847,7 +1847,7 @@ |
1979 |
+ ¬_used)); |
1980 |
+ if (error_len) |
1981 |
+ { |
1982 |
+- strmake(buff, error, min(sizeof(buff) - 1, error_len)); |
1983 |
++ strmake(buff, error, MYSQL_MIN(sizeof(buff) - 1, error_len)); |
1984 |
+ goto err; |
1985 |
+ } |
1986 |
+ } |
1987 |
+@@ -4032,7 +4032,7 @@ |
1988 |
+ &error, &error_len, ¬_used); |
1989 |
+ if (error_len) |
1990 |
+ { |
1991 |
+- strmake(buff, error, min(sizeof(buff) - 1, error_len)); |
1992 |
++ strmake(buff, error, MYSQL_MIN(sizeof(buff) - 1, error_len)); |
1993 |
+ goto err; |
1994 |
+ } |
1995 |
+ return FALSE; |
1996 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/slave.cc mysql/sql/slave.cc |
1997 |
+--- mysql.orig/sql/slave.cc 2011-10-29 11:09:47.000000000 -0700 |
1998 |
++++ mysql/sql/slave.cc 2011-11-18 15:43:17.046774555 -0800 |
1999 |
+@@ -1743,7 +1743,7 @@ |
2000 |
+ special marker to say "consider we have caught up". |
2001 |
+ */ |
2002 |
+ protocol->store((longlong)(mi->rli.last_master_timestamp ? |
2003 |
+- max(0, time_diff) : 0)); |
2004 |
++ MYSQL_MAX(0, time_diff) : 0)); |
2005 |
+ } |
2006 |
+ else |
2007 |
+ { |
2008 |
+@@ -2360,7 +2360,7 @@ |
2009 |
+ exec_res= 0; |
2010 |
+ rli->cleanup_context(thd, 1); |
2011 |
+ /* chance for concurrent connection to get more locks */ |
2012 |
+- safe_sleep(thd, min(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE), |
2013 |
++ safe_sleep(thd, MYSQL_MIN(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE), |
2014 |
+ (CHECK_KILLED_FUNC)sql_slave_killed, (void*)rli); |
2015 |
+ pthread_mutex_lock(&rli->data_lock); // because of SHOW STATUS |
2016 |
+ rli->trans_retries++; |
2017 |
+@@ -4057,7 +4057,7 @@ |
2018 |
+ relay_log_pos Current log pos |
2019 |
+ pending Number of bytes already processed from the event |
2020 |
+ */ |
2021 |
+- rli->event_relay_log_pos= max(rli->event_relay_log_pos, BIN_LOG_HEADER_SIZE); |
2022 |
++ rli->event_relay_log_pos= MYSQL_MAX(rli->event_relay_log_pos, BIN_LOG_HEADER_SIZE); |
2023 |
+ my_b_seek(cur_log,rli->event_relay_log_pos); |
2024 |
+ DBUG_RETURN(cur_log); |
2025 |
+ } |
2026 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/spatial.h mysql/sql/spatial.h |
2027 |
+--- mysql.orig/sql/spatial.h 2011-10-29 11:09:49.000000000 -0700 |
2028 |
++++ mysql/sql/spatial.h 2011-11-18 15:43:17.047774570 -0800 |
2029 |
+@@ -182,8 +182,8 @@ |
2030 |
+ if (d != mbr->dimension() || d <= 0 || contains(mbr) || within(mbr)) |
2031 |
+ return 0; |
2032 |
+ |
2033 |
+- MBR intersection(max(xmin, mbr->xmin), max(ymin, mbr->ymin), |
2034 |
+- min(xmax, mbr->xmax), min(ymax, mbr->ymax)); |
2035 |
++ MBR intersection(MYSQL_MAX(xmin, mbr->xmin), MYSQL_MAX(ymin, mbr->ymin), |
2036 |
++ MYSQL_MIN(xmax, mbr->xmax), MYSQL_MIN(ymax, mbr->ymax)); |
2037 |
+ |
2038 |
+ return (d == intersection.dimension()); |
2039 |
+ } |
2040 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sp_head.cc mysql/sql/sp_head.cc |
2041 |
+--- mysql.orig/sql/sp_head.cc 2011-10-29 11:09:47.000000000 -0700 |
2042 |
++++ mysql/sql/sp_head.cc 2011-11-18 15:43:17.047774570 -0800 |
2043 |
+@@ -2481,7 +2481,7 @@ |
2044 |
+ |
2045 |
+ Item_empty_string *stmt_fld= |
2046 |
+ new Item_empty_string(col3_caption, |
2047 |
+- max(m_defstr.length, 1024)); |
2048 |
++ MYSQL_MAX(m_defstr.length, 1024)); |
2049 |
+ |
2050 |
+ stmt_fld->maybe_null= TRUE; |
2051 |
+ |
2052 |
+@@ -2682,7 +2682,7 @@ |
2053 |
+ field_list.push_back(new Item_uint("Pos", 9)); |
2054 |
+ // 1024 is for not to confuse old clients |
2055 |
+ field_list.push_back(new Item_empty_string("Instruction", |
2056 |
+- max(buffer.length(), 1024))); |
2057 |
++ MYSQL_MAX(buffer.length(), 1024))); |
2058 |
+ if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | |
2059 |
+ Protocol::SEND_EOF)) |
2060 |
+ DBUG_RETURN(1); |
2061 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_acl.cc mysql/sql/sql_acl.cc |
2062 |
+--- mysql.orig/sql/sql_acl.cc 2011-10-29 11:09:49.000000000 -0700 |
2063 |
++++ mysql/sql/sql_acl.cc 2011-11-18 15:43:17.048774585 -0800 |
2064 |
+@@ -824,7 +824,7 @@ |
2065 |
+ chars= 128; // Marker that chars existed |
2066 |
+ } |
2067 |
+ } |
2068 |
+- sort= (sort << 8) + (wild_pos ? min(wild_pos, 127) : chars); |
2069 |
++ sort= (sort << 8) + (wild_pos ? MYSQL_MIN(wild_pos, 127) : chars); |
2070 |
+ } |
2071 |
+ va_end(args); |
2072 |
+ return sort; |
2073 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_analyse.cc mysql/sql/sql_analyse.cc |
2074 |
+--- mysql.orig/sql/sql_analyse.cc 2011-10-29 11:09:49.000000000 -0700 |
2075 |
++++ mysql/sql/sql_analyse.cc 2011-11-18 15:43:17.049774600 -0800 |
2076 |
+@@ -282,16 +282,16 @@ |
2077 |
+ { |
2078 |
+ if (((longlong) info->ullval) < 0) |
2079 |
+ return 0; // Impossible to store as a negative number |
2080 |
+- ev_info->llval = -(longlong) max((ulonglong) -ev_info->llval, |
2081 |
++ ev_info->llval = -(longlong) MYSQL_MAX((ulonglong) -ev_info->llval, |
2082 |
+ info->ullval); |
2083 |
+- ev_info->min_dval = (double) -max(-ev_info->min_dval, info->dval); |
2084 |
++ ev_info->min_dval = (double) -MYSQL_MAX(-ev_info->min_dval, info->dval); |
2085 |
+ } |
2086 |
+ else // ulonglong is as big as bigint in MySQL |
2087 |
+ { |
2088 |
+ if ((check_ulonglong(num, info->integers) == DECIMAL_NUM)) |
2089 |
+ return 0; |
2090 |
+- ev_info->ullval = (ulonglong) max(ev_info->ullval, info->ullval); |
2091 |
+- ev_info->max_dval = (double) max(ev_info->max_dval, info->dval); |
2092 |
++ ev_info->ullval = (ulonglong) MYSQL_MAX(ev_info->ullval, info->ullval); |
2093 |
++ ev_info->max_dval = (double) MYSQL_MAX(ev_info->max_dval, info->dval); |
2094 |
+ } |
2095 |
+ return 1; |
2096 |
+ } // get_ev_num_info |
2097 |
+@@ -1045,7 +1045,7 @@ |
2098 |
+ my_decimal_div(E_DEC_FATAL_ERROR, &avg_val, sum+cur_sum, &num, prec_increment); |
2099 |
+ /* TODO remove this after decimal_div returns proper frac */ |
2100 |
+ my_decimal_round(E_DEC_FATAL_ERROR, &avg_val, |
2101 |
+- min(sum[cur_sum].frac + prec_increment, DECIMAL_MAX_SCALE), |
2102 |
++ MYSQL_MIN(sum[cur_sum].frac + prec_increment, DECIMAL_MAX_SCALE), |
2103 |
+ FALSE,&rounded_avg); |
2104 |
+ my_decimal2string(E_DEC_FATAL_ERROR, &rounded_avg, 0, 0, '0', s); |
2105 |
+ return s; |
2106 |
+@@ -1070,7 +1070,7 @@ |
2107 |
+ my_decimal_div(E_DEC_FATAL_ERROR, &tmp, &sum2, &num, prec_increment); |
2108 |
+ my_decimal2double(E_DEC_FATAL_ERROR, &tmp, &std_sqr); |
2109 |
+ s->set_real(((double) std_sqr <= 0.0 ? 0.0 : sqrt(std_sqr)), |
2110 |
+- min(item->decimals + prec_increment, NOT_FIXED_DEC), my_thd_charset); |
2111 |
++ MYSQL_MIN(item->decimals + prec_increment, NOT_FIXED_DEC), my_thd_charset); |
2112 |
+ |
2113 |
+ return s; |
2114 |
+ } |
2115 |
+@@ -1187,7 +1187,7 @@ |
2116 |
+ func_items[8] = new Item_proc_string("Std", 255); |
2117 |
+ func_items[8]->maybe_null = 1; |
2118 |
+ func_items[9] = new Item_proc_string("Optimal_fieldtype", |
2119 |
+- max(64, output_str_length)); |
2120 |
++ MYSQL_MAX(64, output_str_length)); |
2121 |
+ |
2122 |
+ for (uint i = 0; i < array_elements(func_items); i++) |
2123 |
+ field_list.push_back(func_items[i]); |
2124 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_cache.cc mysql/sql/sql_cache.cc |
2125 |
+--- mysql.orig/sql/sql_cache.cc 2011-10-29 11:09:47.000000000 -0700 |
2126 |
++++ mysql/sql/sql_cache.cc 2011-11-18 15:43:17.050774615 -0800 |
2127 |
+@@ -1006,7 +1006,7 @@ |
2128 |
+ } |
2129 |
+ last_result_block= header->result()->prev; |
2130 |
+ allign_size= ALIGN_SIZE(last_result_block->used); |
2131 |
+- len= max(query_cache.min_allocation_unit, allign_size); |
2132 |
++ len= MYSQL_MAX(query_cache.min_allocation_unit, allign_size); |
2133 |
+ if (last_result_block->length >= query_cache.min_allocation_unit + len) |
2134 |
+ query_cache.split_block(last_result_block,len); |
2135 |
+ |
2136 |
+@@ -2451,7 +2451,7 @@ |
2137 |
+ DBUG_ENTER("Query_cache::write_block_data"); |
2138 |
+ DBUG_PRINT("qcache", ("data: %ld, header: %ld, all header: %ld", |
2139 |
+ data_len, header_len, all_headers_len)); |
2140 |
+- Query_cache_block *block= allocate_block(max(align_len, |
2141 |
++ Query_cache_block *block= allocate_block(MYSQL_MAX(align_len, |
2142 |
+ min_allocation_unit),1, 0); |
2143 |
+ if (block != 0) |
2144 |
+ { |
2145 |
+@@ -2506,7 +2506,7 @@ |
2146 |
+ ulong append_min = get_min_append_result_data_size(); |
2147 |
+ if (last_block_free_space < data_len && |
2148 |
+ append_next_free_block(last_block, |
2149 |
+- max(tail, append_min))) |
2150 |
++ MYSQL_MAX(tail, append_min))) |
2151 |
+ last_block_free_space = last_block->length - last_block->used; |
2152 |
+ // If no space in last block (even after join) allocate new block |
2153 |
+ if (last_block_free_space < data_len) |
2154 |
+@@ -2534,7 +2534,7 @@ |
2155 |
+ // Now finally write data to the last block |
2156 |
+ if (success && last_block_free_space > 0) |
2157 |
+ { |
2158 |
+- ulong to_copy = min(data_len,last_block_free_space); |
2159 |
++ ulong to_copy = MYSQL_MIN(data_len,last_block_free_space); |
2160 |
+ DBUG_PRINT("qcache", ("use free space %lub at block 0x%lx to copy %lub", |
2161 |
+ last_block_free_space, (ulong)last_block, to_copy)); |
2162 |
+ memcpy((uchar*) last_block + last_block->used, data, to_copy); |
2163 |
+@@ -2622,8 +2622,8 @@ |
2164 |
+ if (queries_in_cache < QUERY_CACHE_MIN_ESTIMATED_QUERIES_NUMBER) |
2165 |
+ return min_result_data_size; |
2166 |
+ ulong avg_result = (query_cache_size - free_memory) / queries_in_cache; |
2167 |
+- avg_result = min(avg_result, query_cache_limit); |
2168 |
+- return max(min_result_data_size, avg_result); |
2169 |
++ avg_result = MYSQL_MIN(avg_result, query_cache_limit); |
2170 |
++ return MYSQL_MAX(min_result_data_size, avg_result); |
2171 |
+ } |
2172 |
+ |
2173 |
+ inline ulong Query_cache::get_min_append_result_data_size() |
2174 |
+@@ -2655,7 +2655,7 @@ |
2175 |
+ ulong len= data_len + all_headers_len; |
2176 |
+ ulong align_len= ALIGN_SIZE(len); |
2177 |
+ |
2178 |
+- if (!(new_block= allocate_block(max(min_size, align_len), |
2179 |
++ if (!(new_block= allocate_block(MYSQL_MAX(min_size, align_len), |
2180 |
+ min_result_data_size == 0, |
2181 |
+ all_headers_len + min_result_data_size))) |
2182 |
+ { |
2183 |
+@@ -2664,7 +2664,7 @@ |
2184 |
+ } |
2185 |
+ |
2186 |
+ new_block->n_tables = 0; |
2187 |
+- new_block->used = min(len, new_block->length); |
2188 |
++ new_block->used = MYSQL_MIN(len, new_block->length); |
2189 |
+ new_block->type = Query_cache_block::RES_INCOMPLETE; |
2190 |
+ new_block->next = new_block->prev = new_block; |
2191 |
+ Query_cache_result *header = new_block->result(); |
2192 |
+@@ -3087,7 +3087,7 @@ |
2193 |
+ DBUG_PRINT("qcache", ("len %lu, not less %d, min %lu", |
2194 |
+ len, not_less,min)); |
2195 |
+ |
2196 |
+- if (len >= min(query_cache_size, query_cache_limit)) |
2197 |
++ if (len >= MYSQL_MIN(query_cache_size, query_cache_limit)) |
2198 |
+ { |
2199 |
+ DBUG_PRINT("qcache", ("Query cache hase only %lu memory and limit %lu", |
2200 |
+ query_cache_size, query_cache_limit)); |
2201 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_class.cc mysql/sql/sql_class.cc |
2202 |
+--- mysql.orig/sql/sql_class.cc 2011-10-29 11:09:49.000000000 -0700 |
2203 |
++++ mysql/sql/sql_class.cc 2011-11-18 15:43:17.051774630 -0800 |
2204 |
+@@ -417,7 +417,7 @@ |
2205 |
+ if (max_query_len < 1) |
2206 |
+ len= thd->query_length(); |
2207 |
+ else |
2208 |
+- len= min(thd->query_length(), max_query_len); |
2209 |
++ len= MYSQL_MIN(thd->query_length(), max_query_len); |
2210 |
+ str.append('\n'); |
2211 |
+ str.append(thd->query(), len); |
2212 |
+ } |
2213 |
+@@ -432,7 +432,7 @@ |
2214 |
+ was reallocated to a larger buffer to be able to fit. |
2215 |
+ */ |
2216 |
+ DBUG_ASSERT(buffer != NULL); |
2217 |
+- length= min(str.length(), length-1); |
2218 |
++ length= MYSQL_MIN(str.length(), length-1); |
2219 |
+ memcpy(buffer, str.c_ptr_quick(), length); |
2220 |
+ /* Make sure that the new string is null terminated */ |
2221 |
+ buffer[length]= '\0'; |
2222 |
+@@ -2101,7 +2101,7 @@ |
2223 |
+ else |
2224 |
+ { |
2225 |
+ if (fixed_row_size) |
2226 |
+- used_length=min(res->length(),item->max_length); |
2227 |
++ used_length=MYSQL_MIN(res->length(),item->max_length); |
2228 |
+ else |
2229 |
+ used_length=res->length(); |
2230 |
+ if ((result_type == STRING_RESULT || is_unsafe_field_sep) && |
2231 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_client.cc mysql/sql/sql_client.cc |
2232 |
+--- mysql.orig/sql/sql_client.cc 2011-10-29 11:09:53.000000000 -0700 |
2233 |
++++ mysql/sql/sql_client.cc 2011-11-18 15:43:17.051774630 -0800 |
2234 |
+@@ -34,7 +34,7 @@ |
2235 |
+ (uint)global_system_variables.net_write_timeout); |
2236 |
+ |
2237 |
+ net->retry_count= (uint) global_system_variables.net_retry_count; |
2238 |
+- net->max_packet_size= max(global_system_variables.net_buffer_length, |
2239 |
++ net->max_packet_size= MYSQL_MAX(global_system_variables.net_buffer_length, |
2240 |
+ global_system_variables.max_allowed_packet); |
2241 |
+ #endif |
2242 |
+ } |
2243 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_connect.cc mysql/sql/sql_connect.cc |
2244 |
+--- mysql.orig/sql/sql_connect.cc 2011-10-29 11:09:49.000000000 -0700 |
2245 |
++++ mysql/sql/sql_connect.cc 2011-11-18 15:43:17.052774645 -0800 |
2246 |
+@@ -845,7 +845,7 @@ |
2247 |
+ if (thd->main_security_ctx.host) |
2248 |
+ { |
2249 |
+ if (thd->main_security_ctx.host != my_localhost) |
2250 |
+- thd->main_security_ctx.host[min(strlen(thd->main_security_ctx.host), |
2251 |
++ thd->main_security_ctx.host[MYSQL_MIN(strlen(thd->main_security_ctx.host), |
2252 |
+ HOSTNAME_LENGTH)]= 0; |
2253 |
+ thd->main_security_ctx.host_or_ip= thd->main_security_ctx.host; |
2254 |
+ } |
2255 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_parse.cc mysql/sql/sql_parse.cc |
2256 |
+--- mysql.orig/sql/sql_parse.cc 2011-10-29 11:09:47.000000000 -0700 |
2257 |
++++ mysql/sql/sql_parse.cc 2011-11-18 15:43:17.053774660 -0800 |
2258 |
+@@ -5756,7 +5756,7 @@ |
2259 |
+ return 1; |
2260 |
+ } |
2261 |
+ #ifndef DBUG_OFF |
2262 |
+- max_stack_used= max(max_stack_used, stack_used); |
2263 |
++ max_stack_used= MYSQL_MAX(max_stack_used, stack_used); |
2264 |
+ #endif |
2265 |
+ return 0; |
2266 |
+ } |
2267 |
+@@ -7286,7 +7286,7 @@ |
2268 |
+ char command[80]; |
2269 |
+ Lex_input_stream *lip= & thd->m_parser_state->m_lip; |
2270 |
+ strmake(command, lip->yylval->symbol.str, |
2271 |
+- min(lip->yylval->symbol.length, sizeof(command)-1)); |
2272 |
++ MYSQL_MIN(lip->yylval->symbol.length, sizeof(command)-1)); |
2273 |
+ my_error(ER_CANT_USE_OPTION_HERE, MYF(0), command); |
2274 |
+ return 1; |
2275 |
+ } |
2276 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_partition.cc mysql/sql/sql_partition.cc |
2277 |
+--- mysql.orig/sql/sql_partition.cc 2011-10-29 11:09:49.000000000 -0700 |
2278 |
++++ mysql/sql/sql_partition.cc 2011-11-18 15:43:17.055774692 -0800 |
2279 |
+@@ -4592,7 +4592,7 @@ |
2280 |
+ */ |
2281 |
+ start_part= 0; |
2282 |
+ end_part= new_total_partitions - (upper_2n + 1); |
2283 |
+- end_part= max(lower_2n - 1, end_part); |
2284 |
++ end_part= MYSQL_MAX(lower_2n - 1, end_part); |
2285 |
+ } |
2286 |
+ else if (new_total_partitions <= upper_2n) |
2287 |
+ { |
2288 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_plugin.cc mysql/sql/sql_plugin.cc |
2289 |
+--- mysql.orig/sql/sql_plugin.cc 2011-10-29 11:09:49.000000000 -0700 |
2290 |
++++ mysql/sql/sql_plugin.cc 2011-11-18 15:43:17.056774708 -0800 |
2291 |
+@@ -512,7 +512,7 @@ |
2292 |
+ for (i=0; |
2293 |
+ (old=(struct st_mysql_plugin *)(ptr+i*sizeof_st_plugin))->info; |
2294 |
+ i++) |
2295 |
+- memcpy(cur+i, old, min(sizeof(cur[i]), sizeof_st_plugin)); |
2296 |
++ memcpy(cur+i, old, MYSQL_MIN(sizeof(cur[i]), sizeof_st_plugin)); |
2297 |
+ |
2298 |
+ sym= cur; |
2299 |
+ } |
2300 |
+@@ -2131,7 +2131,7 @@ |
2301 |
+ &error, &error_len, ¬_used); |
2302 |
+ if (error_len) |
2303 |
+ { |
2304 |
+- strmake(buff, error, min(sizeof(buff) - 1, error_len)); |
2305 |
++ strmake(buff, error, MYSQL_MIN(sizeof(buff) - 1, error_len)); |
2306 |
+ strvalue= buff; |
2307 |
+ goto err; |
2308 |
+ } |
2309 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_prepare.cc mysql/sql/sql_prepare.cc |
2310 |
+--- mysql.orig/sql/sql_prepare.cc 2011-10-29 11:09:49.000000000 -0700 |
2311 |
++++ mysql/sql/sql_prepare.cc 2011-11-18 15:43:17.057774723 -0800 |
2312 |
+@@ -249,7 +249,7 @@ |
2313 |
+ int2store(buff+5, columns); |
2314 |
+ int2store(buff+7, stmt->param_count); |
2315 |
+ buff[9]= 0; // Guard against a 4.1 client |
2316 |
+- tmp= min(stmt->thd->total_warn_count, 65535); |
2317 |
++ tmp= MYSQL_MIN(stmt->thd->total_warn_count, 65535); |
2318 |
+ int2store(buff+10, tmp); |
2319 |
+ |
2320 |
+ /* |
2321 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_profile.cc mysql/sql/sql_profile.cc |
2322 |
+--- mysql.orig/sql/sql_profile.cc 2011-10-29 11:09:49.000000000 -0700 |
2323 |
++++ mysql/sql/sql_profile.cc 2011-11-18 15:43:17.058774738 -0800 |
2324 |
+@@ -254,7 +254,7 @@ |
2325 |
+ uint query_length_arg) |
2326 |
+ { |
2327 |
+ /* Truncate to avoid DoS attacks. */ |
2328 |
+- uint length= min(MAX_QUERY_LENGTH, query_length_arg); |
2329 |
++ uint length= MYSQL_MIN(MAX_QUERY_LENGTH, query_length_arg); |
2330 |
+ |
2331 |
+ DBUG_ASSERT(query_source == NULL); /* we don't leak memory */ |
2332 |
+ if (query_source_arg != NULL) |
2333 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_repl.cc mysql/sql/sql_repl.cc |
2334 |
+--- mysql.orig/sql/sql_repl.cc 2011-10-29 11:09:49.000000000 -0700 |
2335 |
++++ mysql/sql/sql_repl.cc 2011-11-18 15:43:17.058774738 -0800 |
2336 |
+@@ -1299,12 +1299,12 @@ |
2337 |
+ { |
2338 |
+ /* |
2339 |
+ Sometimes mi->rli.master_log_pos == 0 (it happens when the SQL thread is |
2340 |
+- not initialized), so we use a max(). |
2341 |
++ not initialized), so we use a MYSQL_MAX(). |
2342 |
+ What happens to mi->rli.master_log_pos during the initialization stages |
2343 |
+ of replication is not 100% clear, so we guard against problems using |
2344 |
+ max(). |
2345 |
+ */ |
2346 |
+- mi->master_log_pos = max(BIN_LOG_HEADER_SIZE, |
2347 |
++ mi->master_log_pos = MYSQL_MAX(BIN_LOG_HEADER_SIZE, |
2348 |
+ mi->rli.group_master_log_pos); |
2349 |
+ strmake(mi->master_log_name, mi->rli.group_master_log_name, |
2350 |
+ sizeof(mi->master_log_name)-1); |
2351 |
+@@ -1476,7 +1476,7 @@ |
2352 |
+ LEX_MASTER_INFO *lex_mi= &thd->lex->mi; |
2353 |
+ SELECT_LEX_UNIT *unit= &thd->lex->unit; |
2354 |
+ ha_rows event_count, limit_start, limit_end; |
2355 |
+- my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly |
2356 |
++ my_off_t pos = MYSQL_MAX(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly |
2357 |
+ char search_file_name[FN_REFLEN], *name; |
2358 |
+ const char *log_file_name = lex_mi->log_file_name; |
2359 |
+ pthread_mutex_t *log_lock = mysql_bin_log.get_log_lock(); |
2360 |
+@@ -1747,14 +1747,14 @@ |
2361 |
+ DBUG_RETURN(0); |
2362 |
+ |
2363 |
+ for (block_len= (uint) (my_b_get_bytes_in_buffer(file)); block_len > 0; |
2364 |
+- buffer += min(block_len, max_event_size), |
2365 |
+- block_len -= min(block_len, max_event_size)) |
2366 |
++ buffer += MYSQL_MIN(block_len, max_event_size), |
2367 |
++ block_len -= MYSQL_MIN(block_len, max_event_size)) |
2368 |
+ { |
2369 |
+ lf_info->last_pos_in_file= my_b_get_pos_in_file(file); |
2370 |
+ if (lf_info->wrote_create_file) |
2371 |
+ { |
2372 |
+ Append_block_log_event a(lf_info->thd, lf_info->thd->db, buffer, |
2373 |
+- min(block_len, max_event_size), |
2374 |
++ MYSQL_MIN(block_len, max_event_size), |
2375 |
+ lf_info->log_delayed); |
2376 |
+ if (mysql_bin_log.write(&a)) |
2377 |
+ DBUG_RETURN(1); |
2378 |
+@@ -1763,7 +1763,7 @@ |
2379 |
+ { |
2380 |
+ Begin_load_query_log_event b(lf_info->thd, lf_info->thd->db, |
2381 |
+ buffer, |
2382 |
+- min(block_len, max_event_size), |
2383 |
++ MYSQL_MIN(block_len, max_event_size), |
2384 |
+ lf_info->log_delayed); |
2385 |
+ if (mysql_bin_log.write(&b)) |
2386 |
+ DBUG_RETURN(1); |
2387 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_select.cc mysql/sql/sql_select.cc |
2388 |
+--- mysql.orig/sql/sql_select.cc 2011-10-29 11:09:47.000000000 -0700 |
2389 |
++++ mysql/sql/sql_select.cc 2011-11-18 15:43:17.061774783 -0800 |
2390 |
+@@ -3016,7 +3016,7 @@ |
2391 |
+ This is can't be to high as otherwise we are likely to use |
2392 |
+ table scan. |
2393 |
+ */ |
2394 |
+- s->worst_seeks= min((double) s->found_records / 10, |
2395 |
++ s->worst_seeks= MYSQL_MIN((double) s->found_records / 10, |
2396 |
+ (double) s->read_time*3); |
2397 |
+ if (s->worst_seeks < 2.0) // Fix for small tables |
2398 |
+ s->worst_seeks=2.0; |
2399 |
+@@ -3952,7 +3952,7 @@ |
2400 |
+ uint and_level,i,found_eq_constant; |
2401 |
+ KEY_FIELD *key_fields, *end, *field; |
2402 |
+ uint sz; |
2403 |
+- uint m= max(select_lex->max_equal_elems,1); |
2404 |
++ uint m= MYSQL_MAX(select_lex->max_equal_elems,1); |
2405 |
+ |
2406 |
+ /* |
2407 |
+ We use the same piece of memory to store both KEY_FIELD |
2408 |
+@@ -3975,7 +3975,7 @@ |
2409 |
+ can be not more than select_lex->max_equal_elems such |
2410 |
+ substitutions. |
2411 |
+ */ |
2412 |
+- sz= max(sizeof(KEY_FIELD),sizeof(SARGABLE_PARAM))* |
2413 |
++ sz= MYSQL_MAX(sizeof(KEY_FIELD),sizeof(SARGABLE_PARAM))* |
2414 |
+ (((thd->lex->current_select->cond_count+1)*2 + |
2415 |
+ thd->lex->current_select->between_count)*m+1); |
2416 |
+ if (!(key_fields=(KEY_FIELD*) thd->alloc(sz))) |
2417 |
+@@ -4138,7 +4138,7 @@ |
2418 |
+ if (map == 1) // Only one table |
2419 |
+ { |
2420 |
+ TABLE *tmp_table=join->all_tables[tablenr]; |
2421 |
+- keyuse->ref_table_rows= max(tmp_table->file->stats.records, 100); |
2422 |
++ keyuse->ref_table_rows= MYSQL_MAX(tmp_table->file->stats.records, 100); |
2423 |
+ } |
2424 |
+ } |
2425 |
+ /* |
2426 |
+@@ -4458,7 +4458,7 @@ |
2427 |
+ tmp= record_count*(tmp+keys_per_block-1)/keys_per_block; |
2428 |
+ } |
2429 |
+ else |
2430 |
+- tmp= record_count*min(tmp,s->worst_seeks); |
2431 |
++ tmp= record_count*MYSQL_MIN(tmp,s->worst_seeks); |
2432 |
+ } |
2433 |
+ } |
2434 |
+ else |
2435 |
+@@ -4625,7 +4625,7 @@ |
2436 |
+ tmp= record_count*(tmp+keys_per_block-1)/keys_per_block; |
2437 |
+ } |
2438 |
+ else |
2439 |
+- tmp= record_count*min(tmp,s->worst_seeks); |
2440 |
++ tmp= record_count*MYSQL_MIN(tmp,s->worst_seeks); |
2441 |
+ } |
2442 |
+ else |
2443 |
+ tmp= best_time; // Do nothing |
2444 |
+@@ -5575,7 +5575,7 @@ |
2445 |
+ { |
2446 |
+ uint blob_length=(uint) (join_tab->table->file->stats.mean_rec_length- |
2447 |
+ (join_tab->table->s->reclength- rec_length)); |
2448 |
+- rec_length+=(uint) max(4,blob_length); |
2449 |
++ rec_length+=(uint) MYSQL_MAX(4,blob_length); |
2450 |
+ } |
2451 |
+ join_tab->used_fields=fields; |
2452 |
+ join_tab->used_fieldlength=rec_length; |
2453 |
+@@ -10491,7 +10491,7 @@ |
2454 |
+ share->max_rows= ~(ha_rows) 0; |
2455 |
+ else |
2456 |
+ share->max_rows= (ha_rows) (((share->db_type() == heap_hton) ? |
2457 |
+- min(thd->variables.tmp_table_size, |
2458 |
++ MYSQL_MIN(thd->variables.tmp_table_size, |
2459 |
+ thd->variables.max_heap_table_size) : |
2460 |
+ thd->variables.tmp_table_size) / |
2461 |
+ share->reclength); |
2462 |
+@@ -13703,7 +13703,7 @@ |
2463 |
+ index entry. |
2464 |
+ */ |
2465 |
+ index_scan_time= select_limit/rec_per_key * |
2466 |
+- min(rec_per_key, table->file->scan_time()); |
2467 |
++ MYSQL_MIN(rec_per_key, table->file->scan_time()); |
2468 |
+ if ((ref_key < 0 && is_covering) || |
2469 |
+ (ref_key < 0 && (group || table->force_index)) || |
2470 |
+ index_scan_time < read_time) |
2471 |
+@@ -13715,7 +13715,7 @@ |
2472 |
+ if (table->quick_keys.is_set(nr)) |
2473 |
+ quick_records= table->quick_rows[nr]; |
2474 |
+ if (best_key < 0 || |
2475 |
+- (select_limit <= min(quick_records,best_records) ? |
2476 |
++ (select_limit <= MYSQL_MIN(quick_records,best_records) ? |
2477 |
+ keyinfo->key_parts < best_key_parts : |
2478 |
+ quick_records < best_records)) |
2479 |
+ { |
2480 |
+@@ -14413,7 +14413,7 @@ |
2481 |
+ count++; |
2482 |
+ if (!sortorder) |
2483 |
+ sortorder= (SORT_FIELD*) sql_alloc(sizeof(SORT_FIELD) * |
2484 |
+- (max(count, *length) + 1)); |
2485 |
++ (MYSQL_MAX(count, *length) + 1)); |
2486 |
+ pos= sort= sortorder; |
2487 |
+ |
2488 |
+ if (!pos) |
2489 |
+@@ -14535,7 +14535,7 @@ |
2490 |
+ cache->length=length+blobs*sizeof(char*); |
2491 |
+ cache->blobs=blobs; |
2492 |
+ *blob_ptr=0; /* End sequentel */ |
2493 |
+- size=max(thd->variables.join_buff_size, cache->length); |
2494 |
++ size=MYSQL_MAX(thd->variables.join_buff_size, cache->length); |
2495 |
+ if (!(cache->buff=(uchar*) my_malloc(size,MYF(0)))) |
2496 |
+ DBUG_RETURN(1); /* Don't use cache */ /* purecov: inspected */ |
2497 |
+ cache->end=cache->buff+size; |
2498 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_show.cc mysql/sql/sql_show.cc |
2499 |
+--- mysql.orig/sql/sql_show.cc 2011-10-29 11:09:49.000000000 -0700 |
2500 |
++++ mysql/sql/sql_show.cc 2011-11-18 15:43:17.063774813 -0800 |
2501 |
+@@ -753,7 +753,7 @@ |
2502 |
+ { |
2503 |
+ field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN)); |
2504 |
+ field_list.push_back(new Item_empty_string("Create View", |
2505 |
+- max(buffer.length(),1024))); |
2506 |
++ MYSQL_MAX(buffer.length(),1024))); |
2507 |
+ field_list.push_back(new Item_empty_string("character_set_client", |
2508 |
+ MY_CS_NAME_SIZE)); |
2509 |
+ field_list.push_back(new Item_empty_string("collation_connection", |
2510 |
+@@ -764,7 +764,7 @@ |
2511 |
+ field_list.push_back(new Item_empty_string("Table",NAME_CHAR_LEN)); |
2512 |
+ // 1024 is for not to confuse old clients |
2513 |
+ field_list.push_back(new Item_empty_string("Create Table", |
2514 |
+- max(buffer.length(),1024))); |
2515 |
++ MYSQL_MAX(buffer.length(),1024))); |
2516 |
+ } |
2517 |
+ |
2518 |
+ if (protocol->send_fields(&field_list, |
2519 |
+@@ -1871,7 +1871,7 @@ |
2520 |
+ pthread_mutex_lock(&tmp->LOCK_thd_data); |
2521 |
+ if (tmp->query()) |
2522 |
+ { |
2523 |
+- uint length= min(max_query_length, tmp->query_length()); |
2524 |
++ uint length= MYSQL_MIN(max_query_length, tmp->query_length()); |
2525 |
+ thd_info->query= (char*) thd->strmake(tmp->query(),length); |
2526 |
+ } |
2527 |
+ pthread_mutex_unlock(&tmp->LOCK_thd_data); |
2528 |
+@@ -2002,7 +2002,7 @@ |
2529 |
+ if (tmp->query()) |
2530 |
+ { |
2531 |
+ table->field[7]->store(tmp->query(), |
2532 |
+- min(PROCESS_LIST_INFO_WIDTH, |
2533 |
++ MYSQL_MIN(PROCESS_LIST_INFO_WIDTH, |
2534 |
+ tmp->query_length()), cs); |
2535 |
+ table->field[7]->set_notnull(); |
2536 |
+ } |
2537 |
+@@ -3267,7 +3267,7 @@ |
2538 |
+ for (ptr=tables->table->field; (field= *ptr) ; ptr++) |
2539 |
+ { |
2540 |
+ star_table_open_method= |
2541 |
+- min(star_table_open_method, |
2542 |
++ MYSQL_MIN(star_table_open_method, |
2543 |
+ schema_table->fields_info[field_indx].open_method); |
2544 |
+ if (bitmap_is_set(tables->table->read_set, field->field_index)) |
2545 |
+ { |
2546 |
+@@ -7084,7 +7084,7 @@ |
2547 |
+ |
2548 |
+ Item_empty_string *stmt_fld= |
2549 |
+ new Item_empty_string("SQL Original Statement", |
2550 |
+- max(trg_sql_original_stmt.length, 1024)); |
2551 |
++ MYSQL_MAX(trg_sql_original_stmt.length, 1024)); |
2552 |
+ |
2553 |
+ stmt_fld->maybe_null= TRUE; |
2554 |
+ |
2555 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_string.cc mysql/sql/sql_string.cc |
2556 |
+--- mysql.orig/sql/sql_string.cc 2011-10-29 11:09:49.000000000 -0700 |
2557 |
++++ mysql/sql/sql_string.cc 2011-11-18 15:43:17.064774828 -0800 |
2558 |
+@@ -699,7 +699,7 @@ |
2559 |
+ { |
2560 |
+ if (Alloced_length < str_length + space_needed) |
2561 |
+ { |
2562 |
+- if (realloc(Alloced_length + max(space_needed, grow_by) - 1)) |
2563 |
++ if (realloc(Alloced_length + MYSQL_MAX(space_needed, grow_by) - 1)) |
2564 |
+ return TRUE; |
2565 |
+ } |
2566 |
+ return FALSE; |
2567 |
+@@ -785,7 +785,7 @@ |
2568 |
+ |
2569 |
+ int stringcmp(const String *s,const String *t) |
2570 |
+ { |
2571 |
+- uint32 s_len=s->length(),t_len=t->length(),len=min(s_len,t_len); |
2572 |
++ uint32 s_len=s->length(),t_len=t->length(),len=MYSQL_MIN(s_len,t_len); |
2573 |
+ int cmp= memcmp(s->ptr(), t->ptr(), len); |
2574 |
+ return (cmp) ? cmp : (int) (s_len - t_len); |
2575 |
+ } |
2576 |
+@@ -802,7 +802,7 @@ |
2577 |
+ } |
2578 |
+ if (to->realloc(from_length)) |
2579 |
+ return from; // Actually an error |
2580 |
+- if ((to->str_length=min(from->str_length,from_length))) |
2581 |
++ if ((to->str_length=MYSQL_MIN(from->str_length,from_length))) |
2582 |
+ memcpy(to->Ptr,from->Ptr,to->str_length); |
2583 |
+ to->str_charset=from->str_charset; |
2584 |
+ return to; |
2585 |
+@@ -1003,7 +1003,7 @@ |
2586 |
+ |
2587 |
+ if (to_cs == &my_charset_bin) |
2588 |
+ { |
2589 |
+- res= min(min(nchars, to_length), from_length); |
2590 |
++ res= MYSQL_MIN(MYSQL_MIN(nchars, to_length), from_length); |
2591 |
+ memmove(to, from, res); |
2592 |
+ *from_end_pos= from + res; |
2593 |
+ *well_formed_error_pos= NULL; |
2594 |
+@@ -1189,7 +1189,7 @@ |
2595 |
+ char *t= to; |
2596 |
+ char *t_end= to + to_len - 1; // '- 1' is for the '\0' at the end |
2597 |
+ const char *f= from; |
2598 |
+- const char *f_end= from + (nbytes ? min(from_len, nbytes) : from_len); |
2599 |
++ const char *f_end= from + (nbytes ? MYSQL_MIN(from_len, nbytes) : from_len); |
2600 |
+ char *dots= to; // last safe place to append '...' |
2601 |
+ |
2602 |
+ if (!f || t == t_end) |
2603 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_table.cc mysql/sql/sql_table.cc |
2604 |
+--- mysql.orig/sql/sql_table.cc 2011-10-29 11:09:49.000000000 -0700 |
2605 |
++++ mysql/sql/sql_table.cc 2011-11-18 15:43:17.065774844 -0800 |
2606 |
+@@ -3276,7 +3276,7 @@ |
2607 |
+ if ((length=column->length) > max_key_length || |
2608 |
+ length > file->max_key_part_length()) |
2609 |
+ { |
2610 |
+- length=min(max_key_length, file->max_key_part_length()); |
2611 |
++ length=MYSQL_MIN(max_key_length, file->max_key_part_length()); |
2612 |
+ if (key->type == Key::MULTIPLE) |
2613 |
+ { |
2614 |
+ /* not a critical problem */ |
2615 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_yacc.cc mysql/sql/sql_yacc.cc |
2616 |
+--- mysql.orig/sql/sql_yacc.cc 2011-10-29 11:16:20.000000000 -0700 |
2617 |
++++ mysql/sql/sql_yacc.cc 2011-11-18 15:43:17.071774936 -0800 |
2618 |
+@@ -16217,7 +16217,7 @@ |
2619 |
+ from 0" (4 in fact), unspecified means "don't change the position |
2620 |
+ (keep the preceding value)"). |
2621 |
+ */ |
2622 |
+- Lex->mi.pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.pos); |
2623 |
++ Lex->mi.pos = MYSQL_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.pos); |
2624 |
+ } |
2625 |
+ break; |
2626 |
+ |
2627 |
+@@ -16237,7 +16237,7 @@ |
2628 |
+ { |
2629 |
+ Lex->mi.relay_log_pos = (yyvsp[(3) - (3)].ulong_num); |
2630 |
+ /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */ |
2631 |
+- Lex->mi.relay_log_pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos); |
2632 |
++ Lex->mi.relay_log_pos = MYSQL_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos); |
2633 |
+ } |
2634 |
+ break; |
2635 |
+ |
2636 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/sql_yacc.yy mysql/sql/sql_yacc.yy |
2637 |
+--- mysql.orig/sql/sql_yacc.yy 2011-10-29 11:09:47.000000000 -0700 |
2638 |
++++ mysql/sql/sql_yacc.yy 2011-11-18 15:43:17.075774996 -0800 |
2639 |
+@@ -1807,7 +1807,7 @@ |
2640 |
+ from 0" (4 in fact), unspecified means "don't change the position |
2641 |
+ (keep the preceding value)"). |
2642 |
+ */ |
2643 |
+- Lex->mi.pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.pos); |
2644 |
++ Lex->mi.pos = MYSQL_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.pos); |
2645 |
+ } |
2646 |
+ | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys |
2647 |
+ { |
2648 |
+@@ -1817,7 +1817,7 @@ |
2649 |
+ { |
2650 |
+ Lex->mi.relay_log_pos = $3; |
2651 |
+ /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */ |
2652 |
+- Lex->mi.relay_log_pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos); |
2653 |
++ Lex->mi.relay_log_pos = MYSQL_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos); |
2654 |
+ } |
2655 |
+ ; |
2656 |
+ |
2657 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/thr_malloc.cc mysql/sql/thr_malloc.cc |
2658 |
+--- mysql.orig/sql/thr_malloc.cc 2011-10-29 11:09:49.000000000 -0700 |
2659 |
++++ mysql/sql/thr_malloc.cc 2011-11-18 15:43:17.076775012 -0800 |
2660 |
+@@ -132,7 +132,7 @@ |
2661 |
+ if ((from_cs == &my_charset_bin) || (to_cs == &my_charset_bin)) |
2662 |
+ { |
2663 |
+ // Safety if to_cs->mbmaxlen > 0 |
2664 |
+- new_length= min(arg_length, max_res_length); |
2665 |
++ new_length= MYSQL_MIN(arg_length, max_res_length); |
2666 |
+ memcpy(pos, str, new_length); |
2667 |
+ } |
2668 |
+ else |
2669 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/tztime.cc mysql/sql/tztime.cc |
2670 |
+--- mysql.orig/sql/tztime.cc 2011-10-29 11:09:49.000000000 -0700 |
2671 |
++++ mysql/sql/tztime.cc 2011-11-18 15:43:17.076775012 -0800 |
2672 |
+@@ -169,7 +169,7 @@ |
2673 |
+ uchar buf[sizeof(struct tzhead) + sizeof(my_time_t) * TZ_MAX_TIMES + |
2674 |
+ TZ_MAX_TIMES + sizeof(TRAN_TYPE_INFO) * TZ_MAX_TYPES + |
2675 |
+ #ifdef ABBR_ARE_USED |
2676 |
+- max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1))) + |
2677 |
++ MYSQL_MAX(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1))) + |
2678 |
+ #endif |
2679 |
+ sizeof(LS_INFO) * TZ_MAX_LEAPS]; |
2680 |
+ } u; |
2681 |
+@@ -398,7 +398,7 @@ |
2682 |
+ Let us choose end_t as point before next time type change or leap |
2683 |
+ second correction. |
2684 |
+ */ |
2685 |
+- end_t= min((next_trans_idx < sp->timecnt) ? sp->ats[next_trans_idx] - 1: |
2686 |
++ end_t= MYSQL_MIN((next_trans_idx < sp->timecnt) ? sp->ats[next_trans_idx] - 1: |
2687 |
+ MY_TIME_T_MAX, |
2688 |
+ (next_leap_idx < sp->leapcnt) ? |
2689 |
+ sp->lsis[next_leap_idx].ls_trans - 1: MY_TIME_T_MAX); |
2690 |
+@@ -1825,7 +1825,7 @@ |
2691 |
+ uchar types[TZ_MAX_TIMES]; |
2692 |
+ TRAN_TYPE_INFO ttis[TZ_MAX_TYPES]; |
2693 |
+ #ifdef ABBR_ARE_USED |
2694 |
+- char chars[max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1)))]; |
2695 |
++ char chars[MYSQL_MAX(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1)))]; |
2696 |
+ #endif |
2697 |
+ /* |
2698 |
+ Used as a temporary tz_info until we decide that we actually want to |
2699 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql/unireg.cc mysql/sql/unireg.cc |
2700 |
+--- mysql.orig/sql/unireg.cc 2011-10-29 11:09:49.000000000 -0700 |
2701 |
++++ mysql/sql/unireg.cc 2011-11-18 15:43:17.077775028 -0800 |
2702 |
+@@ -498,7 +498,7 @@ |
2703 |
+ } |
2704 |
+ cfield->row=(uint8) row; |
2705 |
+ cfield->col=(uint8) (length+1); |
2706 |
+- cfield->sc_length=(uint8) min(cfield->length,cols-(length+2)); |
2707 |
++ cfield->sc_length=(uint8) MYSQL_MIN(cfield->length,cols-(length+2)); |
2708 |
+ } |
2709 |
+ length=(uint) (pos-start_screen); |
2710 |
+ int2store(start_screen,length); |
2711 |
+@@ -718,7 +718,7 @@ |
2712 |
+ DBUG_RETURN(1); |
2713 |
+ } |
2714 |
+ /* Hack to avoid bugs with small static rows in MySQL */ |
2715 |
+- reclength=max(file->min_record_length(table_options),reclength); |
2716 |
++ reclength=MYSQL_MAX(file->min_record_length(table_options),reclength); |
2717 |
+ if (info_length+(ulong) create_fields.elements*FCOMP+288+ |
2718 |
+ n_length+int_length+com_length > 65535L || int_count > 255) |
2719 |
+ { |
2720 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql-common/client.c mysql/sql-common/client.c |
2721 |
+--- mysql.orig/sql-common/client.c 2011-10-29 11:09:49.000000000 -0700 |
2722 |
++++ mysql/sql-common/client.c 2011-11-18 15:43:17.077775028 -0800 |
2723 |
+@@ -730,7 +730,7 @@ |
2724 |
+ } |
2725 |
+ |
2726 |
+ (void) strmake(net->last_error,(char*) pos, |
2727 |
+- min((uint) len,(uint) sizeof(net->last_error)-1)); |
2728 |
++ MYSQL_MIN((uint) len,(uint) sizeof(net->last_error)-1)); |
2729 |
+ } |
2730 |
+ else |
2731 |
+ set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate); |
2732 |
+@@ -2104,7 +2104,7 @@ |
2733 |
+ { |
2734 |
+ IF_DBUG(char ipaddr[18];) |
2735 |
+ memcpy(&sock_addr.sin_addr, hp->h_addr_list[i], |
2736 |
+- min(sizeof(sock_addr.sin_addr), (size_t) hp->h_length)); |
2737 |
++ MYSQL_MIN(sizeof(sock_addr.sin_addr), (size_t) hp->h_length)); |
2738 |
+ DBUG_PRINT("info",("Trying %s...", |
2739 |
+ (my_inet_ntoa(sock_addr.sin_addr, ipaddr), ipaddr))); |
2740 |
+ status= my_connect(sock, (struct sockaddr *) &sock_addr, |
2741 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/sql-common/my_time.c mysql/sql-common/my_time.c |
2742 |
+--- mysql.orig/sql-common/my_time.c 2011-10-29 11:09:49.000000000 -0700 |
2743 |
++++ mysql/sql-common/my_time.c 2011-11-18 15:43:17.078775044 -0800 |
2744 |
+@@ -251,7 +251,7 @@ |
2745 |
+ 2003-03-03 20:00:20 AM |
2746 |
+ 20:00:20.000000 AM 03-03-2000 |
2747 |
+ */ |
2748 |
+- i= max((uint) format_position[0], (uint) format_position[1]); |
2749 |
++ i= MYSQL_MAX((uint) format_position[0], (uint) format_position[1]); |
2750 |
+ set_if_bigger(i, (uint) format_position[2]); |
2751 |
+ allow_space= ((1 << i) | (1 << format_position[6])); |
2752 |
+ allow_space&= (1 | 2 | 4 | 8); |
2753 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/csv/ha_tina.cc mysql/storage/csv/ha_tina.cc |
2754 |
+--- mysql.orig/storage/csv/ha_tina.cc 2011-10-29 11:09:49.000000000 -0700 |
2755 |
++++ mysql/storage/csv/ha_tina.cc 2011-11-18 15:43:17.079775059 -0800 |
2756 |
+@@ -1195,7 +1195,7 @@ |
2757 |
+ if (closest_hole == chain_ptr) /* no more chains */ |
2758 |
+ *end_pos= file_buff->end(); |
2759 |
+ else |
2760 |
+- *end_pos= min(file_buff->end(), |
2761 |
++ *end_pos= MYSQL_MIN(file_buff->end(), |
2762 |
+ closest_hole->begin); |
2763 |
+ return (closest_hole != chain_ptr) && (*end_pos == closest_hole->begin); |
2764 |
+ } |
2765 |
+@@ -1431,7 +1431,7 @@ |
2766 |
+ /* write repaired file */ |
2767 |
+ while (1) |
2768 |
+ { |
2769 |
+- write_end= min(file_buff->end(), current_position); |
2770 |
++ write_end= MYSQL_MIN(file_buff->end(), current_position); |
2771 |
+ if ((write_end - write_begin) && |
2772 |
+ (my_write(repair_file, (uchar*)file_buff->ptr(), |
2773 |
+ (size_t) (write_end - write_begin), MYF_RW))) |
2774 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/example/ha_example.h mysql/storage/example/ha_example.h |
2775 |
+--- mysql.orig/storage/example/ha_example.h 2011-10-29 11:09:49.000000000 -0700 |
2776 |
++++ mysql/storage/example/ha_example.h 2011-11-18 15:43:17.079775059 -0800 |
2777 |
+@@ -112,14 +112,14 @@ |
2778 |
+ max_supported_key_parts(), uint max_supported_key_length() |
2779 |
+ to make sure that the storage engine can handle the data it is about to |
2780 |
+ send. Return *real* limits of your storage engine here; MySQL will do |
2781 |
+- min(your_limits, MySQL_limits) automatically. |
2782 |
++ MYSQL_MIN(your_limits, MySQL_limits) automatically. |
2783 |
+ */ |
2784 |
+ uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } |
2785 |
+ |
2786 |
+ /** @brief |
2787 |
+ unireg.cc will call this to make sure that the storage engine can handle |
2788 |
+ the data it is about to send. Return *real* limits of your storage engine |
2789 |
+- here; MySQL will do min(your_limits, MySQL_limits) automatically. |
2790 |
++ here; MySQL will do MYSQL_MIN(your_limits, MySQL_limits) automatically. |
2791 |
+ |
2792 |
+ @details |
2793 |
+ There is no need to implement ..._key_... methods if your engine doesn't |
2794 |
+@@ -130,7 +130,7 @@ |
2795 |
+ /** @brief |
2796 |
+ unireg.cc will call this to make sure that the storage engine can handle |
2797 |
+ the data it is about to send. Return *real* limits of your storage engine |
2798 |
+- here; MySQL will do min(your_limits, MySQL_limits) automatically. |
2799 |
++ here; MySQL will do MYSQL_MIN(your_limits, MySQL_limits) automatically. |
2800 |
+ |
2801 |
+ @details |
2802 |
+ There is no need to implement ..._key_... methods if your engine doesn't |
2803 |
+@@ -141,7 +141,7 @@ |
2804 |
+ /** @brief |
2805 |
+ unireg.cc will call this to make sure that the storage engine can handle |
2806 |
+ the data it is about to send. Return *real* limits of your storage engine |
2807 |
+- here; MySQL will do min(your_limits, MySQL_limits) automatically. |
2808 |
++ here; MySQL will do MYSQL_MIN(your_limits, MySQL_limits) automatically. |
2809 |
+ |
2810 |
+ @details |
2811 |
+ There is no need to implement ..._key_... methods if your engine doesn't |
2812 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/federated/ha_federated.cc mysql/storage/federated/ha_federated.cc |
2813 |
+--- mysql.orig/storage/federated/ha_federated.cc 2011-10-29 11:09:49.000000000 -0700 |
2814 |
++++ mysql/storage/federated/ha_federated.cc 2011-11-18 15:43:17.080775074 -0800 |
2815 |
+@@ -546,7 +546,7 @@ |
2816 |
+ size_t buf_len; |
2817 |
+ DBUG_ENTER("ha_federated parse_url_error"); |
2818 |
+ |
2819 |
+- buf_len= min(table->s->connect_string.length, |
2820 |
++ buf_len= MYSQL_MIN(table->s->connect_string.length, |
2821 |
+ FEDERATED_QUERY_BUFFER_SIZE-1); |
2822 |
+ strmake(buf, table->s->connect_string.str, buf_len); |
2823 |
+ my_error(error_num, MYF(0), buf); |
2824 |
+@@ -1291,7 +1291,7 @@ |
2825 |
+ { |
2826 |
+ Field *field= key_part->field; |
2827 |
+ uint store_length= key_part->store_length; |
2828 |
+- uint part_length= min(store_length, length); |
2829 |
++ uint part_length= MYSQL_MIN(store_length, length); |
2830 |
+ needs_quotes= field->str_needs_quotes(); |
2831 |
+ DBUG_DUMP("key, start of loop", ptr, length); |
2832 |
+ |
2833 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/heap/hp_create.c mysql/storage/heap/hp_create.c |
2834 |
+--- mysql.orig/storage/heap/hp_create.c 2011-10-29 11:09:47.000000000 -0700 |
2835 |
++++ mysql/storage/heap/hp_create.c 2011-11-18 15:43:17.080775074 -0800 |
2836 |
+@@ -230,7 +230,7 @@ |
2837 |
+ { |
2838 |
+ uint i,recbuffer,records_in_block; |
2839 |
+ |
2840 |
+- max_records= max(min_records,max_records); |
2841 |
++ max_records= MYSQL_MAX(min_records,max_records); |
2842 |
+ if (!max_records) |
2843 |
+ max_records= 1000; /* As good as quess as anything */ |
2844 |
+ recbuffer= (uint) (reclength + sizeof(uchar**) - 1) & ~(sizeof(uchar**) - 1); |
2845 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/heap/hp_test2.c mysql/storage/heap/hp_test2.c |
2846 |
+--- mysql.orig/storage/heap/hp_test2.c 2011-10-29 11:09:49.000000000 -0700 |
2847 |
++++ mysql/storage/heap/hp_test2.c 2011-11-18 15:43:17.081775089 -0800 |
2848 |
+@@ -138,7 +138,7 @@ |
2849 |
+ |
2850 |
+ for (i=0 ; i < recant ; i++) |
2851 |
+ { |
2852 |
+- n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*5,MAX_RECORDS)); |
2853 |
++ n1=rnd(1000); n2=rnd(100); n3=rnd(MYSQL_MIN(recant*5,MAX_RECORDS)); |
2854 |
+ make_record(record,n1,n2,n3,"Pos",write_count); |
2855 |
+ |
2856 |
+ if (heap_write(file,record)) |
2857 |
+@@ -219,7 +219,7 @@ |
2858 |
+ printf("- Update\n"); |
2859 |
+ for (i=0 ; i < write_count/10 ; i++) |
2860 |
+ { |
2861 |
+- n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*2,MAX_RECORDS)); |
2862 |
++ n1=rnd(1000); n2=rnd(100); n3=rnd(MYSQL_MIN(recant*2,MAX_RECORDS)); |
2863 |
+ make_record(record2, n1, n2, n3, "XXX", update); |
2864 |
+ if (rnd(2) == 1) |
2865 |
+ { |
2866 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/innobase/include/ut0byte.h mysql/storage/innobase/include/ut0byte.h |
2867 |
+--- mysql.orig/storage/innobase/include/ut0byte.h 2011-10-29 11:09:49.000000000 -0700 |
2868 |
++++ mysql/storage/innobase/include/ut0byte.h 2011-11-18 15:43:17.081775089 -0800 |
2869 |
+@@ -87,7 +87,7 @@ |
2870 |
+ dulint |
2871 |
+ ut_dulint_get_max( |
2872 |
+ /*==============*/ |
2873 |
+- /* out: max(a, b) */ |
2874 |
++ /* out: MYSQL_MAX(a, b) */ |
2875 |
+ dulint a, /* in: dulint */ |
2876 |
+ dulint b); /* in: dulint */ |
2877 |
+ /*********************************************************** |
2878 |
+@@ -96,7 +96,7 @@ |
2879 |
+ dulint |
2880 |
+ ut_dulint_get_min( |
2881 |
+ /*==============*/ |
2882 |
+- /* out: min(a, b) */ |
2883 |
++ /* out: MYSQL_MIN(a, b) */ |
2884 |
+ dulint a, /* in: dulint */ |
2885 |
+ dulint b); /* in: dulint */ |
2886 |
+ /*********************************************************** |
2887 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/innodb_plugin/dict/dict0dict.c mysql/storage/innodb_plugin/dict/dict0dict.c |
2888 |
+--- mysql.orig/storage/innodb_plugin/dict/dict0dict.c 2011-10-29 11:09:48.000000000 -0700 |
2889 |
++++ mysql/storage/innodb_plugin/dict/dict0dict.c 2011-11-18 15:43:17.082775104 -0800 |
2890 |
+@@ -4860,7 +4860,7 @@ |
2891 |
+ |
2892 |
+ /**********************************************************************//** |
2893 |
+ In case there is more than one index with the same name return the index |
2894 |
+-with the min(id). |
2895 |
++with the MYSQL_MIN(id). |
2896 |
+ @return index, NULL if does not exist */ |
2897 |
+ UNIV_INTERN |
2898 |
+ dict_index_t* |
2899 |
+@@ -4870,7 +4870,7 @@ |
2900 |
+ const char* name) /*!< in: name of the index to find */ |
2901 |
+ { |
2902 |
+ dict_index_t* index; |
2903 |
+- dict_index_t* min_index; /* Index with matching name and min(id) */ |
2904 |
++ dict_index_t* min_index; /* Index with matching name and MYSQL_MIN(id) */ |
2905 |
+ |
2906 |
+ min_index = NULL; |
2907 |
+ index = dict_table_get_first_index(table); |
2908 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/innodb_plugin/include/dict0dict.h mysql/storage/innodb_plugin/include/dict0dict.h |
2909 |
+--- mysql.orig/storage/innodb_plugin/include/dict0dict.h 2011-10-29 11:09:47.000000000 -0700 |
2910 |
++++ mysql/storage/innodb_plugin/include/dict0dict.h 2011-11-18 15:43:17.082775104 -0800 |
2911 |
+@@ -1123,7 +1123,7 @@ |
2912 |
+ const char* name); /*!< in: name of the index to find */ |
2913 |
+ /**********************************************************************//** |
2914 |
+ In case there is more than one index with the same name return the index |
2915 |
+-with the min(id). |
2916 |
++with the MYSQL_MIN(id). |
2917 |
+ @return index, NULL if does not exist */ |
2918 |
+ UNIV_INTERN |
2919 |
+ dict_index_t* |
2920 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/ft_boolean_search.c mysql/storage/myisam/ft_boolean_search.c |
2921 |
+--- mysql.orig/storage/myisam/ft_boolean_search.c 2011-10-29 11:09:47.000000000 -0700 |
2922 |
++++ mysql/storage/myisam/ft_boolean_search.c 2011-11-18 15:43:17.083775119 -0800 |
2923 |
+@@ -49,9 +49,9 @@ |
2924 |
+ three subexpressions (including the top-level one), |
2925 |
+ every one has its own max_docid, updated by its plus word. |
2926 |
+ but for the search word6 uses |
2927 |
+- max(word1.max_docid, word3.max_docid, word5.max_docid), |
2928 |
++ MYSQL_MAX(word1.max_docid, word3.max_docid, word5.max_docid), |
2929 |
+ while word4 uses, accordingly, |
2930 |
+- max(word1.max_docid, word3.max_docid). |
2931 |
++ MYSQL_MAX(word1.max_docid, word3.max_docid). |
2932 |
+ */ |
2933 |
+ |
2934 |
+ #define FT_CORE |
2935 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/ha_myisam.cc mysql/storage/myisam/ha_myisam.cc |
2936 |
+--- mysql.orig/storage/myisam/ha_myisam.cc 2011-10-29 11:09:47.000000000 -0700 |
2937 |
++++ mysql/storage/myisam/ha_myisam.cc 2011-11-18 15:43:17.083775119 -0800 |
2938 |
+@@ -1546,7 +1546,7 @@ |
2939 |
+ { |
2940 |
+ DBUG_ENTER("ha_myisam::start_bulk_insert"); |
2941 |
+ THD *thd= current_thd; |
2942 |
+- ulong size= min(thd->variables.read_buff_size, |
2943 |
++ ulong size= MYSQL_MIN(thd->variables.read_buff_size, |
2944 |
+ (ulong) (table->s->avg_row_length*rows)); |
2945 |
+ DBUG_PRINT("info",("start_bulk_insert: rows %lu size %lu", |
2946 |
+ (ulong) rows, size)); |
2947 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/mi_cache.c mysql/storage/myisam/mi_cache.c |
2948 |
+--- mysql.orig/storage/myisam/mi_cache.c 2011-10-29 11:09:52.000000000 -0700 |
2949 |
++++ mysql/storage/myisam/mi_cache.c 2011-11-18 15:43:17.084775134 -0800 |
2950 |
+@@ -61,7 +61,7 @@ |
2951 |
+ (my_off_t) (info->read_end - info->request_pos)) |
2952 |
+ { |
2953 |
+ in_buff_pos=info->request_pos+(uint) offset; |
2954 |
+- in_buff_length= min(length, (size_t) (info->read_end-in_buff_pos)); |
2955 |
++ in_buff_length= MYSQL_MIN(length, (size_t) (info->read_end-in_buff_pos)); |
2956 |
+ memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length); |
2957 |
+ if (!(length-=in_buff_length)) |
2958 |
+ DBUG_RETURN(0); |
2959 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/mi_check.c mysql/storage/myisam/mi_check.c |
2960 |
+--- mysql.orig/storage/myisam/mi_check.c 2011-10-29 11:09:47.000000000 -0700 |
2961 |
++++ mysql/storage/myisam/mi_check.c 2011-11-18 15:43:17.085775150 -0800 |
2962 |
+@@ -2175,7 +2175,7 @@ |
2963 |
+ ulong buff_length; |
2964 |
+ DBUG_ENTER("filecopy"); |
2965 |
+ |
2966 |
+- buff_length=(ulong) min(param->write_buffer_length,length); |
2967 |
++ buff_length=(ulong) MYSQL_MIN(param->write_buffer_length,length); |
2968 |
+ if (!(buff=my_malloc(buff_length,MYF(0)))) |
2969 |
+ { |
2970 |
+ buff=tmp_buff; buff_length=IO_SIZE; |
2971 |
+@@ -2331,7 +2331,7 @@ |
2972 |
+ init_alloc_root(&sort_param.wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0); |
2973 |
+ |
2974 |
+ if (share->data_file_type == DYNAMIC_RECORD) |
2975 |
+- length=max(share->base.min_pack_length+1,share->base.min_block_length); |
2976 |
++ length=MYSQL_MAX(share->base.min_pack_length+1,share->base.min_block_length); |
2977 |
+ else if (share->data_file_type == COMPRESSED_RECORD) |
2978 |
+ length=share->base.min_block_length; |
2979 |
+ else |
2980 |
+@@ -2420,7 +2420,7 @@ |
2981 |
+ (see _create_index_by_sort) |
2982 |
+ */ |
2983 |
+ sort_info.max_records= 10 * |
2984 |
+- max(param->sort_buffer_length, MIN_SORT_BUFFER) / |
2985 |
++ MYSQL_MAX(param->sort_buffer_length, MIN_SORT_BUFFER) / |
2986 |
+ sort_param.key_length; |
2987 |
+ } |
2988 |
+ |
2989 |
+@@ -2784,7 +2784,7 @@ |
2990 |
+ my_seek(param->read_cache.file,0L,MY_SEEK_END,MYF(0)); |
2991 |
+ |
2992 |
+ if (share->data_file_type == DYNAMIC_RECORD) |
2993 |
+- rec_length=max(share->base.min_pack_length+1,share->base.min_block_length); |
2994 |
++ rec_length=MYSQL_MAX(share->base.min_pack_length+1,share->base.min_block_length); |
2995 |
+ else if (share->data_file_type == COMPRESSED_RECORD) |
2996 |
+ rec_length=share->base.min_block_length; |
2997 |
+ else |
2998 |
+@@ -3982,7 +3982,7 @@ |
2999 |
+ ft_buf->buf=ft_buf->lastkey+a_len; |
3000 |
+ /* |
3001 |
+ 32 is just a safety margin here |
3002 |
+- (at least max(val_len, sizeof(nod_flag)) should be there). |
3003 |
++ (at least MYSQL_MAX(val_len, sizeof(nod_flag)) should be there). |
3004 |
+ May be better performance could be achieved if we'd put |
3005 |
+ (sort_info->keyinfo->block_length-32)/XXX |
3006 |
+ instead. |
3007 |
+@@ -4333,7 +4333,7 @@ |
3008 |
+ |
3009 |
+ VOID(mi_close(*org_info)); |
3010 |
+ bzero((char*) &create_info,sizeof(create_info)); |
3011 |
+- create_info.max_rows=max(max_records,share.base.records); |
3012 |
++ create_info.max_rows=MYSQL_MAX(max_records,share.base.records); |
3013 |
+ create_info.reloc_rows=share.base.reloc; |
3014 |
+ create_info.old_options=(share.options | |
3015 |
+ (unpack ? HA_OPTION_TEMP_COMPRESS_RECORD : 0)); |
3016 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/mi_create.c mysql/storage/myisam/mi_create.c |
3017 |
+--- mysql.orig/storage/myisam/mi_create.c 2011-10-29 11:09:49.000000000 -0700 |
3018 |
++++ mysql/storage/myisam/mi_create.c 2011-11-18 15:43:17.085775150 -0800 |
3019 |
+@@ -439,8 +439,8 @@ |
3020 |
+ block_length= (keydef->block_length ? |
3021 |
+ my_round_up_to_next_power(keydef->block_length) : |
3022 |
+ myisam_block_size); |
3023 |
+- block_length= max(block_length, MI_MIN_KEY_BLOCK_LENGTH); |
3024 |
+- block_length= min(block_length, MI_MAX_KEY_BLOCK_LENGTH); |
3025 |
++ block_length= MYSQL_MAX(block_length, MI_MIN_KEY_BLOCK_LENGTH); |
3026 |
++ block_length= MYSQL_MIN(block_length, MI_MAX_KEY_BLOCK_LENGTH); |
3027 |
+ |
3028 |
+ keydef->block_length= (uint16) MI_BLOCK_SIZE(length-real_length_diff, |
3029 |
+ pointer,MI_MAX_KEYPTR_SIZE, |
3030 |
+@@ -529,7 +529,7 @@ |
3031 |
+ got from MYI file header (see also myisampack.c:save_state) |
3032 |
+ */ |
3033 |
+ share.base.key_reflength= |
3034 |
+- mi_get_pointer_length(max(ci->key_file_length,tmp),3); |
3035 |
++ mi_get_pointer_length(MYSQL_MAX(ci->key_file_length,tmp),3); |
3036 |
+ share.base.keys= share.state.header.keys= keys; |
3037 |
+ share.state.header.uniques= uniques; |
3038 |
+ share.state.header.fulltext_keys= fulltext_keys; |
3039 |
+@@ -567,7 +567,7 @@ |
3040 |
+ share.base.min_block_length= |
3041 |
+ (share.base.pack_reclength+3 < MI_EXTEND_BLOCK_LENGTH && |
3042 |
+ ! share.base.blobs) ? |
3043 |
+- max(share.base.pack_reclength,MI_MIN_BLOCK_LENGTH) : |
3044 |
++ MYSQL_MAX(share.base.pack_reclength,MI_MIN_BLOCK_LENGTH) : |
3045 |
+ MI_EXTEND_BLOCK_LENGTH; |
3046 |
+ if (! (flags & HA_DONT_TOUCH_DATA)) |
3047 |
+ share.state.create_time= (long) time((time_t*) 0); |
3048 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/mi_dynrec.c mysql/storage/myisam/mi_dynrec.c |
3049 |
+--- mysql.orig/storage/myisam/mi_dynrec.c 2011-10-29 11:09:49.000000000 -0700 |
3050 |
++++ mysql/storage/myisam/mi_dynrec.c 2011-11-18 15:43:17.086775166 -0800 |
3051 |
+@@ -882,7 +882,7 @@ |
3052 |
+ uint tmp=MY_ALIGN(reclength - length + 3 + |
3053 |
+ test(reclength >= 65520L),MI_DYN_ALIGN_SIZE); |
3054 |
+ /* Don't create a block bigger than MI_MAX_BLOCK_LENGTH */ |
3055 |
+- tmp= min(length+tmp, MI_MAX_BLOCK_LENGTH)-length; |
3056 |
++ tmp= MYSQL_MIN(length+tmp, MI_MAX_BLOCK_LENGTH)-length; |
3057 |
+ /* Check if we can extend this block */ |
3058 |
+ if (block_info.filepos + block_info.block_len == |
3059 |
+ info->state->data_file_length && |
3060 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/mi_extra.c mysql/storage/myisam/mi_extra.c |
3061 |
+--- mysql.orig/storage/myisam/mi_extra.c 2011-10-29 11:09:49.000000000 -0700 |
3062 |
++++ mysql/storage/myisam/mi_extra.c 2011-11-18 15:43:17.086775166 -0800 |
3063 |
+@@ -101,7 +101,7 @@ |
3064 |
+ cache_size= (extra_arg ? *(ulong*) extra_arg : |
3065 |
+ my_default_record_cache_size); |
3066 |
+ if (!(init_io_cache(&info->rec_cache,info->dfile, |
3067 |
+- (uint) min(info->state->data_file_length+1, |
3068 |
++ (uint) MYSQL_MIN(info->state->data_file_length+1, |
3069 |
+ cache_size), |
3070 |
+ READ_CACHE,0L,(pbool) (info->lock_type != F_UNLCK), |
3071 |
+ MYF(share->write_flag & MY_WAIT_IF_FULL)))) |
3072 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/mi_open.c mysql/storage/myisam/mi_open.c |
3073 |
+--- mysql.orig/storage/myisam/mi_open.c 2011-10-29 11:09:49.000000000 -0700 |
3074 |
++++ mysql/storage/myisam/mi_open.c 2011-11-18 15:43:17.087775181 -0800 |
3075 |
+@@ -330,7 +330,7 @@ |
3076 |
+ strmov(share->index_file_name, index_name); |
3077 |
+ strmov(share->data_file_name, data_name); |
3078 |
+ |
3079 |
+- share->blocksize=min(IO_SIZE,myisam_block_size); |
3080 |
++ share->blocksize=MYSQL_MIN(IO_SIZE,myisam_block_size); |
3081 |
+ { |
3082 |
+ HA_KEYSEG *pos=share->keyparts; |
3083 |
+ uint32 ftkey_nr= 1; |
3084 |
+@@ -503,7 +503,7 @@ |
3085 |
+ share->base.margin_key_file_length=(share->base.max_key_file_length - |
3086 |
+ (keys ? MI_INDEX_BLOCK_MARGIN * |
3087 |
+ share->blocksize * keys : 0)); |
3088 |
+- share->blocksize=min(IO_SIZE,myisam_block_size); |
3089 |
++ share->blocksize=MYSQL_MIN(IO_SIZE,myisam_block_size); |
3090 |
+ share->data_file_type=STATIC_RECORD; |
3091 |
+ if (share->options & HA_OPTION_COMPRESS_RECORD) |
3092 |
+ { |
3093 |
+@@ -716,10 +716,10 @@ |
3094 |
+ if (length == (ulong) -1) |
3095 |
+ { |
3096 |
+ if (info->s->options & HA_OPTION_COMPRESS_RECORD) |
3097 |
+- length= max(info->s->base.pack_reclength, info->s->max_pack_length); |
3098 |
++ length= MYSQL_MAX(info->s->base.pack_reclength, info->s->max_pack_length); |
3099 |
+ else |
3100 |
+ length= info->s->base.pack_reclength; |
3101 |
+- length= max(length, info->s->base.max_key_length); |
3102 |
++ length= MYSQL_MAX(length, info->s->base.max_key_length); |
3103 |
+ /* Avoid unnecessary realloc */ |
3104 |
+ if (newptr && length == old_length) |
3105 |
+ return newptr; |
3106 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/mi_packrec.c mysql/storage/myisam/mi_packrec.c |
3107 |
+--- mysql.orig/storage/myisam/mi_packrec.c 2011-10-29 11:09:49.000000000 -0700 |
3108 |
++++ mysql/storage/myisam/mi_packrec.c 2011-11-18 15:43:17.087775181 -0800 |
3109 |
+@@ -687,7 +687,7 @@ |
3110 |
+ return OFFSET_TABLE_SIZE; |
3111 |
+ } |
3112 |
+ length2= find_longest_bitstream(next, end) + 1; |
3113 |
+- length=max(length,length2); |
3114 |
++ length=MYSQL_MAX(length,length2); |
3115 |
+ } |
3116 |
+ return length; |
3117 |
+ } |
3118 |
+@@ -1402,7 +1402,7 @@ |
3119 |
+ info->filepos=filepos+head_length; |
3120 |
+ if (file > 0) |
3121 |
+ { |
3122 |
+- info->offset=min(info->rec_len, ref_length - head_length); |
3123 |
++ info->offset=MYSQL_MIN(info->rec_len, ref_length - head_length); |
3124 |
+ memcpy(*rec_buff_p, header + head_length, info->offset); |
3125 |
+ } |
3126 |
+ return 0; |
3127 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/mi_test1.c mysql/storage/myisam/mi_test1.c |
3128 |
+--- mysql.orig/storage/myisam/mi_test1.c 2011-10-29 11:09:49.000000000 -0700 |
3129 |
++++ mysql/storage/myisam/mi_test1.c 2011-11-18 15:43:17.087775181 -0800 |
3130 |
+@@ -438,7 +438,7 @@ |
3131 |
+ uint tmp; |
3132 |
+ uchar *ptr;; |
3133 |
+ sprintf((char*) blob_record,"... row: %d", rownr); |
3134 |
+- strappend((char*) blob_record,max(MAX_REC_LENGTH-rownr,10),' '); |
3135 |
++ strappend((char*) blob_record,MYSQL_MAX(MAX_REC_LENGTH-rownr,10),' '); |
3136 |
+ tmp=strlen((char*) blob_record); |
3137 |
+ int4store(pos,tmp); |
3138 |
+ ptr=blob_record; |
3139 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/mi_test2.c mysql/storage/myisam/mi_test2.c |
3140 |
+--- mysql.orig/storage/myisam/mi_test2.c 2011-10-29 11:09:49.000000000 -0700 |
3141 |
++++ mysql/storage/myisam/mi_test2.c 2011-11-18 15:43:17.088775196 -0800 |
3142 |
+@@ -603,7 +603,7 @@ |
3143 |
+ goto err; |
3144 |
+ |
3145 |
+ bmove(read_record2,read_record,reclength); |
3146 |
+- for (i=min(2,keys) ; i-- > 0 ;) |
3147 |
++ for (i=MYSQL_MIN(2,keys) ; i-- > 0 ;) |
3148 |
+ { |
3149 |
+ if (mi_rsame(file,read_record2,(int) i)) goto err; |
3150 |
+ if (memcmp(read_record,read_record2,reclength) != 0) |
3151 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/myisamlog.c mysql/storage/myisam/myisamlog.c |
3152 |
+--- mysql.orig/storage/myisam/myisamlog.c 2011-10-29 11:09:49.000000000 -0700 |
3153 |
++++ mysql/storage/myisam/myisamlog.c 2011-11-18 15:43:17.089775211 -0800 |
3154 |
+@@ -92,7 +92,7 @@ |
3155 |
+ log_filename=myisam_log_filename; |
3156 |
+ get_options(&argc,&argv); |
3157 |
+ /* Number of MyISAM files we can have open at one time */ |
3158 |
+- max_files= (my_set_max_open_files(min(max_files,8))-6)/2; |
3159 |
++ max_files= (my_set_max_open_files(MYSQL_MIN(max_files,8))-6)/2; |
3160 |
+ if (update) |
3161 |
+ printf("Trying to %s MyISAM files according to log '%s'\n", |
3162 |
+ (recover ? "recover" : "update"),log_filename); |
3163 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/myisampack.c mysql/storage/myisam/myisampack.c |
3164 |
+--- mysql.orig/storage/myisam/myisampack.c 2011-10-29 11:09:49.000000000 -0700 |
3165 |
++++ mysql/storage/myisam/myisampack.c 2011-11-18 15:43:17.089775211 -0800 |
3166 |
+@@ -1240,7 +1240,7 @@ |
3167 |
+ { |
3168 |
+ if (huff_counts->field_length > 2 && |
3169 |
+ huff_counts->empty_fields + (records - huff_counts->empty_fields)* |
3170 |
+- (1+max_bit(max(huff_counts->max_pre_space, |
3171 |
++ (1+max_bit(MYSQL_MAX(huff_counts->max_pre_space, |
3172 |
+ huff_counts->max_end_space))) < |
3173 |
+ records * max_bit(huff_counts->field_length)) |
3174 |
+ { |
3175 |
+@@ -3002,7 +3002,7 @@ |
3176 |
+ if (mrg->src_file_has_indexes_disabled) |
3177 |
+ { |
3178 |
+ isam_file->s->state.state.key_file_length= |
3179 |
+- max(isam_file->s->state.state.key_file_length, new_length); |
3180 |
++ MYSQL_MAX(isam_file->s->state.state.key_file_length, new_length); |
3181 |
+ } |
3182 |
+ state.dellink= HA_OFFSET_ERROR; |
3183 |
+ state.version=(ulong) time((time_t*) 0); |
3184 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/rt_mbr.c mysql/storage/myisam/rt_mbr.c |
3185 |
+--- mysql.orig/storage/myisam/rt_mbr.c 2011-10-29 11:09:53.000000000 -0700 |
3186 |
++++ mysql/storage/myisam/rt_mbr.c 2011-11-18 15:43:17.090775226 -0800 |
3187 |
+@@ -325,8 +325,8 @@ |
3188 |
+ bmin = korr_func(b); \ |
3189 |
+ amax = korr_func(a+len); \ |
3190 |
+ bmax = korr_func(b+len); \ |
3191 |
+- amin = min(amin, bmin); \ |
3192 |
+- amax = max(amax, bmax); \ |
3193 |
++ amin = MYSQL_MIN(amin, bmin); \ |
3194 |
++ amax = MYSQL_MAX(amax, bmax); \ |
3195 |
+ store_func(c, amin); \ |
3196 |
+ store_func(c+len, amax); \ |
3197 |
+ } |
3198 |
+@@ -338,8 +338,8 @@ |
3199 |
+ get_func(bmin, b); \ |
3200 |
+ get_func(amax, a+len); \ |
3201 |
+ get_func(bmax, b+len); \ |
3202 |
+- amin = min(amin, bmin); \ |
3203 |
+- amax = max(amax, bmax); \ |
3204 |
++ amin = MYSQL_MIN(amin, bmin); \ |
3205 |
++ amax = MYSQL_MAX(amax, bmax); \ |
3206 |
+ store_func(c, amin); \ |
3207 |
+ store_func(c+len, amax); \ |
3208 |
+ } |
3209 |
+@@ -417,8 +417,8 @@ |
3210 |
+ bmin = korr_func(b); \ |
3211 |
+ amax = korr_func(a+len); \ |
3212 |
+ bmax = korr_func(b+len); \ |
3213 |
+- amin = max(amin, bmin); \ |
3214 |
+- amax = min(amax, bmax); \ |
3215 |
++ amin = MYSQL_MAX(amin, bmin); \ |
3216 |
++ amax = MYSQL_MIN(amax, bmax); \ |
3217 |
+ if (amin >= amax) \ |
3218 |
+ return 0; \ |
3219 |
+ res *= amax - amin; \ |
3220 |
+@@ -431,8 +431,8 @@ |
3221 |
+ get_func(bmin, b); \ |
3222 |
+ get_func(amax, a+len); \ |
3223 |
+ get_func(bmax, b+len); \ |
3224 |
+- amin = max(amin, bmin); \ |
3225 |
+- amax = min(amax, bmax); \ |
3226 |
++ amin = MYSQL_MAX(amin, bmin); \ |
3227 |
++ amax = MYSQL_MIN(amax, bmax); \ |
3228 |
+ if (amin >= amax) \ |
3229 |
+ return 0; \ |
3230 |
+ res *= amax - amin; \ |
3231 |
+@@ -508,7 +508,7 @@ |
3232 |
+ amax = korr_func(a+len); \ |
3233 |
+ bmax = korr_func(b+len); \ |
3234 |
+ a_area *= (((double)amax) - ((double)amin)); \ |
3235 |
+- loc_ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \ |
3236 |
++ loc_ab_area *= ((double)MYSQL_MAX(amax, bmax) - (double)MYSQL_MIN(amin, bmin)); \ |
3237 |
+ } |
3238 |
+ |
3239 |
+ #define RT_AREA_INC_GET(type, get_func, len)\ |
3240 |
+@@ -519,7 +519,7 @@ |
3241 |
+ get_func(amax, a+len); \ |
3242 |
+ get_func(bmax, b+len); \ |
3243 |
+ a_area *= (((double)amax) - ((double)amin)); \ |
3244 |
+- loc_ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \ |
3245 |
++ loc_ab_area *= ((double)MYSQL_MAX(amax, bmax) - (double)MYSQL_MIN(amin, bmin)); \ |
3246 |
+ } |
3247 |
+ |
3248 |
+ /* |
3249 |
+@@ -604,7 +604,7 @@ |
3250 |
+ amax = korr_func(a+len); \ |
3251 |
+ bmax = korr_func(b+len); \ |
3252 |
+ a_perim+= (((double)amax) - ((double)amin)); \ |
3253 |
+- *ab_perim+= ((double)max(amax, bmax) - (double)min(amin, bmin)); \ |
3254 |
++ *ab_perim+= ((double)MYSQL_MAX(amax, bmax) - (double)MYSQL_MIN(amin, bmin)); \ |
3255 |
+ } |
3256 |
+ |
3257 |
+ #define RT_PERIM_INC_GET(type, get_func, len)\ |
3258 |
+@@ -615,7 +615,7 @@ |
3259 |
+ get_func(amax, a+len); \ |
3260 |
+ get_func(bmax, b+len); \ |
3261 |
+ a_perim+= (((double)amax) - ((double)amin)); \ |
3262 |
+- *ab_perim+= ((double)max(amax, bmax) - (double)min(amin, bmin)); \ |
3263 |
++ *ab_perim+= ((double)MYSQL_MAX(amax, bmax) - (double)MYSQL_MIN(amin, bmin)); \ |
3264 |
+ } |
3265 |
+ |
3266 |
+ /* |
3267 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisam/sort.c mysql/storage/myisam/sort.c |
3268 |
+--- mysql.orig/storage/myisam/sort.c 2011-10-29 11:09:49.000000000 -0700 |
3269 |
++++ mysql/storage/myisam/sort.c 2011-11-18 15:43:17.090775226 -0800 |
3270 |
+@@ -131,7 +131,7 @@ |
3271 |
+ sort_keys= (uchar **) NULL; error= 1; |
3272 |
+ maxbuffer=1; |
3273 |
+ |
3274 |
+- memavl= max(sortbuff_size, MIN_SORT_BUFFER); |
3275 |
++ memavl= MYSQL_MAX(sortbuff_size, MIN_SORT_BUFFER); |
3276 |
+ records= info->sort_info->max_records; |
3277 |
+ sort_length= info->key_length; |
3278 |
+ LINT_INIT(keys); |
3279 |
+@@ -348,7 +348,7 @@ |
3280 |
+ bzero((char*) &sort_param->unique, sizeof(sort_param->unique)); |
3281 |
+ sort_keys= (uchar **) NULL; |
3282 |
+ |
3283 |
+- memavl= max(sort_param->sortbuff_size, MIN_SORT_BUFFER); |
3284 |
++ memavl= MYSQL_MAX(sort_param->sortbuff_size, MIN_SORT_BUFFER); |
3285 |
+ idx= (uint)sort_param->sort_info->max_records; |
3286 |
+ sort_length= sort_param->key_length; |
3287 |
+ maxbuffer= 1; |
3288 |
+@@ -822,7 +822,7 @@ |
3289 |
+ register uint count; |
3290 |
+ uint length; |
3291 |
+ |
3292 |
+- if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count))) |
3293 |
++ if ((count=(uint) MYSQL_MIN((ha_rows) buffpek->max_keys,buffpek->count))) |
3294 |
+ { |
3295 |
+ if (my_pread(fromfile->file,(uchar*) buffpek->base, |
3296 |
+ (length= sort_length*count),buffpek->file_pos,MYF_RW)) |
3297 |
+@@ -843,7 +843,7 @@ |
3298 |
+ uint idx; |
3299 |
+ uchar *buffp; |
3300 |
+ |
3301 |
+- if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count))) |
3302 |
++ if ((count=(uint) MYSQL_MIN((ha_rows) buffpek->max_keys,buffpek->count))) |
3303 |
+ { |
3304 |
+ buffp = buffpek->base; |
3305 |
+ |
3306 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/myisammrg/ha_myisammrg.cc mysql/storage/myisammrg/ha_myisammrg.cc |
3307 |
+--- mysql.orig/storage/myisammrg/ha_myisammrg.cc 2011-10-29 11:09:49.000000000 -0700 |
3308 |
++++ mysql/storage/myisammrg/ha_myisammrg.cc 2011-11-18 15:43:17.091775241 -0800 |
3309 |
+@@ -965,7 +965,7 @@ |
3310 |
+ memcpy((char*) table->key_info[0].rec_per_key, |
3311 |
+ (char*) mrg_info.rec_per_key, |
3312 |
+ sizeof(table->key_info[0].rec_per_key[0]) * |
3313 |
+- min(file->keys, table->s->key_parts)); |
3314 |
++ MYSQL_MIN(file->keys, table->s->key_parts)); |
3315 |
+ } |
3316 |
+ } |
3317 |
+ if (flag & HA_STATUS_ERRKEY) |
3318 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/ndb/src/common/portlib/NdbTCP.cpp mysql/storage/ndb/src/common/portlib/NdbTCP.cpp |
3319 |
+--- mysql.orig/storage/ndb/src/common/portlib/NdbTCP.cpp 2011-10-29 11:09:52.000000000 -0700 |
3320 |
++++ mysql/storage/ndb/src/common/portlib/NdbTCP.cpp 2011-11-18 15:43:17.091775241 -0800 |
3321 |
+@@ -30,7 +30,7 @@ |
3322 |
+ &tmp_errno); |
3323 |
+ if (hp) |
3324 |
+ { |
3325 |
+- memcpy(dst, hp->h_addr, min(sizeof(*dst), (size_t) hp->h_length)); |
3326 |
++ memcpy(dst, hp->h_addr, MYSQL_MIN(sizeof(*dst), (size_t) hp->h_length)); |
3327 |
+ my_gethostbyname_r_free(); |
3328 |
+ return 0; //DBUG_RETURN(0); |
3329 |
+ } |
3330 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp mysql/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp |
3331 |
+--- mysql.orig/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp 2011-10-29 11:09:51.000000000 -0700 |
3332 |
++++ mysql/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp 2011-11-18 15:43:17.091775241 -0800 |
3333 |
+@@ -212,7 +212,7 @@ |
3334 |
+ } |
3335 |
+ } |
3336 |
+ // return values |
3337 |
+- par.m_depth = 1 + max(cpar[0].m_depth, cpar[1].m_depth); |
3338 |
++ par.m_depth = 1 + MYSQL_MAX(cpar[0].m_depth, cpar[1].m_depth); |
3339 |
+ par.m_occup = node.getOccup(); |
3340 |
+ for (unsigned i = 0; i <= 1; i++) { |
3341 |
+ if (node.getLink(i) == NullTupLoc) |
3342 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/ndb/src/ndbapi/NdbBlob.cpp mysql/storage/ndb/src/ndbapi/NdbBlob.cpp |
3343 |
+--- mysql.orig/storage/ndb/src/ndbapi/NdbBlob.cpp 2011-10-29 11:09:52.000000000 -0700 |
3344 |
++++ mysql/storage/ndb/src/ndbapi/NdbBlob.cpp 2011-11-18 15:43:17.092775256 -0800 |
3345 |
+@@ -1523,7 +1523,7 @@ |
3346 |
+ } |
3347 |
+ // these buffers are always used |
3348 |
+ theKeyBuf.alloc(theTable->m_keyLenInWords << 2); |
3349 |
+- thePackKeyBuf.alloc(max(theTable->m_keyLenInWords, theAccessTable->m_keyLenInWords) << 2); |
3350 |
++ thePackKeyBuf.alloc(MYSQL_MAX(theTable->m_keyLenInWords, theAccessTable->m_keyLenInWords) << 2); |
3351 |
+ theHeadInlineBuf.alloc(sizeof(Head) + theInlineSize); |
3352 |
+ theHead = (Head*)theHeadInlineBuf.data; |
3353 |
+ theInlineData = theHeadInlineBuf.data + sizeof(Head); |
3354 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/ndb/test/ndbapi/testIndexStat.cpp mysql/storage/ndb/test/ndbapi/testIndexStat.cpp |
3355 |
+--- mysql.orig/storage/ndb/test/ndbapi/testIndexStat.cpp 2011-10-29 11:09:53.000000000 -0700 |
3356 |
++++ mysql/storage/ndb/test/ndbapi/testIndexStat.cpp 2011-11-18 15:43:17.092775256 -0800 |
3357 |
+@@ -30,10 +30,10 @@ |
3358 |
+ * 0. baseline with same options as handler |
3359 |
+ */ |
3360 |
+ |
3361 |
+-#undef min |
3362 |
+-#undef max |
3363 |
+-#define min(a, b) ((a) <= (b) ? (a) : (b)) |
3364 |
+-#define max(a, b) ((a) >= (b) ? (a) : (b)) |
3365 |
++#undef MYSQL_MIN |
3366 |
++#undef MYSQL_MAX |
3367 |
++#define MYSQL_MIN(a, b) ((a) <= (b) ? (a) : (b)) |
3368 |
++#define MYSQL_MAX(a, b) ((a) >= (b) ? (a) : (b)) |
3369 |
+ |
3370 |
+ inline NdbOut& |
3371 |
+ NdbOut::operator<<(double x) |
3372 |
+@@ -784,13 +784,13 @@ |
3373 |
+ uint |
3374 |
+ Range::minattrs() const |
3375 |
+ { |
3376 |
+- return min(bnd[0].val.numattrs, bnd[1].val.numattrs); |
3377 |
++ return MYSQL_MIN(bnd[0].val.numattrs, bnd[1].val.numattrs); |
3378 |
+ } |
3379 |
+ |
3380 |
+ uint |
3381 |
+ Range::maxattrs() const |
3382 |
+ { |
3383 |
+- return max(bnd[0].val.numattrs, bnd[1].val.numattrs); |
3384 |
++ return MYSQL_MAX(bnd[0].val.numattrs, bnd[1].val.numattrs); |
3385 |
+ } |
3386 |
+ |
3387 |
+ int |
3388 |
+@@ -856,8 +856,8 @@ |
3389 |
+ lim[i] = lo; |
3390 |
+ } |
3391 |
+ // the range |
3392 |
+- const int lo = max(lim[0], 0); |
3393 |
+- const int hi = min(lim[1], (int)g_sortcount - 1); |
3394 |
++ const int lo = MYSQL_MAX(lim[0], 0); |
3395 |
++ const int hi = MYSQL_MIN(lim[1], (int)g_sortcount - 1); |
3396 |
+ if (! g_opts.nochecks) { |
3397 |
+ int curr = -1; |
3398 |
+ for (i = 0; i < (int)g_sortcount; i++) { |
3399 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/storage/ndb/test/src/getarg.c mysql/storage/ndb/test/src/getarg.c |
3400 |
+--- mysql.orig/storage/ndb/test/src/getarg.c 2011-10-29 11:09:51.000000000 -0700 |
3401 |
++++ mysql/storage/ndb/test/src/getarg.c 2011-11-18 15:43:17.092775256 -0800 |
3402 |
+@@ -65,8 +65,8 @@ |
3403 |
+ |
3404 |
+ #define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag) |
3405 |
+ |
3406 |
+-#ifndef max |
3407 |
+-#define max(a, b) (a) > (b) ? (a) : (b) |
3408 |
++#ifndef MYSQL_MAX |
3409 |
++#define MYSQL_MAX(a, b) (a) > (b) ? (a) : (b) |
3410 |
+ #endif |
3411 |
+ |
3412 |
+ #ifdef HAVE___PROGNAME |
3413 |
+@@ -306,7 +306,7 @@ |
3414 |
+ } |
3415 |
+ if (args[i].long_name && args[i].short_name) |
3416 |
+ len += 2; /* ", " */ |
3417 |
+- max_len = max(max_len, len); |
3418 |
++ max_len = MYSQL_MAX(max_len, len); |
3419 |
+ } |
3420 |
+ if (extra_string) { |
3421 |
+ col = check_column(stderr, col, strlen(extra_string) + 1, columns); |
3422 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/ctype-big5.c mysql/strings/ctype-big5.c |
3423 |
+--- mysql.orig/strings/ctype-big5.c 2011-10-29 11:09:49.000000000 -0700 |
3424 |
++++ mysql/strings/ctype-big5.c 2011-11-18 15:43:17.094775287 -0800 |
3425 |
+@@ -254,7 +254,7 @@ |
3426 |
+ const uchar *b, size_t b_length, |
3427 |
+ my_bool b_is_prefix) |
3428 |
+ { |
3429 |
+- size_t length= min(a_length, b_length); |
3430 |
++ size_t length= MYSQL_MIN(a_length, b_length); |
3431 |
+ int res= my_strnncoll_big5_internal(&a, &b, length); |
3432 |
+ return res ? res : (int)((b_is_prefix ? length : a_length) - b_length); |
3433 |
+ } |
3434 |
+@@ -267,7 +267,7 @@ |
3435 |
+ const uchar *b, size_t b_length, |
3436 |
+ my_bool diff_if_only_endspace_difference) |
3437 |
+ { |
3438 |
+- size_t length= min(a_length, b_length); |
3439 |
++ size_t length= MYSQL_MIN(a_length, b_length); |
3440 |
+ int res= my_strnncoll_big5_internal(&a, &b, length); |
3441 |
+ |
3442 |
+ #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE |
3443 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/ctype-bin.c mysql/strings/ctype-bin.c |
3444 |
+--- mysql.orig/strings/ctype-bin.c 2011-10-29 11:09:49.000000000 -0700 |
3445 |
++++ mysql/strings/ctype-bin.c 2011-11-18 15:43:17.094775287 -0800 |
3446 |
+@@ -82,7 +82,7 @@ |
3447 |
+ const uchar *t, size_t tlen, |
3448 |
+ my_bool t_is_prefix) |
3449 |
+ { |
3450 |
+- size_t len=min(slen,tlen); |
3451 |
++ size_t len=MYSQL_MIN(slen,tlen); |
3452 |
+ int cmp= memcmp(s,t,len); |
3453 |
+ return cmp ? cmp : (int)((t_is_prefix ? len : slen) - tlen); |
3454 |
+ } |
3455 |
+@@ -133,7 +133,7 @@ |
3456 |
+ const uchar *t, size_t tlen, |
3457 |
+ my_bool t_is_prefix) |
3458 |
+ { |
3459 |
+- size_t len=min(slen,tlen); |
3460 |
++ size_t len=MYSQL_MIN(slen,tlen); |
3461 |
+ int cmp= memcmp(s,t,len); |
3462 |
+ return cmp ? cmp : (int)((t_is_prefix ? len : slen) - tlen); |
3463 |
+ } |
3464 |
+@@ -177,7 +177,7 @@ |
3465 |
+ diff_if_only_endspace_difference= 0; |
3466 |
+ #endif |
3467 |
+ |
3468 |
+- end= a + (length= min(a_length, b_length)); |
3469 |
++ end= a + (length= MYSQL_MIN(a_length, b_length)); |
3470 |
+ while (a < end) |
3471 |
+ { |
3472 |
+ if (*a++ != *b++) |
3473 |
+@@ -406,7 +406,7 @@ |
3474 |
+ const uchar *src, size_t srclen) |
3475 |
+ { |
3476 |
+ if (dest != src) |
3477 |
+- memcpy(dest, src, min(dstlen,srclen)); |
3478 |
++ memcpy(dest, src, MYSQL_MIN(dstlen,srclen)); |
3479 |
+ if (dstlen > srclen) |
3480 |
+ bfill(dest + srclen, dstlen - srclen, 0); |
3481 |
+ return dstlen; |
3482 |
+@@ -419,7 +419,7 @@ |
3483 |
+ const uchar *src, size_t srclen) |
3484 |
+ { |
3485 |
+ if (dest != src) |
3486 |
+- memcpy(dest, src, min(dstlen,srclen)); |
3487 |
++ memcpy(dest, src, MYSQL_MIN(dstlen,srclen)); |
3488 |
+ if (dstlen > srclen) |
3489 |
+ bfill(dest + srclen, dstlen - srclen, ' '); |
3490 |
+ return dstlen; |
3491 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/ctype-gbk.c mysql/strings/ctype-gbk.c |
3492 |
+--- mysql.orig/strings/ctype-gbk.c 2011-10-29 11:09:49.000000000 -0700 |
3493 |
++++ mysql/strings/ctype-gbk.c 2011-11-18 15:43:17.096775319 -0800 |
3494 |
+@@ -2617,7 +2617,7 @@ |
3495 |
+ const uchar *b, size_t b_length, |
3496 |
+ my_bool b_is_prefix) |
3497 |
+ { |
3498 |
+- size_t length= min(a_length, b_length); |
3499 |
++ size_t length= MYSQL_MIN(a_length, b_length); |
3500 |
+ int res= my_strnncoll_gbk_internal(&a, &b, length); |
3501 |
+ return res ? res : (int) ((b_is_prefix ? length : a_length) - b_length); |
3502 |
+ } |
3503 |
+@@ -2628,7 +2628,7 @@ |
3504 |
+ const uchar *b, size_t b_length, |
3505 |
+ my_bool diff_if_only_endspace_difference) |
3506 |
+ { |
3507 |
+- size_t length= min(a_length, b_length); |
3508 |
++ size_t length= MYSQL_MIN(a_length, b_length); |
3509 |
+ int res= my_strnncoll_gbk_internal(&a, &b, length); |
3510 |
+ |
3511 |
+ #ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE |
3512 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/ctype-mb.c mysql/strings/ctype-mb.c |
3513 |
+--- mysql.orig/strings/ctype-mb.c 2011-10-29 11:09:49.000000000 -0700 |
3514 |
++++ mysql/strings/ctype-mb.c 2011-11-18 15:43:17.097775334 -0800 |
3515 |
+@@ -369,7 +369,7 @@ |
3516 |
+ const uchar *t, size_t tlen, |
3517 |
+ my_bool t_is_prefix) |
3518 |
+ { |
3519 |
+- size_t len=min(slen,tlen); |
3520 |
++ size_t len=MYSQL_MIN(slen,tlen); |
3521 |
+ int cmp= memcmp(s,t,len); |
3522 |
+ return cmp ? cmp : (int) ((t_is_prefix ? len : slen) - tlen); |
3523 |
+ } |
3524 |
+@@ -413,7 +413,7 @@ |
3525 |
+ diff_if_only_endspace_difference= 0; |
3526 |
+ #endif |
3527 |
+ |
3528 |
+- end= a + (length= min(a_length, b_length)); |
3529 |
++ end= a + (length= MYSQL_MIN(a_length, b_length)); |
3530 |
+ while (a < end) |
3531 |
+ { |
3532 |
+ if (*a++ != *b++) |
3533 |
+@@ -452,7 +452,7 @@ |
3534 |
+ const uchar *src, size_t srclen) |
3535 |
+ { |
3536 |
+ if (dest != src) |
3537 |
+- memcpy(dest, src, min(dstlen, srclen)); |
3538 |
++ memcpy(dest, src, MYSQL_MIN(dstlen, srclen)); |
3539 |
+ if (dstlen > srclen) |
3540 |
+ bfill(dest + srclen, dstlen - srclen, ' '); |
3541 |
+ return dstlen; |
3542 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/ctype-simple.c mysql/strings/ctype-simple.c |
3543 |
+--- mysql.orig/strings/ctype-simple.c 2011-10-29 11:09:49.000000000 -0700 |
3544 |
++++ mysql/strings/ctype-simple.c 2011-11-18 15:43:17.098775349 -0800 |
3545 |
+@@ -161,7 +161,7 @@ |
3546 |
+ diff_if_only_endspace_difference= 0; |
3547 |
+ #endif |
3548 |
+ |
3549 |
+- end= a + (length= min(a_length, b_length)); |
3550 |
++ end= a + (length= MYSQL_MIN(a_length, b_length)); |
3551 |
+ while (a < end) |
3552 |
+ { |
3553 |
+ if (map[*a++] != map[*b++]) |
3554 |
+@@ -875,7 +875,7 @@ |
3555 |
+ val= new_val; |
3556 |
+ } |
3557 |
+ |
3558 |
+- len= min(len, (size_t) (e-p)); |
3559 |
++ len= MYSQL_MIN(len, (size_t) (e-p)); |
3560 |
+ memcpy(dst, p, len); |
3561 |
+ return len+sign; |
3562 |
+ } |
3563 |
+@@ -929,7 +929,7 @@ |
3564 |
+ long_val= quo; |
3565 |
+ } |
3566 |
+ |
3567 |
+- len= min(len, (size_t) (e-p)); |
3568 |
++ len= MYSQL_MIN(len, (size_t) (e-p)); |
3569 |
+ cnv: |
3570 |
+ memcpy(dst, p, len); |
3571 |
+ return len+sign; |
3572 |
+@@ -1160,7 +1160,7 @@ |
3573 |
+ { |
3574 |
+ size_t nbytes= (size_t) (end-start); |
3575 |
+ *error= 0; |
3576 |
+- return min(nbytes, nchars); |
3577 |
++ return MYSQL_MIN(nbytes, nchars); |
3578 |
+ } |
3579 |
+ |
3580 |
+ |
3581 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/ctype-tis620.c mysql/strings/ctype-tis620.c |
3582 |
+--- mysql.orig/strings/ctype-tis620.c 2011-10-29 11:09:49.000000000 -0700 |
3583 |
++++ mysql/strings/ctype-tis620.c 2011-11-18 15:43:17.098775349 -0800 |
3584 |
+@@ -583,7 +583,7 @@ |
3585 |
+ a_length= thai2sortable(a, a_length); |
3586 |
+ b_length= thai2sortable(b, b_length); |
3587 |
+ |
3588 |
+- end= a + (length= min(a_length, b_length)); |
3589 |
++ end= a + (length= MYSQL_MIN(a_length, b_length)); |
3590 |
+ while (a < end) |
3591 |
+ { |
3592 |
+ if (*a++ != *b++) |
3593 |
+@@ -640,7 +640,7 @@ |
3594 |
+ const uchar *src, size_t srclen) |
3595 |
+ { |
3596 |
+ size_t dstlen= len; |
3597 |
+- len= (size_t) (strmake((char*) dest, (char*) src, min(len, srclen)) - |
3598 |
++ len= (size_t) (strmake((char*) dest, (char*) src, MYSQL_MIN(len, srclen)) - |
3599 |
+ (char*) dest); |
3600 |
+ len= thai2sortable(dest, len); |
3601 |
+ if (dstlen > len) |
3602 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/ctype-uca.c mysql/strings/ctype-uca.c |
3603 |
+--- mysql.orig/strings/ctype-uca.c 2011-10-29 11:09:49.000000000 -0700 |
3604 |
++++ mysql/strings/ctype-uca.c 2011-11-18 15:43:17.100775379 -0800 |
3605 |
+@@ -7569,7 +7569,7 @@ |
3606 |
+ { |
3607 |
+ char tail[30]; |
3608 |
+ size_t len= lexem->end - lexem->prev; |
3609 |
+- strmake (tail, lexem->prev, (size_t) min(len, sizeof(tail)-1)); |
3610 |
++ strmake (tail, lexem->prev, (size_t) MYSQL_MIN(len, sizeof(tail)-1)); |
3611 |
+ errstr[errsize-1]= '\0'; |
3612 |
+ my_snprintf(errstr,errsize-1,"%s at '%s'", txt, tail); |
3613 |
+ } |
3614 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/ctype-ucs2.c mysql/strings/ctype-ucs2.c |
3615 |
+--- mysql.orig/strings/ctype-ucs2.c 2011-10-29 11:09:49.000000000 -0700 |
3616 |
++++ mysql/strings/ctype-ucs2.c 2011-11-18 15:43:17.101775394 -0800 |
3617 |
+@@ -280,7 +280,7 @@ |
3618 |
+ se= s + slen; |
3619 |
+ te= t + tlen; |
3620 |
+ |
3621 |
+- for (minlen= min(slen, tlen); minlen; minlen-= 2) |
3622 |
++ for (minlen= MYSQL_MIN(slen, tlen); minlen; minlen-= 2) |
3623 |
+ { |
3624 |
+ int s_wc = uni_plane[s[0]] ? (int) uni_plane[s[0]][s[1]].sort : |
3625 |
+ (((int) s[0]) << 8) + (int) s[1]; |
3626 |
+@@ -1332,7 +1332,7 @@ |
3627 |
+ size_t nbytes= ((size_t) (e-b)) & ~(size_t) 1; |
3628 |
+ *error= 0; |
3629 |
+ nchars*= 2; |
3630 |
+- return min(nbytes, nchars); |
3631 |
++ return MYSQL_MIN(nbytes, nchars); |
3632 |
+ } |
3633 |
+ |
3634 |
+ |
3635 |
+@@ -1426,7 +1426,7 @@ |
3636 |
+ se= s + slen; |
3637 |
+ te= t + tlen; |
3638 |
+ |
3639 |
+- for (minlen= min(slen, tlen); minlen; minlen-= 2) |
3640 |
++ for (minlen= MYSQL_MIN(slen, tlen); minlen; minlen-= 2) |
3641 |
+ { |
3642 |
+ int s_wc= s[0] * 256 + s[1]; |
3643 |
+ int t_wc= t[0] * 256 + t[1]; |
3644 |
+@@ -1473,7 +1473,7 @@ |
3645 |
+ const uchar *src, size_t srclen) |
3646 |
+ { |
3647 |
+ if (dst != src) |
3648 |
+- memcpy(dst,src,srclen= min(dstlen,srclen)); |
3649 |
++ memcpy(dst,src,srclen= MYSQL_MIN(dstlen,srclen)); |
3650 |
+ if (dstlen > srclen) |
3651 |
+ cs->cset->fill(cs, (char*) dst + srclen, dstlen - srclen, ' '); |
3652 |
+ return dstlen; |
3653 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/ctype-utf8.c mysql/strings/ctype-utf8.c |
3654 |
+--- mysql.orig/strings/ctype-utf8.c 2011-10-29 11:09:49.000000000 -0700 |
3655 |
++++ mysql/strings/ctype-utf8.c 2011-11-18 15:43:17.102775409 -0800 |
3656 |
+@@ -1939,7 +1939,7 @@ |
3657 |
+ const uchar *t, const uchar *te) |
3658 |
+ { |
3659 |
+ int slen= (int) (se-s), tlen= (int) (te-t); |
3660 |
+- int len=min(slen,tlen); |
3661 |
++ int len=MYSQL_MIN(slen,tlen); |
3662 |
+ int cmp= memcmp(s,t,len); |
3663 |
+ return cmp ? cmp : slen-tlen; |
3664 |
+ } |
3665 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/decimal.c mysql/strings/decimal.c |
3666 |
+--- mysql.orig/strings/decimal.c 2011-10-29 11:09:47.000000000 -0700 |
3667 |
++++ mysql/strings/decimal.c 2011-11-18 15:44:22.403773051 -0800 |
3668 |
+@@ -405,7 +405,7 @@ |
3669 |
+ for (; frac>0; frac-=DIG_PER_DEC1) |
3670 |
+ { |
3671 |
+ dec1 x=*buf++; |
3672 |
+- for (i=min(frac, DIG_PER_DEC1); i; i--) |
3673 |
++ for (i=MYSQL_MIN(frac, DIG_PER_DEC1); i; i--) |
3674 |
+ { |
3675 |
+ dec1 y=x/DIG_MASK; |
3676 |
+ *s1++='0'+(uchar)y; |
3677 |
+@@ -428,7 +428,7 @@ |
3678 |
+ for (buf=buf0+ROUND_UP(intg); intg>0; intg-=DIG_PER_DEC1) |
3679 |
+ { |
3680 |
+ dec1 x=*--buf; |
3681 |
+- for (i=min(intg, DIG_PER_DEC1); i; i--) |
3682 |
++ for (i=MYSQL_MIN(intg, DIG_PER_DEC1); i; i--) |
3683 |
+ { |
3684 |
+ dec1 y=x/10; |
3685 |
+ *--s='0'+(uchar)(x-y*10); |
3686 |
+@@ -1531,8 +1531,8 @@ |
3687 |
+ |
3688 |
+ if (to != from) |
3689 |
+ { |
3690 |
+- dec1 *p0= buf0+intg0+max(frac1, frac0); |
3691 |
+- dec1 *p1= buf1+intg0+max(frac1, frac0); |
3692 |
++ dec1 *p0= buf0+intg0+MYSQL_MAX(frac1, frac0); |
3693 |
++ dec1 *p1= buf1+intg0+MYSQL_MAX(frac1, frac0); |
3694 |
+ |
3695 |
+ DBUG_ASSERT(p0 - buf0 <= len); |
3696 |
+ DBUG_ASSERT(p1 - buf1 <= len); |
3697 |
+@@ -1543,7 +1543,7 @@ |
3698 |
+ buf0=to->buf; |
3699 |
+ buf1=to->buf; |
3700 |
+ to->sign=from->sign; |
3701 |
+- to->intg=min(intg0, len)*DIG_PER_DEC1; |
3702 |
++ to->intg=MYSQL_MIN(intg0, len)*DIG_PER_DEC1; |
3703 |
+ } |
3704 |
+ |
3705 |
+ if (frac0 > frac1) |
3706 |
+@@ -1645,7 +1645,7 @@ |
3707 |
+ scale=frac0*DIG_PER_DEC1; |
3708 |
+ error=E_DEC_TRUNCATED; /* XXX */ |
3709 |
+ } |
3710 |
+- for (buf1=to->buf+intg0+max(frac0,0); buf1 > to->buf; buf1--) |
3711 |
++ for (buf1=to->buf+intg0+MYSQL_MAX(frac0,0); buf1 > to->buf; buf1--) |
3712 |
+ { |
3713 |
+ buf1[0]=buf1[-1]; |
3714 |
+ } |
3715 |
+@@ -1664,7 +1664,7 @@ |
3716 |
+ /* making 'zero' with the proper scale */ |
3717 |
+ dec1 *p0= to->buf + frac0 + 1; |
3718 |
+ to->intg=1; |
3719 |
+- to->frac= max(scale, 0); |
3720 |
++ to->frac= MYSQL_MAX(scale, 0); |
3721 |
+ to->sign= 0; |
3722 |
+ for (buf1= to->buf; buf1<p0; buf1++) |
3723 |
+ *buf1= 0; |
3724 |
+@@ -1713,11 +1713,11 @@ |
3725 |
+ { |
3726 |
+ switch (op) { |
3727 |
+ case '-': |
3728 |
+- return ROUND_UP(max(from1->intg, from2->intg)) + |
3729 |
+- ROUND_UP(max(from1->frac, from2->frac)); |
3730 |
++ return ROUND_UP(MYSQL_MAX(from1->intg, from2->intg)) + |
3731 |
++ ROUND_UP(MYSQL_MAX(from1->frac, from2->frac)); |
3732 |
+ case '+': |
3733 |
+- return ROUND_UP(max(from1->intg, from2->intg)+1) + |
3734 |
+- ROUND_UP(max(from1->frac, from2->frac)); |
3735 |
++ return ROUND_UP(MYSQL_MAX(from1->intg, from2->intg)+1) + |
3736 |
++ ROUND_UP(MYSQL_MAX(from1->frac, from2->frac)); |
3737 |
+ case '*': |
3738 |
+ return ROUND_UP(from1->intg+from2->intg)+ |
3739 |
+ ROUND_UP(from1->frac)+ROUND_UP(from2->frac); |
3740 |
+@@ -1732,7 +1732,7 @@ |
3741 |
+ { |
3742 |
+ int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg), |
3743 |
+ frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac), |
3744 |
+- frac0=max(frac1, frac2), intg0=max(intg1, intg2), error; |
3745 |
++ frac0=MYSQL_MAX(frac1, frac2), intg0=MYSQL_MAX(intg1, intg2), error; |
3746 |
+ dec1 *buf1, *buf2, *buf0, *stop, *stop2, x, carry; |
3747 |
+ |
3748 |
+ sanity(to); |
3749 |
+@@ -1757,7 +1757,7 @@ |
3750 |
+ buf0=to->buf+intg0+frac0; |
3751 |
+ |
3752 |
+ to->sign=from1->sign; |
3753 |
+- to->frac=max(from1->frac, from2->frac); |
3754 |
++ to->frac=MYSQL_MAX(from1->frac, from2->frac); |
3755 |
+ to->intg=intg0*DIG_PER_DEC1; |
3756 |
+ if (unlikely(error)) |
3757 |
+ { |
3758 |
+@@ -1768,7 +1768,7 @@ |
3759 |
+ set_if_smaller(intg2, intg0); |
3760 |
+ } |
3761 |
+ |
3762 |
+- /* part 1 - max(frac) ... min (frac) */ |
3763 |
++ /* part 1 - MYSQL_MAX(frac) ... MYSQL_MIN(frac) */ |
3764 |
+ if (frac1 > frac2) |
3765 |
+ { |
3766 |
+ buf1=from1->buf+intg1+frac1; |
3767 |
+@@ -1786,14 +1786,14 @@ |
3768 |
+ while (buf1 > stop) |
3769 |
+ *--buf0=*--buf1; |
3770 |
+ |
3771 |
+- /* part 2 - min(frac) ... min(intg) */ |
3772 |
++ /* part 2 - MYSQL_MIN(frac) ... MYSQL_MIN(intg) */ |
3773 |
+ carry=0; |
3774 |
+ while (buf1 > stop2) |
3775 |
+ { |
3776 |
+ ADD(*--buf0, *--buf1, *--buf2, carry); |
3777 |
+ } |
3778 |
+ |
3779 |
+- /* part 3 - min(intg) ... max(intg) */ |
3780 |
++ /* part 3 - MYSQL_MIN(intg) ... MYSQL_MAX(intg) */ |
3781 |
+ buf1= intg1 > intg2 ? ((stop=from1->buf)+intg1-intg2) : |
3782 |
+ ((stop=from2->buf)+intg2-intg1) ; |
3783 |
+ while (buf1 > stop) |
3784 |
+@@ -1814,7 +1814,7 @@ |
3785 |
+ { |
3786 |
+ int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg), |
3787 |
+ frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac); |
3788 |
+- int frac0=max(frac1, frac2), error; |
3789 |
++ int frac0=MYSQL_MAX(frac1, frac2), error; |
3790 |
+ dec1 *buf1, *buf2, *buf0, *stop1, *stop2, *start1, *start2, carry=0; |
3791 |
+ |
3792 |
+ /* let carry:=1 if from2 > from1 */ |
3793 |
+@@ -1889,7 +1889,7 @@ |
3794 |
+ FIX_INTG_FRAC_ERROR(to->len, intg1, frac0, error); |
3795 |
+ buf0=to->buf+intg1+frac0; |
3796 |
+ |
3797 |
+- to->frac=max(from1->frac, from2->frac); |
3798 |
++ to->frac=MYSQL_MAX(from1->frac, from2->frac); |
3799 |
+ to->intg=intg1*DIG_PER_DEC1; |
3800 |
+ if (unlikely(error)) |
3801 |
+ { |
3802 |
+@@ -1900,7 +1900,7 @@ |
3803 |
+ } |
3804 |
+ carry=0; |
3805 |
+ |
3806 |
+- /* part 1 - max(frac) ... min (frac) */ |
3807 |
++ /* part 1 - MYSQL_MAX(frac) ... MYSQL_MIN (frac) */ |
3808 |
+ if (frac1 > frac2) |
3809 |
+ { |
3810 |
+ buf1=start1+intg1+frac1; |
3811 |
+@@ -1924,7 +1924,7 @@ |
3812 |
+ } |
3813 |
+ } |
3814 |
+ |
3815 |
+- /* part 2 - min(frac) ... intg2 */ |
3816 |
++ /* part 2 - MYSQL_MIN(frac) ... intg2 */ |
3817 |
+ while (buf2 > start2) |
3818 |
+ { |
3819 |
+ SUB(*--buf0, *--buf1, *--buf2, carry); |
3820 |
+@@ -2187,11 +2187,11 @@ |
3821 |
+ { |
3822 |
+ /* we're calculating N1 % N2. |
3823 |
+ The result will have |
3824 |
+- frac=max(frac1, frac2), as for subtraction |
3825 |
++ frac=MYSQL_MAX(frac1, frac2), as for subtraction |
3826 |
+ intg=intg2 |
3827 |
+ */ |
3828 |
+ to->sign=from1->sign; |
3829 |
+- to->frac=max(from1->frac, from2->frac); |
3830 |
++ to->frac=MYSQL_MAX(from1->frac, from2->frac); |
3831 |
+ frac0=0; |
3832 |
+ } |
3833 |
+ else |
3834 |
+@@ -2315,7 +2315,7 @@ |
3835 |
+ /* |
3836 |
+ now the result is in tmp1, it has |
3837 |
+ intg=prec1-frac1 |
3838 |
+- frac=max(frac1, frac2)=to->frac |
3839 |
++ frac=MYSQL_MAX(frac1, frac2)=to->frac |
3840 |
+ */ |
3841 |
+ if (dcarry) |
3842 |
+ *--start1=dcarry; |
3843 |
+@@ -2353,7 +2353,7 @@ |
3844 |
+ } |
3845 |
+ DBUG_ASSERT(intg0 <= ROUND_UP(from2->intg)); |
3846 |
+ stop1=start1+frac0+intg0; |
3847 |
+- to->intg=min(intg0*DIG_PER_DEC1, from2->intg); |
3848 |
++ to->intg=MYSQL_MIN(intg0*DIG_PER_DEC1, from2->intg); |
3849 |
+ } |
3850 |
+ if (unlikely(intg0+frac0 > to->len)) |
3851 |
+ { |
3852 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/my_vsnprintf.c mysql/strings/my_vsnprintf.c |
3853 |
+--- mysql.orig/strings/my_vsnprintf.c 2011-10-29 11:09:49.000000000 -0700 |
3854 |
++++ mysql/strings/my_vsnprintf.c 2011-11-18 15:43:17.103775424 -0800 |
3855 |
+@@ -143,7 +143,7 @@ |
3856 |
+ /* If %#d syntax was used, we have to pre-zero/pre-space the string */ |
3857 |
+ if (store_start == buff) |
3858 |
+ { |
3859 |
+- length= min(length, to_length); |
3860 |
++ length= MYSQL_MIN(length, to_length); |
3861 |
+ if (res_length < length) |
3862 |
+ { |
3863 |
+ size_t diff= (length- res_length); |
3864 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/strings/str2int.c mysql/strings/str2int.c |
3865 |
+--- mysql.orig/strings/str2int.c 2011-10-29 11:09:49.000000000 -0700 |
3866 |
++++ mysql/strings/str2int.c 2011-11-18 15:43:17.103775424 -0800 |
3867 |
+@@ -84,7 +84,7 @@ |
3868 |
+ machines all, if +|n| is representable, so is -|n|, but on |
3869 |
+ twos complement machines the converse is not true. So the |
3870 |
+ "maximum" representable number has a negative representative. |
3871 |
+- Limit is set to min(-|lower|,-|upper|); this is the "largest" |
3872 |
++ Limit is set to MYSQL_MIN(-|lower|,-|upper|); this is the "largest" |
3873 |
+ number we are concerned with. */ |
3874 |
+ |
3875 |
+ /* Calculate Limit using Scale as a scratch variable */ |
3876 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/tests/mysql_client_test.c mysql/tests/mysql_client_test.c |
3877 |
+--- mysql.orig/tests/mysql_client_test.c 2011-11-18 13:00:01.595513776 -0800 |
3878 |
++++ mysql/tests/mysql_client_test.c 2011-11-18 15:43:17.106775471 -0800 |
3879 |
+@@ -610,7 +610,7 @@ |
3880 |
+ return row_count; |
3881 |
+ } |
3882 |
+ |
3883 |
+- field_count= min(mysql_num_fields(result), MAX_RES_FIELDS); |
3884 |
++ field_count= MYSQL_MIN(mysql_num_fields(result), MAX_RES_FIELDS); |
3885 |
+ |
3886 |
+ bzero((char*) buffer, sizeof(buffer)); |
3887 |
+ bzero((char*) length, sizeof(length)); |
3888 |
+diff -Nuar --exclude '*.orig' --exclude '*.rej' mysql.orig/vio/viosocket.c mysql/vio/viosocket.c |
3889 |
+--- mysql.orig/vio/viosocket.c 2011-10-29 11:09:49.000000000 -0700 |
3890 |
++++ mysql/vio/viosocket.c 2011-11-18 15:43:17.107775487 -0800 |
3891 |
+@@ -72,7 +72,7 @@ |
3892 |
+ |
3893 |
+ if (vio->read_pos < vio->read_end) |
3894 |
+ { |
3895 |
+- rc= min((size_t) (vio->read_end - vio->read_pos), size); |
3896 |
++ rc= MYSQL_MIN((size_t) (vio->read_end - vio->read_pos), size); |
3897 |
+ memcpy(buf, vio->read_pos, rc); |
3898 |
+ vio->read_pos+= rc; |
3899 |
+ /* |