From: Date: June 24 2005 10:41pm Subject: bk commit into 5.0 tree (jimw:1.2006) BUG#7003 List-Archive: http://lists.mysql.com/internals/26421 X-Bug: 7003 Message-Id: <20050624204139.318EEA85FD@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 5.0 repository of jimw. When jimw does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2006 05/06/24 13:41:33 jimw@stripped +17 -0 Add my_str_malloc and _free function pointers to strings library which will by default exit(1) if malloc() fails, but can be set to do something else by the calling program does, which mysqld does to use my_malloc(..., MYF(MY_FAE)) instead. Also checks allocation in conf_to_src utility program. (Bug #7003) strings/ctype-tis620.c 1.87 05/06/24 13:41:30 jimw@stripped +4 -4 Use my_str_malloc/free strings/Makefile.am 1.47 05/06/24 13:41:30 jimw@stripped +3 -3 Add str_alloc.c sql/mysqld.cc 1.475 05/06/24 13:41:30 jimw@stripped +20 -1 Reassign my_str_malloc/free pointers so they use my_malloc/free libmysql/Makefile.shared 1.64 05/06/24 13:41:30 jimw@stripped +1 -1 Add str_alloc.lo include/m_string.h 1.36 05/06/24 13:41:30 jimw@stripped +7 -0 Add my_str_malloc/free function pointers. VC++Files/strings/strings_ia64.dsp 1.5 05/06/24 13:41:30 jimw@stripped +4 -0 Add str_alloc.c VC++Files/strings/strings.dsp 1.19 05/06/24 13:41:30 jimw@stripped +4 -0 Add str_alloc.c VC++Files/strings/noMASM/strings.dsp 1.6 05/06/24 13:41:30 jimw@stripped +4 -0 Add str_alloc.c VC++Files/strings/backup/strings.dsp 1.4 05/06/24 13:41:30 jimw@stripped +6 -1 Add str_alloc.c VC++Files/libmysqld/libmysqld_ia64.dsp 1.3 05/06/24 13:41:30 jimw@stripped +4 -0 Add str_alloc.c VC++Files/libmysqld/libmysqld.dsp 1.26 05/06/24 13:41:30 jimw@stripped +4 -0 Add str_alloc.c VC++Files/libmysql/libmysql_ia64.dsp 1.5 05/06/24 13:41:30 jimw@stripped +4 -0 Add str_alloc.c VC++Files/libmysql/libmysql.dsp 1.36 05/06/24 13:41:29 jimw@stripped +4 -0 Add str_alloc.c VC++Files/client/mysqlclient_ia64.dsp 1.4 05/06/24 13:41:29 jimw@stripped +4 -0 Add str_alloc.c VC++Files/client/mysqlclient.dsp 1.36 05/06/24 13:41:29 jimw@stripped +4 -0 Add str_alloc.c strings/str_alloc.c 1.1 05/06/24 13:20:37 jimw@stripped +34 -0 strings/str_alloc.c 1.0 05/06/24 13:20:37 jimw@stripped +0 -0 BitKeeper file /home/jimw/my/mysql-5.0-7003/strings/str_alloc.c strings/conf_to_src.c 1.14 05/06/24 11:19:54 jimw@stripped +2 -0 if malloc() fails, just abort # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-5.0-7003 --- 1.35/include/m_string.h 2005-02-22 05:14:12 -08:00 +++ 1.36/include/m_string.h 2005-06-24 13:41:30 -07:00 @@ -88,6 +88,13 @@ extern "C" { #endif +/* + my_str_malloc() and my_str_free() are assigned to implementations in + strings/alloc.c, but can be overridden in the calling program. + */ +extern void *(*my_str_malloc)(size_t); +extern void (*my_str_free)(void *); + #if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread) #define strmov(A,B) stpcpy((A),(B)) #ifndef stpcpy --- 1.474/sql/mysqld.cc 2005-06-22 02:11:18 -07:00 +++ 1.475/sql/mysqld.cc 2005-06-24 13:41:30 -07:00 @@ -2304,6 +2304,19 @@ DBUG_RETURN(0); } + +static void *my_str_malloc_mysqld(size_t size) +{ + return my_malloc(size, MYF(MY_FAE)); +} + + +static void my_str_free_mysqld(void *ptr) +{ + my_free((gptr)ptr, MYF(MY_FAE)); +} + + #ifdef __WIN__ struct utsname @@ -3159,10 +3172,16 @@ #endif /* + Initialize my_str_malloc() and my_str_free() + */ + my_str_malloc= &my_str_malloc_mysqld; + my_str_free= &my_str_free_mysqld; + + /* init signals & alarm After this we can't quit by a simple unireg_abort */ - error_handler_hook = my_message_sql; + error_handler_hook= my_message_sql; start_signal_handler(); // Creates pidfile if (acl_init((THD *)0, opt_noacl) || my_tz_init((THD *)0, default_tz_name, opt_bootstrap)) --- 1.46/strings/Makefile.am 2005-05-06 00:00:21 -07:00 +++ 1.47/strings/Makefile.am 2005-06-24 13:41:30 -07:00 @@ -22,19 +22,19 @@ # Exact one of ASSEMBLER_X if ASSEMBLER_x86 ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s -CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c +CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c else if ASSEMBLER_sparc32 # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s -CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c +CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c else #no assembler ASRCS = # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile -CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c +CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c endif endif --- 1.13/strings/conf_to_src.c 2003-11-28 02:18:10 -08:00 +++ 1.14/strings/conf_to_src.c 2005-06-24 11:19:54 -07:00 @@ -75,6 +75,8 @@ char *mdup(const char *src, uint len) { char *dst=(char*)malloc(len); + if (!dst) + exit(1); memcpy(dst,src,len); return dst; } --- 1.86/strings/ctype-tis620.c 2005-06-06 04:48:49 -07:00 +++ 1.87/strings/ctype-tis620.c 2005-06-24 13:41:30 -07:00 @@ -541,7 +541,7 @@ tc1= buf; if ((len1 + len2 +2) > (int) sizeof(buf)) - tc1= (uchar*) malloc(len1+len2+2); + tc1= (uchar*) my_str_malloc(len1+len2+2); tc2= tc1 + len1+1; memcpy((char*) tc1, (char*) s1, len1); tc1[len1]= 0; /* if length(s1)> len1, need to put 'end of string' */ @@ -551,7 +551,7 @@ thai2sortable(tc2, len2); i= strcmp((char*)tc1, (char*)tc2); if (tc1 != buf) - free(tc1); + my_str_free(tc1); return i; } @@ -572,7 +572,7 @@ a= buf; if ((a_length + b_length +2) > (int) sizeof(buf)) - alloced= a= (uchar*) malloc(a_length+b_length+2); + alloced= a= (uchar*) my_str_malloc(a_length+b_length+2); b= a + a_length+1; memcpy((char*) a, (char*) a0, a_length); @@ -621,7 +621,7 @@ ret: if (alloced) - free(alloced); + my_str_free(alloced); return res; } --- 1.3/VC++Files/client/mysqlclient_ia64.dsp 2005-06-01 06:03:39 -07:00 +++ 1.4/VC++Files/client/mysqlclient_ia64.dsp 2005-06-24 13:41:29 -07:00 @@ -552,6 +552,10 @@ # End Source File # Begin Source File +SOURCE=..\strings\str_alloc.c +# End Source File +# Begin Source File + SOURCE=..\mysys\thr_mutex.c # End Source File # Begin Source File --- 1.4/VC++Files/libmysql/libmysql_ia64.dsp 2005-06-01 06:03:40 -07:00 +++ 1.5/VC++Files/libmysql/libmysql_ia64.dsp 2005-06-24 13:41:30 -07:00 @@ -526,6 +526,10 @@ # End Source File # Begin Source File +SOURCE=..\strings\str_alloc.c +# End Source File +# Begin Source File + SOURCE=..\mysys\thr_mutex.c # End Source File # Begin Source File --- 1.2/VC++Files/libmysqld/libmysqld_ia64.dsp 2005-03-07 04:03:58 -08:00 +++ 1.3/VC++Files/libmysqld/libmysqld_ia64.dsp 2005-06-24 13:41:30 -07:00 @@ -538,6 +538,10 @@ # End Source File # Begin Source File +SOURCE=..\strings\str_alloc.c +# End Source File +# Begin Source File + SOURCE=..\sql\table.cpp # End Source File # Begin Source File --- 1.4/VC++Files/strings/strings_ia64.dsp 2005-06-01 06:03:40 -07:00 +++ 1.5/VC++Files/strings/strings_ia64.dsp 2005-06-24 13:41:30 -07:00 @@ -272,6 +272,10 @@ # End Source File # Begin Source File +SOURCE=.\str_alloc.c +# End Source File +# Begin Source File + SOURCE=.\xml.c # End Source File # End Target --- New file --- +++ strings/str_alloc.c 05/06/24 13:20:37 /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include static void *my_str_malloc_default(size_t size) { void *ret= malloc(size); if (!ret) exit(1); return ret; } static void my_str_free_default(void *ptr) { free(ptr); } void *(*my_str_malloc)(size_t)= &my_str_malloc_default; void (*my_str_free)(void *)= &my_str_free_default; --- 1.35/VC++Files/client/mysqlclient.dsp 2005-06-20 15:02:41 -07:00 +++ 1.36/VC++Files/client/mysqlclient.dsp 2005-06-24 13:41:29 -07:00 @@ -571,6 +571,10 @@ # End Source File # Begin Source File +SOURCE=..\strings\str_alloc.c +# End Source File +# Begin Source File + SOURCE=..\mysys\thr_mutex.c # End Source File # Begin Source File --- 1.35/VC++Files/libmysql/libmysql.dsp 2005-06-20 15:02:41 -07:00 +++ 1.36/VC++Files/libmysql/libmysql.dsp 2005-06-24 13:41:29 -07:00 @@ -539,6 +539,10 @@ # End Source File # Begin Source File +SOURCE=..\strings\str_alloc.c +# End Source File +# Begin Source File + SOURCE=..\mysys\thr_mutex.c # End Source File # Begin Source File --- 1.3/VC++Files/strings/backup/strings.dsp 2003-03-16 08:08:58 -08:00 +++ 1.4/VC++Files/strings/backup/strings.dsp 2005-06-24 13:41:30 -07:00 @@ -238,7 +238,12 @@ # End Source File # Begin Source File -SOURCE=.\strxnmov.c +SOURCE=.\strxnmov.c +# End Source File +# Begin Source File + +SOURCE=.\str_alloc.c # End Source File + # End Target # End Project --- 1.5/VC++Files/strings/noMASM/strings.dsp 2004-02-27 08:22:27 -08:00 +++ 1.6/VC++Files/strings/noMASM/strings.dsp 2005-06-24 13:41:30 -07:00 @@ -256,6 +256,10 @@ # End Source File # Begin Source File +SOURCE=.\str_alloc.c +# End Source File +# Begin Source File + SOURCE=.\xml.c # End Source File # End Target --- 1.18/VC++Files/strings/strings.dsp 2005-06-01 06:03:40 -07:00 +++ 1.19/VC++Files/strings/strings.dsp 2005-06-24 13:41:30 -07:00 @@ -273,6 +273,10 @@ # End Source File # Begin Source File +SOURCE=.\str_alloc.c +# End Source File +# Begin Source File + SOURCE=.\xml.c # End Source File # End Target --- 1.25/VC++Files/libmysqld/libmysqld.dsp 2005-06-09 07:52:42 -07:00 +++ 1.26/VC++Files/libmysqld/libmysqld.dsp 2005-06-24 13:41:30 -07:00 @@ -600,6 +600,10 @@ # End Source File # Begin Source File +SOURCE=..\strings\str_alloc.c +# End Source File +# Begin Source File + SOURCE=..\sql\table.cpp # End Source File # Begin Source File --- 1.63/libmysql/Makefile.shared 2005-05-18 10:10:09 -07:00 +++ 1.64/libmysql/Makefile.shared 2005-06-24 13:41:30 -07:00 @@ -46,7 +46,7 @@ ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \ ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \ ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \ - ctype-uca.lo xml.lo my_strtoll10.lo + ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo mystringsextra= strto.c dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo