SOURCES: mysql-min_max.patch, mysql-libs.patch - updated

arekm arekm at pld-linux.org
Tue Jul 10 09:31:02 CEST 2007


Author: arekm                        Date: Tue Jul 10 07:31:02 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- updated

---- Files affected:
SOURCES:
   mysql-min_max.patch (1.4 -> 1.5) , mysql-libs.patch (1.16 -> 1.17) 

---- Diffs:

================================================================
Index: SOURCES/mysql-min_max.patch
diff -u SOURCES/mysql-min_max.patch:1.4 SOURCES/mysql-min_max.patch:1.5
--- SOURCES/mysql-min_max.patch:1.4	Mon Jun  4 10:00:32 2007
+++ SOURCES/mysql-min_max.patch	Tue Jul 10 09:30:56 2007
@@ -1,37 +1,1953 @@
-diff -urN mysql-5.1.17-beta.org/include/my_global.h mysql-5.1.17-beta/include/my_global.h
---- mysql-5.1.17-beta.org/include/my_global.h	2007-04-04 15:15:25.000000000 +0200
-+++ mysql-5.1.17-beta/include/my_global.h	2007-05-01 19:46:56.111245806 +0200
-@@ -543,9 +543,11 @@
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/client/mysqlbinlog.cc mysql-5.1.20-beta/client/mysqlbinlog.cc
+--- mysql-5.1.20-beta.org/client/mysqlbinlog.cc	2007-06-28 12:20:42.000000000 +0200
++++ mysql-5.1.20-beta/client/mysqlbinlog.cc	2007-07-09 22:01:29.659919981 +0200
+@@ -1437,7 +1437,7 @@
+       my_off_t length,tmp;
+       for (length= start_position_mot ; length > 0 ; length-=tmp)
+       {
+-	tmp=min(length,sizeof(buff));
++	tmp=mysql_min(length,sizeof(buff));
+ 	if (my_b_read(file, buff, (uint) tmp))
+         {
+           error= 1;
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/client/mysql.cc mysql-5.1.20-beta/client/mysql.cc
+--- mysql-5.1.20-beta.org/client/mysql.cc	2007-06-28 12:12:39.000000000 +0200
++++ mysql-5.1.20-beta/client/mysql.cc	2007-07-09 22:01:29.676587510 +0200
+@@ -2358,9 +2358,9 @@
+   {
+     uint length= column_names ? field->name_length : 0;
+     if (quick)
+-      length=max(length,field->length);
++      length=mysql_max(length,field->length);
+     else
+-      length=max(length,field->max_length);
++      length=mysql_max(length,field->max_length);
+     if (length < 4 && !IS_NOT_NULL(field->flags))
+       length=4;					// Room for "NULL"
+     field->max_length=length;
+@@ -2380,7 +2380,7 @@
+                                                   field->name,
+                                                   field->name + name_length);
+       uint display_length= field->max_length + name_length - numcells;
+-      tee_fprintf(PAGER, " %-*s |",(int) min(display_length,
++      tee_fprintf(PAGER, " %-*s |",(int) mysql_min(display_length,
+                                             MAX_COLUMN_LENGTH),
+                   field->name);
+       num_flag[off]= IS_NUM(field->type);
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/client/mysqldump.c mysql-5.1.20-beta/client/mysqldump.c
+--- mysql-5.1.20-beta.org/client/mysqldump.c	2007-06-28 12:13:37.000000000 +0200
++++ mysql-5.1.20-beta/client/mysqldump.c	2007-07-09 22:01:26.209741497 +0200
+@@ -773,7 +773,7 @@
+                                     &err_ptr, &err_len);
+       if (err_len)
+       {
+-        strmake(buff, err_ptr, min(sizeof(buff), err_len));
++        strmake(buff, err_ptr, mysql_min(sizeof(buff), err_len));
+         fprintf(stderr, "Invalid mode to --compatible: %s\n", buff);
+         exit(1);
+       }
+@@ -3776,7 +3776,7 @@
+ 
+       for (; pos != end && *pos != ','; pos++) ;
+       var_len= (uint) (pos - start);
+-      strmake(buff, start, min(sizeof(buff), var_len));
++      strmake(buff, start, mysql_min(sizeof(buff), var_len));
+       find= find_type(buff, lib, var_len);
+       if (!find)
+       {
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/client/mysqltest.c mysql-5.1.20-beta/client/mysqltest.c
+--- mysql-5.1.20-beta.org/client/mysqltest.c	2007-06-28 12:19:58.000000000 +0200
++++ mysql-5.1.20-beta/client/mysqltest.c	2007-07-09 22:01:26.263077589 +0200
+@@ -4040,9 +4040,9 @@
+       }
+       else if ((c == '{' &&
+                 (!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
+-                                      (uchar*) buf, min(5, p - buf), 0) ||
++                                      (uchar*) buf, mysql_min(5, p - buf), 0) ||
+                  !my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
+-                                      (uchar*) buf, min(2, p - buf), 0))))
++                                      (uchar*) buf, mysql_min(2, p - buf), 0))))
+       {
+         /* Only if and while commands can be terminated by { */
+         *p++= c;
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/client/mysql_upgrade.c mysql-5.1.20-beta/client/mysql_upgrade.c
+--- mysql-5.1.20-beta.org/client/mysql_upgrade.c	2007-07-09 21:00:10.070054000 +0200
++++ mysql-5.1.20-beta/client/mysql_upgrade.c	2007-07-09 22:03:48.110415548 +0200
+@@ -391,7 +391,7 @@
+     DBUG_PRINT("enter", ("path: %s", path));
+ 
+     /* Chop off last char(since it might be a /) */
+-    path[max((strlen(path)-1), 0)]= 0;
++    path[mysql_max((strlen(path)-1), 0)]= 0;
+ 
+     /* Chop off last dir part */
+     dirname_part(path, path, &path_len);
+@@ -482,7 +482,7 @@
+   if ((value_end= strchr(value_start, '\n')) == NULL)
+     return 1; /* Unexpected result */
+ 
+-  strncpy(value, value_start, min(FN_REFLEN, value_end-value_start));
++  strncpy(value, value_start, mysql_min(FN_REFLEN, value_end-value_start));
+   return 0;
+ }
+ 
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/client/sql_string.cc mysql-5.1.20-beta/client/sql_string.cc
+--- mysql-5.1.20-beta.org/client/sql_string.cc	2007-06-28 12:09:37.000000000 +0200
++++ mysql-5.1.20-beta/client/sql_string.cc	2007-07-09 22:01:29.679921016 +0200
+@@ -662,7 +662,7 @@
+ {
+   if (Alloced_length < str_length + space_needed)
+   {
+-    if (realloc(Alloced_length + max(space_needed, grow_by) - 1))
++    if (realloc(Alloced_length + mysql_max(space_needed, grow_by) - 1))
+       return TRUE;
+   }
+   return FALSE;
+@@ -748,7 +748,7 @@
+ 
+ int stringcmp(const String *s,const String *t)
+ {
+-  uint32 s_len=s->length(),t_len=t->length(),len=min(s_len,t_len);
++  uint32 s_len=s->length(),t_len=t->length(),len=mysql_min(s_len,t_len);
+   int cmp= memcmp(s->ptr(), t->ptr(), len);
+   return (cmp) ? cmp : (int) (s_len - t_len);
+ }
+@@ -765,7 +765,7 @@
+   }
+   if (to->realloc(from_length))
+     return from;				// Actually an error
+-  if ((to->str_length=min(from->str_length,from_length)))
++  if ((to->str_length=mysql_min(from->str_length,from_length)))
+     memcpy(to->Ptr,from->Ptr,to->str_length);
+   to->str_charset=from->str_charset;
+   return to;
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/dbug/dbug.c mysql-5.1.20-beta/dbug/dbug.c
+--- mysql-5.1.20-beta.org/dbug/dbug.c	2007-06-28 12:10:10.000000000 +0200
++++ mysql-5.1.20-beta/dbug/dbug.c	2007-07-09 22:01:26.279745118 +0200
+@@ -1177,7 +1177,7 @@
+     if (TRACING)
+     {
+       Indent(cs, cs->level + 1);
+-      pos= min(max(cs->level-cs->stack->sub_level,0)*INDENT,80);
++      pos= mysql_min(mysql_max(cs->level-cs->stack->sub_level,0)*INDENT,80);
+     }
+     else
+     {
+@@ -1661,7 +1661,7 @@
+ {
+   REGISTER int count;
+ 
+-  indent= max(indent-1-cs->stack->sub_level,0)*INDENT;
++  indent= mysql_max(indent-1-cs->stack->sub_level,0)*INDENT;
+   for (count= 0; count < indent ; count++)
+   {
+     if ((count % INDENT) == 0)
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/extra/yassl/src/ssl.cpp mysql-5.1.20-beta/extra/yassl/src/ssl.cpp
+--- mysql-5.1.20-beta.org/extra/yassl/src/ssl.cpp	2007-06-28 12:08:29.000000000 +0200
++++ mysql-5.1.20-beta/extra/yassl/src/ssl.cpp	2007-07-09 21:30:21.284088871 +0200
+@@ -113,7 +113,7 @@
+                 // use file's salt for key derivation, but not real iv
+                 TaoCrypt::Source source(info.iv, info.ivSz);
+                 TaoCrypt::HexDecoder dec(source);
+-                memcpy(info.iv, source.get_buffer(), min((uint)sizeof(info.iv),
++                memcpy(info.iv, source.get_buffer(), mysql_min((uint)sizeof(info.iv),
+                                                          source.size()));
+                 EVP_BytesToKey(info.name, "MD5", info.iv, (byte*)password,
+                                passwordSz, 1, key, iv);
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/extra/yassl/taocrypt/src/dh.cpp mysql-5.1.20-beta/extra/yassl/taocrypt/src/dh.cpp
+--- mysql-5.1.20-beta.org/extra/yassl/taocrypt/src/dh.cpp	2007-06-28 12:12:20.000000000 +0200
++++ mysql-5.1.20-beta/extra/yassl/taocrypt/src/dh.cpp	2007-07-09 21:30:11.153569701 +0200
+@@ -54,7 +54,7 @@
+ // Generate private value
+ void DH::GeneratePrivate(RandomNumberGenerator& rng, byte* priv)
+ {
+-    Integer x(rng, Integer::One(), min(p_ - 1,
++    Integer x(rng, Integer::One(), mysql_min(p_ - 1,
+         Integer::Power2(2*DiscreteLogWorkFactor(p_.BitCount())) ) );
+     x.Encode(priv, p_.ByteCount());
+ }
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/include/my_global.h mysql-5.1.20-beta/include/my_global.h
+--- mysql-5.1.20-beta.org/include/my_global.h	2007-06-28 12:19:46.000000000 +0200
++++ mysql-5.1.20-beta/include/my_global.h	2007-07-09 21:08:22.539844888 +0200
+@@ -552,10 +552,8 @@
  #endif
  
  /* Define some useful general macros */
 -#if !defined(max)
 -#define max(a, b)	((a) > (b) ? (a) : (b))
 -#define min(a, b)	((a) < (b) ? (a) : (b))
-+#if !defined(mysql_max)
-+#define mysql_max(a, b)      ((a) > (b) ? (a) : (b))
-+#define mysql_min(a, b)      ((a) < (b) ? (a) : (b))
-+static __inline long min( long a, long b ) { return ( ( a < b ) ? a : b ); }
-+static __inline long max( long a, long b ) { return ( ( a > b ) ? a : b ); }
- #endif
+-#endif
++#define mysql_max(a, b)	((a) > (b) ? (a) : (b))
++#define mysql_min(a, b)	((a) < (b) ? (a) : (b))
  
  #if !defined(HAVE_UINT)
-diff -urN mysql-5.1.17-beta.org/sql/tztime.cc mysql-5.1.17-beta/sql/tztime.cc
---- mysql-5.1.17-beta.org/sql/tztime.cc	2007-04-04 15:16:24.000000000 +0200
-+++ mysql-5.1.17-beta/sql/tztime.cc	2007-05-01 19:47:19.705911429 +0200
-@@ -167,7 +167,7 @@
-       char buf[sizeof(struct tzhead) + sizeof(my_time_t) * TZ_MAX_TIMES +
-                TZ_MAX_TIMES + sizeof(TRAN_TYPE_INFO) * TZ_MAX_TYPES +
- #ifdef ABBR_ARE_USED
--               max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1))) +
-+               mysql_max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1))) +
+ #undef HAVE_UINT
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/libmysql/libmysql.c mysql-5.1.20-beta/libmysql/libmysql.c
+--- mysql-5.1.20-beta.org/libmysql/libmysql.c	2007-06-28 12:08:32.000000000 +0200
++++ mysql-5.1.20-beta/libmysql/libmysql.c	2007-07-09 22:01:26.893110182 +0200
+@@ -1538,7 +1538,7 @@
+   my_net_set_read_timeout(net, CLIENT_NET_READ_TIMEOUT);
+   my_net_set_write_timeout(net, CLIENT_NET_WRITE_TIMEOUT);
+   net->retry_count=  1;
+-  net->max_packet_size= max(net_buffer_length, max_allowed_packet);
++  net->max_packet_size= mysql_max(net_buffer_length, max_allowed_packet);
+ }
+ 
+ /*
+@@ -3614,7 +3614,7 @@
+       copy_length= end - start;
+       /* We've got some data beyond offset: copy up to buffer_length bytes */
+       if (param->buffer_length)
+-        memcpy(buffer, start, min(copy_length, param->buffer_length));
++        memcpy(buffer, start, mysql_min(copy_length, param->buffer_length));
+     }
+     else
+       copy_length= 0;
+@@ -3841,9 +3841,9 @@
+         precisions. This will ensure that on the same machine you get the
+         same value as a string independent of the protocol you use.
+       */
+-      sprintf(buff, "%-*.*g", (int) min(sizeof(buff)-1,
++      sprintf(buff, "%-*.*g", (int) mysql_min(sizeof(buff)-1,
+                                         param->buffer_length),
+-	      min(14,width), value);
++	      mysql_min(14,width), value);
+       end= strcend(buff, ' ');
+       *end= 0;
+     }
+@@ -4148,7 +4148,7 @@
+                              uchar **row)
+ {
+   ulong length= net_field_length(row);
+-  ulong copy_length= min(length, param->buffer_length);
++  ulong copy_length= mysql_min(length, param->buffer_length);
+   memcpy(param->buffer, (char *)*row, copy_length);
+   *param->length= length;
+   *param->error= copy_length < length;
+@@ -4160,7 +4160,7 @@
+                              uchar **row)
+ {
+   ulong length= net_field_length(row);
+-  ulong copy_length= min(length, param->buffer_length);
++  ulong copy_length= mysql_min(length, param->buffer_length);
+   memcpy(param->buffer, (char *)*row, copy_length);
+   /* Add an end null if there is room in the buffer */
+   if (copy_length != param->buffer_length)
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/libmysqld/lib_sql.cc mysql-5.1.20-beta/libmysqld/lib_sql.cc
+--- mysql-5.1.20-beta.org/libmysqld/lib_sql.cc	2007-06-28 12:14:47.000000000 +0200
++++ mysql-5.1.20-beta/libmysqld/lib_sql.cc	2007-07-09 22:01:29.686588027 +0200
+@@ -791,7 +791,7 @@
+     is cleared between substatements, and mysqltest gets confused
+   */
+   thd->cur_data->embedded_info->warning_count=
+-    (thd->spcont ? 0 : min(thd->total_warn_count, 65535));
++    (thd->spcont ? 0 : mysql_min(thd->total_warn_count, 65535));
+ }
+ 
+ 
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/array.c mysql-5.1.20-beta/mysys/array.c
+--- mysql-5.1.20-beta.org/mysys/array.c	2007-06-28 12:11:25.000000000 +0200
++++ mysql-5.1.20-beta/mysys/array.c	2007-07-09 22:01:27.733153639 +0200
+@@ -47,7 +47,7 @@
+   DBUG_ENTER("init_dynamic_array");
+   if (!alloc_increment)
+   {
+-    alloc_increment=max((8192-MALLOC_OVERHEAD)/element_size,16);
++    alloc_increment=mysql_max((8192-MALLOC_OVERHEAD)/element_size,16);
+     if (init_alloc > 8 && alloc_increment > init_alloc * 2)
+       alloc_increment=init_alloc*2;
+   }
+@@ -313,7 +313,7 @@
+ 
+ void freeze_size(DYNAMIC_ARRAY *array)
+ {
+-  uint elements=max(array->elements,1);
++  uint elements=mysql_max(array->elements,1);
+ 
+   /*
+     Do nothing if we are using a static buffer
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/default.c mysql-5.1.20-beta/mysys/default.c
+--- mysql-5.1.20-beta.org/mysys/default.c	2007-06-28 12:16:40.000000000 +0200
++++ mysql-5.1.20-beta/mysys/default.c	2007-07-09 22:01:27.743154157 +0200
+@@ -722,7 +722,7 @@
+       for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ;
+       end[0]=0;
+ 
+-      strmake(curr_gr, ptr, min((size_t) (end-ptr)+1, sizeof(curr_gr)-1));
++      strmake(curr_gr, ptr, mysql_min((size_t) (end-ptr)+1, sizeof(curr_gr)-1));
+ 
+       /* signal that a new group is found */
+       opt_handler(handler_ctx, curr_gr, NULL);
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/mf_format.c mysql-5.1.20-beta/mysys/mf_format.c
+--- mysql-5.1.20-beta.org/mysys/mf_format.c	2007-06-28 12:14:45.000000000 +0200
++++ mysql-5.1.20-beta/mysys/mf_format.c	2007-07-09 22:01:27.756488180 +0200
+@@ -83,7 +83,7 @@
+     tmp_length= strlength(startpos);
+     DBUG_PRINT("error",("dev: '%s'  ext: '%s'  length: %u",dev,ext,
+                         (uint) length));
+-    (void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1));
++    (void) strmake(to,startpos,mysql_min(tmp_length,FN_REFLEN-1));
+   }
+   else
+   {
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/mf_iocache.c mysql-5.1.20-beta/mysys/mf_iocache.c
+--- mysql-5.1.20-beta.org/mysys/mf_iocache.c	2007-06-28 12:16:32.000000000 +0200
++++ mysql-5.1.20-beta/mysys/mf_iocache.c	2007-07-09 22:01:27.766488697 +0200
+@@ -1091,7 +1091,7 @@
+   */
+   while (write_length)
+   {
+-    size_t copy_length= min(write_length, write_cache->buffer_length);
++    size_t copy_length= mysql_min(write_length, write_cache->buffer_length);
+     int  __attribute__((unused)) rc;
+ 
+     rc= lock_io_cache(write_cache, write_cache->pos_in_file);
+@@ -1250,7 +1250,7 @@
+       TODO: figure out if the assert below is needed or correct.
+     */
+     DBUG_ASSERT(pos_in_file == info->end_of_file);
+-    copy_len=min(Count, len_in_buff);
++    copy_len=mysql_min(Count, len_in_buff);
+     memcpy(Buffer, info->append_read_pos, copy_len);
+     info->append_read_pos += copy_len;
+     Count -= copy_len;
+@@ -1359,7 +1359,7 @@
+     }
  #endif
-                sizeof(LS_INFO) * TZ_MAX_LEAPS];
-     } u;
-
---- mysql/sql/sql_cache.cc.org	2007-05-01 19:54:50.311298644 +0200
-+++ mysql/sql/sql_cache.cc	2007-05-01 19:54:59.958508136 +0200
-@@ -2585,7 +2585,7 @@
+ 	/* Copy found bytes to buffer */
+-    length=min(Count,read_length);
++    length=mysql_min(Count,read_length);
+     memcpy(Buffer,info->read_pos,(size_t) length);
+     Buffer+=length;
+     Count-=length;
+@@ -1393,7 +1393,7 @@
+       if ((read_length=my_read(info->file,info->request_pos,
+ 			       read_length, info->myflags)) == (size_t) -1)
+         return info->error= -1;
+-      use_length=min(Count,read_length);
++      use_length=mysql_min(Count,read_length);
+       memcpy(Buffer,info->request_pos,(size_t) use_length);
+       info->read_pos=info->request_pos+Count;
+       info->read_end=info->request_pos+read_length;
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/my_alloc.c mysql-5.1.20-beta/mysys/my_alloc.c
+--- mysql-5.1.20-beta.org/mysys/my_alloc.c	2007-06-28 12:12:16.000000000 +0200
++++ mysql-5.1.20-beta/mysys/my_alloc.c	2007-07-09 22:01:27.809824272 +0200
+@@ -196,7 +196,7 @@
+   {						/* Time to alloc new block */
+     block_size= mem_root->block_size * (mem_root->block_num >> 2);
+     get_size= length+ALIGN_SIZE(sizeof(USED_MEM));
+-    get_size= max(get_size, block_size);
++    get_size= mysql_max(get_size, block_size);
+ 
+     if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME))))
+     {
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/my_bitmap.c mysql-5.1.20-beta/mysys/my_bitmap.c
+--- mysql-5.1.20-beta.org/mysys/my_bitmap.c	2007-06-28 12:12:21.000000000 +0200
++++ mysql-5.1.20-beta/mysys/my_bitmap.c	2007-07-09 22:03:23.752488826 +0200
+@@ -364,7 +364,7 @@
+ 
+   DBUG_ASSERT(map->bitmap && map2->bitmap);
+ 
+-  end= to+min(len,len2);
++  end= to+mysql_min(len,len2);
+   *map2->last_word_ptr&= ~map2->last_word_mask; /*Clear last bits in map2*/
+   while (to < end)
+     *to++ &= *from++;
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/my_compress.c mysql-5.1.20-beta/mysys/my_compress.c
+--- mysql-5.1.20-beta.org/mysys/my_compress.c	2007-06-28 12:20:30.000000000 +0200
++++ mysql-5.1.20-beta/mysys/my_compress.c	2007-07-09 22:01:27.816491284 +0200
+@@ -240,7 +240,7 @@
+ 
+    if (ver != 1)
+      DBUG_RETURN(1);
+-   if (!(data= my_malloc(max(orglen, complen), MYF(MY_WME))))
++   if (!(data= my_malloc(mysql_max(orglen, complen), MYF(MY_WME))))
+      DBUG_RETURN(2);
+    memcpy(data, pack_data + BLOB_HEADER, complen);
+ 
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/my_conio.c mysql-5.1.20-beta/mysys/my_conio.c
+--- mysql-5.1.20-beta.org/mysys/my_conio.c	2007-06-28 12:10:20.000000000 +0200
++++ mysql-5.1.20-beta/mysys/my_conio.c	2007-07-09 22:01:27.819824790 +0200
+@@ -165,13 +165,13 @@
+     though it is known it should not be more than 64K               
+     so we cut 64K and try first size of screen buffer               
+     if it is still to large we cut half of it and try again         
+-    later we may want to cycle from min(clen, 65535) to allowed size
++    later we may want to cycle from mysql_min(clen, 65535) to allowed size
+     with small decrement to determine exact allowed buffer           
+   */
+-  clen= min(clen, 65535);
++  clen= mysql_min(clen, 65535);
+   do
+   {
+-    clen= min(clen, (size_t) csbi.dwSize.X*csbi.dwSize.Y);
++    clen= mysql_min(clen, (size_t) csbi.dwSize.X*csbi.dwSize.Y);
+     if (!ReadConsole((HANDLE)my_coninpfh, (LPVOID)buffer, clen - 1, &plen_res,
+                      NULL))
+     {
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/my_file.c mysql-5.1.20-beta/mysys/my_file.c
+--- mysql-5.1.20-beta.org/mysys/my_file.c	2007-06-28 12:19:16.000000000 +0200
++++ mysql-5.1.20-beta/mysys/my_file.c	2007-07-09 22:01:27.823158295 +0200
+@@ -75,7 +75,7 @@
+ static int set_max_open_files(uint max_file_limit)
+ {
+   /* We don't know the limit. Return best guess */
+-  return min(max_file_limit, OS_FILE_LIMIT);
++  return mysql_min(max_file_limit, OS_FILE_LIMIT);
+ }
+ #endif
+ 
+@@ -97,7 +97,7 @@
+   DBUG_ENTER("my_set_max_open_files");
+   DBUG_PRINT("enter",("files: %u  my_file_limit: %u", files, my_file_limit));
+ 
+-  files= set_max_open_files(min(files, OS_FILE_LIMIT));
++  files= set_max_open_files(mysql_min(files, OS_FILE_LIMIT));
+   if (files <= MY_NFILE)
+     DBUG_RETURN(files);
+ 
+@@ -107,9 +107,9 @@
+ 
+   /* Copy any initialized files */
+   memcpy((char*) tmp, (char*) my_file_info,
+-         sizeof(*tmp) * min(my_file_limit, files));
++         sizeof(*tmp) * mysql_min(my_file_limit, files));
+   bzero((char*) (tmp + my_file_limit),
+-        max((int) (files- my_file_limit), 0)*sizeof(*tmp));
++        mysql_max((int) (files- my_file_limit), 0)*sizeof(*tmp));
+   my_free_open_file_info();			/* Free if already allocated */
+   my_file_info= tmp;
+   my_file_limit= files;
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/my_getopt.c mysql-5.1.20-beta/mysys/my_getopt.c
+--- mysql-5.1.20-beta.org/mysys/my_getopt.c	2007-06-28 12:10:20.000000000 +0200
++++ mysql-5.1.20-beta/mysys/my_getopt.c	2007-07-09 22:01:27.833158813 +0200
+@@ -766,7 +766,7 @@
+     num= (ulonglong) optp->max_value;
+   num= ((num - optp->sub_size) / block_size);
+   num= (longlong) (num * block_size);
+-  return max(num, optp->min_value);
++  return mysql_max(num, optp->min_value);
+ }
+ 
+ /*
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/my_handler.c mysql-5.1.20-beta/mysys/my_handler.c
+--- mysql-5.1.20-beta.org/mysys/my_handler.c	2007-06-28 12:19:37.000000000 +0200
++++ mysql-5.1.20-beta/mysys/my_handler.c	2007-07-09 22:01:27.836492318 +0200
+@@ -33,7 +33,7 @@
+ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
+                        my_bool part_key, my_bool skip_end_space)
+ {
+-  uint length= min(a_length,b_length);
++  uint length= mysql_min(a_length,b_length);
+   uchar *end= a+ length;
+   int flag;
+ 
+@@ -161,7 +161,7 @@
+         continue;                               /* To next key part */
+       }
+     }
+-    end= a+ min(keyseg->length,key_length);
++    end= a+ mysql_min(keyseg->length,key_length);
+     next_key_length=key_length-keyseg->length;
+ 
+     switch ((enum ha_base_keytype) keyseg->type) {
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/mysys/safemalloc.c mysql-5.1.20-beta/mysys/safemalloc.c
+--- mysql-5.1.20-beta.org/mysys/safemalloc.c	2007-06-28 12:21:16.000000000 +0200
++++ mysql-5.1.20-beta/mysys/safemalloc.c	2007-07-09 22:01:27.886494905 +0200
+@@ -237,7 +237,7 @@
+ 
+   if ((data= _mymalloc(size,filename,lineno,MyFlags))) /* Allocate new area */
+   {
+-    size=min(size, irem->datasize);		/* Move as much as possibly */
++    size=mysql_min(size, irem->datasize);		/* Move as much as possibly */
+     memcpy((uchar*) data, ptr, (size_t) size);	/* Copy old data */
+     _myfree(ptr, filename, lineno, 0);		/* Free not needed area */
+   }
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/server-tools/instance-manager/buffer.cc mysql-5.1.20-beta/server-tools/instance-manager/buffer.cc
+--- mysql-5.1.20-beta.org/server-tools/instance-manager/buffer.cc	2007-06-28 12:11:53.000000000 +0200
++++ mysql-5.1.20-beta/server-tools/instance-manager/buffer.cc	2007-07-09 22:01:31.016656834 +0200
+@@ -83,7 +83,7 @@
+   if (position + len_arg >= buffer_size)
+   {
+     buffer= (uchar*) my_realloc(buffer,
+-                                min(MAX_BUFFER_SIZE,
++                                mysql_min(MAX_BUFFER_SIZE,
+                                     max((uint) (buffer_size*1.5),
+                                         position + len_arg)), MYF(0));
+     if (!(buffer))
+--- mysql-5.1.20-beta/server-tools/instance-manager/buffer.cc.org	2007-07-10 09:11:26.756879683 +0200
++++ mysql-5.1.20-beta/server-tools/instance-manager/buffer.cc	2007-07-10 09:11:54.378340495 +0200
+@@ -84,7 +84,7 @@
+   {
+     buffer= (uchar*) my_realloc(buffer,
+                                 mysql_min(MAX_BUFFER_SIZE,
+-                                    max((uint) (buffer_size*1.5),
++                                    mysql_max((uint) (buffer_size*1.5),
+                                         position + len_arg)), MYF(0));
+     if (!(buffer))
+       goto err;
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/server-tools/instance-manager/listener.cc mysql-5.1.20-beta/server-tools/instance-manager/listener.cc
+--- mysql-5.1.20-beta.org/server-tools/instance-manager/listener.cc	2007-06-28 12:06:28.000000000 +0200
++++ mysql-5.1.20-beta/server-tools/instance-manager/listener.cc	2007-07-09 22:01:31.039991375 +0200
+@@ -102,7 +102,7 @@
+ 
+   /* II. Listen sockets and spawn childs */
+   for (i= 0; i < num_sockets; i++)
+-    n= max(n, sockets[i]);
++    n= mysql_max(n, sockets[i]);
+   n++;
+ 
+   timeval tv;
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/sql/client.c mysql-5.1.20-beta/sql/client.c
+--- mysql-5.1.20-beta.org/sql/client.c	2007-07-09 21:00:09.556694000 +0200
++++ mysql-5.1.20-beta/sql/client.c	2007-07-09 22:01:28.059837206 +0200
+@@ -625,7 +625,7 @@
+ 	pos+= SQLSTATE_LENGTH+1;
+       }
+       (void) strmake(net->last_error,(char*) pos,
+-		     min((uint) len,(uint) sizeof(net->last_error)-1));
++		     mysql_min((uint) len,(uint) sizeof(net->last_error)-1));
+     }
+     else
+       set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
+@@ -2022,7 +2022,7 @@
+ 	goto error;
+       }
+       memcpy(&sock_addr.sin_addr, hp->h_addr,
+-             min(sizeof(sock_addr.sin_addr), (size_t) hp->h_length));
++             mysql_min(sizeof(sock_addr.sin_addr), (size_t) hp->h_length));
+       my_gethostbyname_r_free();
+     }
+     sock_addr.sin_port = (ushort) htons((ushort) port);
+diff -ur -x '*.Po' -x '*.log' -x '*.t' -x '*.Plo' mysql-5.1.20-beta.org/sql/field.cc mysql-5.1.20-beta/sql/field.cc
+--- mysql-5.1.20-beta.org/sql/field.cc	2007-06-28 12:04:52.000000000 +0200
++++ mysql-5.1.20-beta/sql/field.cc	2007-07-09 22:15:08.755624273 +0200
+@@ -49,7 +49,7 @@
+ #define LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE 128
+ #define DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE 128
+ #define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
+-((ulong) ((LL(1) << min(arg, 4) * 8) - LL(1)))
++((ulong) ((LL(1) << mysql_min(arg, 4) * 8) - LL(1)))
+ 
+ #define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)))
+ #define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index)))
+@@ -1923,7 +1923,7 @@
+     tmp_uint=tmp_dec+(uint)(int_digits_end-int_digits_from);
+   else if (expo_sign_char == '-') 
+   {
+-    tmp_uint=min(exponent,(uint)(int_digits_end-int_digits_from));
++    tmp_uint=mysql_min(exponent,(uint)(int_digits_end-int_digits_from));
+     frac_digits_added_zeros=exponent-tmp_uint;
+     int_digits_end -= tmp_uint;
+     frac_digits_head_end=int_digits_end+tmp_uint;
+@@ -1931,7 +1931,7 @@
+   }
+   else // (expo_sign_char=='+') 
+   {
+-    tmp_uint=min(exponent,(uint)(frac_digits_end-frac_digits_from));
++    tmp_uint=mysql_min(exponent,(uint)(frac_digits_end-frac_digits_from));
+     int_digits_added_zeros=exponent-tmp_uint;
+     int_digits_tail_from=frac_digits_from;
+     frac_digits_from=frac_digits_from+tmp_uint;
+@@ -2771,7 +2771,7 @@
+   ASSERT_COLUMN_MARKED_FOR_READ;
+   CHARSET_INFO *cs= &my_charset_bin;
+   uint length;
+-  uint mlength=max(field_length+1,5*cs->mbmaxlen);
++  uint mlength=mysql_max(field_length+1,5*cs->mbmaxlen);
+   val_buffer->alloc(mlength);
+   char *to=(char*) val_buffer->ptr();
+ 
+@@ -2983,7 +2983,7 @@
+   ASSERT_COLUMN_MARKED_FOR_READ;
+   CHARSET_INFO *cs= &my_charset_bin;
+   uint length;
+-  uint mlength=max(field_length+1,7*cs->mbmaxlen);
++  uint mlength=mysql_max(field_length+1,7*cs->mbmaxlen);
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/mysql-min_max.patch?r1=1.4&r2=1.5&f=u
    http://cvs.pld-linux.org/SOURCES/mysql-libs.patch?r1=1.16&r2=1.17&f=u



More information about the pld-cvs-commit mailing list