summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-08-02 16:50:09 -0700
committerunknown <jimw@mysql.com>2005-08-02 16:50:09 -0700
commit937f46fb049c15a632319254d5222ea31a0849d2 (patch)
treedf3a47a65858bc803df1e3897de1738ce72265a2 /strings
parent88105618c5eba3714189875a8d799cb7503bd657 (diff)
parentf56dd2a0fa24b154aa71307e12283e43c7ff0914 (diff)
downloadmariadb-git-937f46fb049c15a632319254d5222ea31a0849d2.tar.gz
Merge mysql.com:/home/jimw/my/mysql-5.0-7003
into mysql.com:/home/jimw/my/mysql-5.0-clean VC++Files/client/mysqlclient.dsp: Auto merged VC++Files/client/mysqlclient_ia64.dsp: Auto merged VC++Files/libmysql/libmysql.dsp: Auto merged VC++Files/libmysql/libmysql_ia64.dsp: Auto merged VC++Files/libmysqld/libmysqld.dsp: Auto merged libmysql/Makefile.shared: Auto merged sql/mysqld.cc: Auto merged strings/Makefile.am: Auto merged
Diffstat (limited to 'strings')
-rw-r--r--strings/Makefile.am6
-rw-r--r--strings/conf_to_src.c2
-rw-r--r--strings/ctype-tis620.c8
-rw-r--r--strings/str_alloc.c34
4 files changed, 43 insertions, 7 deletions
diff --git a/strings/Makefile.am b/strings/Makefile.am
index 5e02c7c1a2b..ad652862222 100644
--- a/strings/Makefile.am
+++ b/strings/Makefile.am
@@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a
# 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
diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c
index d5ffa15ee0c..5a6adb398da 100644
--- a/strings/conf_to_src.c
+++ b/strings/conf_to_src.c
@@ -75,6 +75,8 @@ static int get_charset_number(const char *charset_name)
char *mdup(const char *src, uint len)
{
char *dst=(char*)malloc(len);
+ if (!dst)
+ exit(1);
memcpy(dst,src,len);
return dst;
}
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 4fe8bb4e349..e445fa90bd3 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -541,7 +541,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
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 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
thai2sortable(tc2, len2);
i= strcmp((char*)tc1, (char*)tc2);
if (tc1 != buf)
- free(tc1);
+ my_str_free(tc1);
return i;
}
@@ -572,7 +572,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
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 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
ret:
if (alloced)
- free(alloced);
+ my_str_free(alloced);
return res;
}
diff --git a/strings/str_alloc.c b/strings/str_alloc.c
new file mode 100644
index 00000000000..158fa7e75bb
--- /dev/null
+++ b/strings/str_alloc.c
@@ -0,0 +1,34 @@
+/* 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 <my_global.h>
+#include <m_string.h>
+
+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;