Below is the list of changes that have just been committed into a local
5.1 repository of mtaylor. When mtaylor 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@stripped, 2008-04-23 13:04:31-07:00, mtaylor@solace.(none) +44 -0
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
BUILD/autorun.sh@stripped, 2008-04-23 13:04:22-07:00, mtaylor@solace.(none) +1 -1
Turned off warnings about non-gnu make portability, since we don't support non-gnu
make anyway.
BitKeeper/etc/ignore@stripped, 2008-04-23 13:04:22-07:00, mtaylor@solace.(none) +11 -0
Added mysys/tests/test_base64 mysys/tests/test_bitmap mysys/tests/test_gethwaddr
mysys/tests/test_io_cache mysys/tests/test_priority_queue mysys/tests/test_thr_alarm
mysys/tests/test_thr_lock mysys/tests/test_vsnprintf mysys/tests/testhash
mysys/tests/.deps/test_charset.Tpo mysys/tests/.deps/test_dir.Tpo to the ignore list
Makefile.am@stripped, 2008-04-23 13:04:22-07:00, mtaylor@solace.(none) +1 -1
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
client/Makefile.am@stripped, 2008-04-23 13:04:22-07:00, mtaylor@solace.(none) +4 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
config/ac-macros/zlib.m4@stripped, 2008-04-23 13:04:23-07:00, mtaylor@solace.(none) +0 -1
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
configure.in@stripped, 2008-04-23 13:04:22-07:00, mtaylor@solace.(none) +26 -4
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
dbug/Makefile.am@stripped, 2008-04-23 13:04:23-07:00, mtaylor@solace.(none) +4 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
extra/Makefile.am@stripped, 2008-04-23 13:04:23-07:00, mtaylor@solace.(none) +4 -2
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
libmysql/Makefile.am@stripped, 2008-04-23 13:04:23-07:00, mtaylor@solace.(none) +1 -1
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
libmysql_r/Makefile.am@stripped, 2008-04-23 13:04:24-07:00, mtaylor@solace.(none) +1 -1
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
libmysqld/Makefile.am@stripped, 2008-04-23 13:04:24-07:00, mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
mysys/Makefile.am@stripped, 2008-04-23 13:04:24-07:00, mtaylor@solace.(none) +12 -64
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
mysys/my_bitmap.cc@stripped, 2008-04-23 13:03:25-07:00, mtaylor@solace.(none) +0 -0
Rename: mysys/my_bitmap.c -> mysys/my_bitmap.cc
mysys/queues.cc@stripped, 2008-04-23 13:03:22-07:00, mtaylor@solace.(none) +0 -0
Rename: mysys/queues.c -> mysys/queues.cc
mysys/tests/Makefile.am@stripped, 2008-04-23 13:04:28-07:00, mtaylor@solace.(none) +52 -0
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
mysys/tests/Makefile.am@stripped, 2008-04-23 13:04:28-07:00, mtaylor@solace.(none) +0 -0
mysys/tests/test_charset.c@stripped, 2008-04-23 13:03:24-07:00, mtaylor@solace.(none) +0 -0
Rename: mysys/test_charset.c -> mysys/tests/test_charset.c
mysys/tests/test_dir.c@stripped, 2008-04-23 13:03:25-07:00, mtaylor@solace.(none) +0 -0
Rename: mysys/test_dir.c -> mysys/tests/test_dir.c
mysys/tests/testhash.c@stripped, 2008-04-23 13:03:26-07:00, mtaylor@solace.(none) +0 -0
Rename: mysys/testhash.c -> mysys/tests/testhash.c
netware/Makefile.am@stripped, 2008-04-23 13:04:24-07:00, mtaylor@solace.(none) +5 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
regex/Makefile.am@stripped, 2008-04-23 13:04:24-07:00, mtaylor@solace.(none) +1 -1
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
server-tools/instance-manager/Makefile.am@stripped, 2008-04-23 13:04:25-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
sql/Makefile.am@stripped, 2008-04-23 13:04:25-07:00, mtaylor@solace.(none) +4 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/archive/Makefile.am@stripped, 2008-04-23 13:04:25-07:00, mtaylor@solace.(none) +6 -6
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/heap/Makefile.am@stripped, 2008-04-23 13:04:25-07:00, mtaylor@solace.(none) +6 -6
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/myisam/Makefile.am@stripped, 2008-04-23 13:04:25-07:00, mtaylor@solace.(none) +27
-27
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/config/type_ndbapitest.mk.am@stripped, 2008-04-23 13:04:25-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/config/type_ndbapitools.mk.am@stripped, 2008-04-23 13:04:26-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/Makefile.am@stripped, 2008-04-23 13:04:26-07:00, mtaylor@solace.(none) +4 -1
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/common/util/Makefile.am@stripped, 2008-04-23 13:04:26-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/cw/cpcd/Makefile.am@stripped, 2008-04-23 13:04:26-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/kernel/Makefile.am@stripped, 2008-04-23 13:04:26-07:00,
mtaylor@solace.(none) +4 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/kernel/blocks/Makefile.am@stripped, 2008-04-23 13:04:26-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/kernel/blocks/backup/Makefile.am@stripped, 2008-04-23 13:04:26-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/kernel/blocks/dbdict/Makefile.am@stripped, 2008-04-23 13:04:27-07:00,
mtaylor@solace.(none) +6 -6
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/kernel/blocks/dbdih/Makefile.am@stripped, 2008-04-23 13:04:27-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/kernel/blocks/dblqh/Makefile.am@stripped, 2008-04-23 13:04:27-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/kernel/blocks/dbtup/Makefile.am@stripped, 2008-04-23 13:04:27-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/kernel/vm/Makefile.am@stripped, 2008-04-23 13:04:27-07:00,
mtaylor@solace.(none) +9 -9
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/mgmclient/Makefile.am@stripped, 2008-04-23 13:04:27-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/mgmsrv/Makefile.am@stripped, 2008-04-23 13:04:27-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/src/ndbapi/Makefile.am@stripped, 2008-04-23 13:04:27-07:00,
mtaylor@solace.(none) +4 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
storage/ndb/test/run-test/Makefile.am@stripped, 2008-04-23 13:04:28-07:00,
mtaylor@solace.(none) +3 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
strings/Makefile.am@stripped, 2008-04-23 13:04:28-07:00, mtaylor@solace.(none) +9 -9
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
unittest/mysys/Makefile.am@stripped, 2008-04-23 13:04:28-07:00, mtaylor@solace.(none) +4 -3
BUG#29791 relocation R_X86_64_32 against `a local symbol'
Changed libmysys, libmystrings and libdbug from normal libs to noinst libtool
helper libs. The will no longer be installed, and all of the necessary symbols
from them are added directly to libndbclient et al. The upside here is that
NDB API programs now only need to link against -lndbclient.
diff -Nrup a/BUILD/autorun.sh b/BUILD/autorun.sh
--- a/BUILD/autorun.sh 2007-10-29 14:48:18 -07:00
+++ b/BUILD/autorun.sh 2008-04-23 13:04:22 -07:00
@@ -27,5 +27,5 @@ $LIBTOOLIZE --automake --force --copy ||
# --add-missing instructs automake to install missing auxiliary files
# and --force to overwrite them if they already exist
-automake --add-missing --force --copy || die "Can't execute automake"
+automake --add-missing --force --copy --gnu -W no-portability || die "Can't execute
automake"
autoconf || die "Can't execute autoconf"
diff -Nrup a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore
--- a/BitKeeper/etc/ignore 2008-04-08 01:28:54 -07:00
+++ b/BitKeeper/etc/ignore 2008-04-23 13:04:22 -07:00
@@ -3022,3 +3022,14 @@ win/vs8cache.txt
ylwrap
zlib/*.ds?
zlib/*.vcproj
+mysys/tests/test_base64
+mysys/tests/test_bitmap
+mysys/tests/test_gethwaddr
+mysys/tests/test_io_cache
+mysys/tests/test_priority_queue
+mysys/tests/test_thr_alarm
+mysys/tests/test_thr_lock
+mysys/tests/test_vsnprintf
+mysys/tests/testhash
+mysys/tests/.deps/test_charset.Tpo
+mysys/tests/.deps/test_dir.Tpo
diff -Nrup a/Makefile.am b/Makefile.am
--- a/Makefile.am 2008-04-08 02:41:57 -07:00
+++ b/Makefile.am 2008-04-23 13:04:22 -07:00
@@ -33,7 +33,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_d
DIST_SUBDIRS = . include Docs zlib \
cmd-line-utils sql-common scripts \
pstack \
- strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \
+ strings mysys dbug mysys/tests extra regex libmysql libmysql_r client unittest storage
plugin \
vio sql man tests \
netware libmysqld \
mysql-test support-files sql-bench server-tools \
diff -Nrup a/client/Makefile.am b/client/Makefile.am
--- a/client/Makefile.am 2007-11-01 08:49:37 -07:00
+++ b/client/Makefile.am 2008-04-23 13:04:22 -07:00
@@ -54,6 +54,7 @@ bin_PROGRAMS = mysql \
mysql_SOURCES = mysql.cc readline.cc sql_string.cc \
completion_hash.cc
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ \
+ @ZLIB_LIBS@ \
$(LDADD) $(CXXLDFLAGS)
mysqladmin_SOURCES = mysqladmin.cc
@@ -61,7 +62,7 @@ mysqlbinlog_SOURCES = mysqlbinlog.cc \
$(top_srcdir)/mysys/mf_tempdir.c \
$(top_srcdir)/mysys/my_new.cc \
$(top_srcdir)/mysys/my_bit.c \
- $(top_srcdir)/mysys/my_bitmap.c \
+ $(top_srcdir)/mysys/my_bitmap.cc \
$(top_srcdir)/mysys/my_vle.c \
$(top_srcdir)/mysys/base64.c
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
@@ -75,7 +76,7 @@ mysqlimport_SOURCES= mysqlimport.c
mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \
- $(top_builddir)/mysys/libmysys.a
+ $(top_builddir)/mysys/libmysys.la
mysqlshow_SOURCES= mysqlshow.c
@@ -84,7 +85,7 @@ mysqlslap_CFLAGS= -DTHREAD -UUNDEF_THRE
mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \
- $(top_builddir)/mysys/libmysys.a
+ $(top_builddir)/mysys/libmysys.la
mysqltest_SOURCES= mysqltest.c \
$(top_srcdir)/mysys/my_getsystime.c \
diff -Nrup a/config/ac-macros/zlib.m4 b/config/ac-macros/zlib.m4
--- a/config/ac-macros/zlib.m4 2007-08-30 16:18:56 -07:00
+++ b/config/ac-macros/zlib.m4 2008-04-23 13:04:23 -07:00
@@ -19,7 +19,6 @@ AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS"
-LIBS="$LIBS $ZLIB_LIBS"
if test X"$with_server" = Xno
then
zlibsym=zlibVersion
diff -Nrup a/configure.in b/configure.in
--- a/configure.in 2008-04-08 01:29:04 -07:00
+++ b/configure.in 2008-04-23 13:04:22 -07:00
@@ -23,7 +23,7 @@ DOT_FRM_VERSION=6
# See the libtool docs for information on how to do shared lib versions.
SHARED_LIB_MAJOR_VERSION=16
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
-NDB_SHARED_LIB_MAJOR_VERSION=3
+NDB_SHARED_LIB_MAJOR_VERSION=4
NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# Set all version vars based on $VERSION. How do we do this more elegant ?
@@ -356,6 +356,7 @@ case "$target_os" in
fi
;;
esac
+
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(CXX)
@@ -838,20 +839,37 @@ AC_CHECK_HEADERS([xfs/xfs.h])
# and defines HAVE_LIBM etc
#--------------------------------------------------------------------
+dnl Save the current libs into _libs so we can use AC_CHECK_LIB but
+dnl not have -lm go into the global libs list, since we don't need
+dnl it for everything we build and will use M_LIBS instead
+_libs=${LIBS}
+LIBS=''
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
+M_LIBS=${LIBS}
+LIBS=${_libs}
+dnl Save the current libs into _libs so we can put this into NSL_LIBS
+_libs=${LIBS}
+LIBS=''
AC_CHECK_LIB(nsl_r, gethostbyname_r, [],
AC_CHECK_LIB(nsl, gethostbyname_r))
AC_CHECK_FUNC(gethostbyname_r)
-
-AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_FUNC(yp_get_default_domain, ,
AC_CHECK_LIB(nsl, yp_get_default_domain))
+NSL_LIBS=${LIBS}
+LIBS=${_libs}
+
+AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open))
# This may get things to compile even if bind-8 is installed
AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
+dnl Save the current libs into _libs so we can put this into CRYPT_LIBS
+_libs=${LIBS}
+LIBS=''
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
+CRYPT_LIBS=${LIBS}
+LIBS=${_libs}
# See if we need a library for address lookup.
AC_SEARCH_LIBS(inet_aton, [socket nsl resolv])
@@ -1696,6 +1714,7 @@ else
CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
fi
+AM_CONDITIONAL(BUILD_DEBUG, test "$with_debug" = "full" -o "$with_debug" = "yes")
# If we should allow error injection tests
AC_ARG_WITH(error-inject,
@@ -2678,6 +2697,9 @@ sql_client_dirs="$sql_client_dirs client
CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
+AC_SUBST(M_LIBS)
+AC_SUBST(CRYPT_LIBS)
+AC_SUBST(NSL_LIBS)
AC_SUBST(CLIENT_LIBS)
AC_SUBST(CLIENT_THREAD_LIBS)
AC_SUBST(NON_THREADED_LIBS)
@@ -2759,7 +2781,7 @@ if test -d "$srcdir/cmd-line-utils/readl
AC_CONFIG_FILES(cmd-line-utils/readline/Makefile)
fi
-AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
+AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile mysys/tests/Makefile dnl
unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
unittest/mysys/Makefile unittest/examples/Makefile dnl
strings/Makefile regex/Makefile storage/Makefile dnl
diff -Nrup a/dbug/Makefile.am b/dbug/Makefile.am
--- a/dbug/Makefile.am 2006-12-30 16:06:32 -08:00
+++ b/dbug/Makefile.am 2008-04-23 13:04:23 -07:00
@@ -16,10 +16,11 @@
# MA 02111-1307, USA
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
-LDADD = libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a
-pkglib_LIBRARIES = libdbug.a
+LDADD = libdbug.la $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la ${ZLIB_LIBS}
+noinst_LTLIBRARIES = libdbug.la
noinst_HEADERS = dbug_long.h
-libdbug_a_SOURCES = dbug.c sanity.c
+libdbug_la_SOURCES = dbug.c sanity.c
EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \
user.r monty.doc dbug_add_tags.pl \
my_main.c main.c factorial.c dbug_analyze.c \
diff -Nrup a/extra/Makefile.am b/extra/Makefile.am
--- a/extra/Makefile.am 2007-08-30 16:23:48 -07:00
+++ b/extra/Makefile.am 2008-04-23 13:04:23 -07:00
@@ -15,8 +15,10 @@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_srcdir)/sql
-LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
- ../dbug/libdbug.a ../strings/libmystrings.a \
+LDADD = @CLIENT_EXTRA_LDFLAGS@ \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la \
$(ZLIB_LIBS)
BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \
$(top_builddir)/include/sql_state.h \
diff -Nrup a/libmysql/Makefile.am b/libmysql/Makefile.am
--- a/libmysql/Makefile.am 2007-11-22 03:34:11 -08:00
+++ b/libmysql/Makefile.am 2008-04-23 13:04:23 -07:00
@@ -22,7 +22,7 @@
target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
-LIBS = @CLIENT_LIBS@
+LIBS = @CLIENT_LIBS@ @M_LIBS@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) @ZLIB_INCLUDES@
diff -Nrup a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am
--- a/libmysql_r/Makefile.am 2007-10-08 11:55:22 -07:00
+++ b/libmysql_r/Makefile.am 2008-04-23 13:04:24 -07:00
@@ -22,7 +22,7 @@
target = libmysqlclient_r.la
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
-LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
+LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ @M_LIBS@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) @ZLIB_INCLUDES@
diff -Nrup a/libmysqld/Makefile.am b/libmysqld/Makefile.am
--- a/libmysqld/Makefile.am 2008-04-08 01:29:04 -07:00
+++ b/libmysqld/Makefile.am 2008-04-23 13:04:24 -07:00
@@ -95,9 +95,9 @@ sql_yacc.cc sql_yacc.h: $(top_srcdir)/sq
# The following libraries should be included in libmysqld.a
INC_LIB= $(top_builddir)/regex/libregex.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a \
- $(top_builddir)/dbug/libdbug.a \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la \
+ $(top_builddir)/dbug/libdbug.la \
$(top_builddir)/vio/libvio.a \
@NDB_SCI_LIBS@ \
@mysql_plugin_libs@ \
diff -Nrup a/mysys/Makefile.am b/mysys/Makefile.am
--- a/mysys/Makefile.am 2008-03-28 12:08:26 -07:00
+++ b/mysys/Makefile.am 2008-04-23 13:04:24 -07:00
@@ -18,10 +18,10 @@ MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
INCLUDES = @ZLIB_INCLUDES@ -I$(top_builddir)/include \
-I$(top_srcdir)/include -I$(srcdir)
-pkglib_LIBRARIES = libmysys.a
-LDADD = libmysys.a $(top_builddir)/strings/libmystrings.a
$(top_builddir)/dbug/libdbug.a
+noinst_LTLIBRARIES = libmysys.la
+LDADD = libmysys.la $(top_builddir)/strings/libmystrings.la
$(top_builddir)/dbug/libdbug.la @M_LIBS@
noinst_HEADERS = mysys_priv.h my_static.h my_handler_errors.h
-libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
+libmysys_la_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
mf_path.c mf_loadpath.c my_file.c \
my_open.c my_create.c my_dup.c my_seek.c my_read.c \
my_pread.c my_write.c my_getpagesize.c \
@@ -38,7 +38,7 @@ libmysys_a_SOURCES = my_init.c my_get
mf_pack.c mf_unixpath.c mf_strip.c mf_arr_appstr.c \
mf_wcomp.c mf_wfile.c my_gethwaddr.c \
mf_qsort.c mf_qsort2.c mf_sort.c \
- ptr_cmp.c mf_radix.c queues.c my_getncpus.c \
+ ptr_cmp.c mf_radix.c queues.cc my_getncpus.c \
tree.c trie.c list.c hash.c array.c string.c typelib.c \
my_copy.c my_append.c my_lib.c \
my_delete.c my_rename.c my_redel.c \
@@ -48,20 +48,18 @@ libmysys_a_SOURCES = my_init.c my_get
default_modify.c default.c \
my_compress.c checksum.c \
my_net.c my_port.c my_sleep.c \
- charset.c charset-def.c my_bitmap.c my_bit.c md5.c \
+ charset.c charset-def.c my_bitmap.cc my_bit.c md5.c \
my_gethostbyname.c rijndael.c my_aes.c sha1.c \
my_handler.c my_netware.c my_largepage.c \
my_memmem.c \
- my_windac.c my_access.c base64.c my_libwrap.c
-EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
+ my_windac.c my_access.c base64.c my_libwrap.c \
+ thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c \
- CMakeLists.txt mf_soundex.c \
+ mf_soundex.c \
my_conio.c my_wincond.c my_winthread.c
-libmysys_a_LIBADD = @THREAD_LOBJECTS@
-# test_dir_DEPENDENCIES= $(LIBRARIES)
-# testhash_DEPENDENCIES= $(LIBRARIES)
-# test_charset_DEPENDENCIES= $(LIBRARIES)
-# charset2html_DEPENDENCIES= $(LIBRARIES)
+EXTRA_DIST = CMakeLists.txt
+libmysys_la_LIBADD = @ZLIB_LIB@
+
DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
@@ -71,60 +69,10 @@ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\"
-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
@DEFS@
-libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
+libmysys_la_DEPENDENCIES= @THREAD_LOBJECTS@
# I hope this always does the right thing. Otherwise this is only test programs
FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
-
-#
-# The CP .. RM stuff is to avoid problems with some compilers (like alpha ccc)
-# which automaticly removes the object files you use to compile a final program
-#
-
-test_bitmap$(EXEEXT): my_bitmap.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN ./my_bitmap.c $(LDADD) $(LIBS)
-
-test_priority_queue$(EXEEXT): queues.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN ./queues.c $(LDADD) $(LIBS)
-
-test_thr_alarm$(EXEEXT): thr_alarm.c $(LIBRARIES)
- $(CP) $(srcdir)/thr_alarm.c ./test_thr_alarm.c
- $(LINK) $(FLAGS) -DMAIN ./test_thr_alarm.c $(LDADD) $(LIBS)
- $(RM) -f ./test_thr_alarm.c
-
-test_thr_lock$(EXEEXT): thr_lock.c $(LIBRARIES)
- $(CP) $(srcdir)/thr_lock.c test_thr_lock.c
- $(LINK) $(FLAGS) -DMAIN ./test_thr_lock.c $(LDADD) $(LIBS)
- $(RM) -f ./test_thr_lock.c
-
-test_vsnprintf$(EXEEXT): my_vsnprintf.c $(LIBRARIES)
- $(CP) $(srcdir)/my_vsnprintf.c test_vsnprintf.c
- $(LINK) $(FLAGS) -DMAIN ./test_vsnprintf.c $(LDADD) $(LIBS)
- $(RM) -f test_vsnprintf.c
-
-test_io_cache$(EXEEXT): mf_iocache.c $(LIBRARIES)
- $(CP) $(srcdir)/mf_iocache.c test_io_cache.c
- $(LINK) $(FLAGS) -DMAIN ./test_io_cache.c $(LDADD) $(LIBS)
- $(RM) -f test_io_cache.c
-
-test_dir$(EXEEXT): test_dir.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS)
-
-test_charset$(EXEEXT): test_charset.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS)
-
-testhash$(EXEEXT): testhash.c $(LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN $(srcdir)/testhash.c $(LDADD) $(LIBS)
-
-test_gethwaddr$(EXEEXT): my_gethwaddr.c $(LIBRARIES)
- $(CP) $(srcdir)/my_gethwaddr.c ./test_gethwaddr.c
- $(LINK) $(FLAGS) -DMAIN ./test_gethwaddr.c $(LDADD) $(LIBS)
- $(RM) -f ./test_gethwaddr.c
-
-test_base64$(EXEEXT): base64.c $(LIBRARIES)
- $(CP) $(srcdir)/base64.c ./test_base64.c
- $(LINK) $(FLAGS) -DMAIN ./test_base64.c $(LDADD) $(LIBS)
- $(RM) -f ./test_base64.c
# Don't update the files from bitkeeper
%::SCCS/s.%
diff -Nrup a/mysys/my_bitmap.c b/mysys/my_bitmap.c
--- a/mysys/my_bitmap.c 2007-10-11 08:07:33 -07:00
+++ /dev/null Wed Dec 31 16:00:00 196900
@@ -1,1130 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-/*
- Handling of uchar arrays as large bitmaps.
-
- API limitations (or, rather asserted safety assumptions,
- to encourage correct programming)
-
- * the internal size is a set of 32 bit words
- * the number of bits specified in creation can be any number > 0
- * there are THREAD safe versions of most calls called bitmap_lock_*
- many of those are not used and not compiled normally but the code
- already exist for them in an #ifdef:ed part. These can only be used
- if THREAD was specified in bitmap_init
-
- TODO:
- Make assembler THREAD safe versions of these using test-and-set instructions
-
- Original version created by Sergei Golubchik 2001 - 2004.
- New version written and test program added and some changes to the interface
- was made by Mikael Ronström 2005, with assistance of Tomas Ulin and Mats
- Kindahl.
-*/
-
-#include "mysys_priv.h"
-#include <my_bitmap.h>
-#include <m_string.h>
-#include <my_bit.h>
-
-void create_last_word_mask(MY_BITMAP *map)
-{
- /* Get the number of used bits (1..8) in the last byte */
- unsigned int const used= 1U + ((map->n_bits-1U) & 0x7U);
-
- /*
- Create a mask with the upper 'unused' bits set and the lower 'used'
- bits clear. The bits within each byte is stored in big-endian order.
- */
- unsigned char const mask= (~((1 << used) - 1)) & 255;
-
- /*
- The first bytes are to be set to zero since they represent real bits
- in the bitvector. The last bytes are set to 0xFF since they represent
- bytes not used by the bitvector. Finally the last byte contains bits
- as set by the mask above.
- */
- unsigned char *ptr= (unsigned char*)&map->last_word_mask;
-
- map->last_word_ptr= map->bitmap + no_words_in_map(map)-1;
- switch (no_bytes_in_map(map) & 3) {
- case 1:
- map->last_word_mask= ~0U;
- ptr[0]= mask;
- return;
- case 2:
- map->last_word_mask= ~0U;
- ptr[0]= 0;
- ptr[1]= mask;
- return;
- case 3:
- map->last_word_mask= 0U;
- ptr[2]= mask;
- ptr[3]= 0xFFU;
- return;
- case 0:
- map->last_word_mask= 0U;
- ptr[3]= mask;
- return;
- }
-}
-
-
-static inline void bitmap_lock(MY_BITMAP *map __attribute__((unused)))
-{
-#ifdef THREAD
- if (map->mutex)
- pthread_mutex_lock(map->mutex);
-#endif
-}
-
-static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused)))
-{
-#ifdef THREAD
- if (map->mutex)
- pthread_mutex_unlock(map->mutex);
-#endif
-}
-
-
-my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
- my_bool thread_safe __attribute__((unused)))
-{
- DBUG_ENTER("bitmap_init");
- if (!buf)
- {
- uint size_in_bytes= bitmap_buffer_size(n_bits);
- uint extra= 0;
-#ifdef THREAD
- if (thread_safe)
- {
- size_in_bytes= ALIGN_SIZE(size_in_bytes);
- extra= sizeof(pthread_mutex_t);
- }
- map->mutex= 0;
-#endif
- if (!(buf= (my_bitmap_map*) my_malloc(size_in_bytes+extra, MYF(MY_WME))))
- DBUG_RETURN(1);
-#ifdef THREAD
- if (thread_safe)
- {
- map->mutex= (pthread_mutex_t *) ((char*) buf + size_in_bytes);
- pthread_mutex_init(map->mutex, MY_MUTEX_INIT_FAST);
- }
-#endif
- }
-#ifdef THREAD
- else
- {
- DBUG_ASSERT(thread_safe == 0);
- }
-#endif
-
- map->bitmap= buf;
- map->n_bits= n_bits;
- create_last_word_mask(map);
- bitmap_clear_all(map);
- DBUG_RETURN(0);
-}
-
-
-void bitmap_free(MY_BITMAP *map)
-{
- DBUG_ENTER("bitmap_free");
- if (map->bitmap)
- {
-#ifdef THREAD
- if (map->mutex)
- pthread_mutex_destroy(map->mutex);
-#endif
- my_free((char*) map->bitmap, MYF(0));
- map->bitmap=0;
- }
- DBUG_VOID_RETURN;
-}
-
-
-/*
- test if bit already set and set it if it was not (thread unsafe method)
-
- SYNOPSIS
- bitmap_fast_test_and_set()
- MAP bit map struct
- BIT bit number
-
- RETURN
- 0 bit was not set
- !=0 bit was set
-*/
-
-my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit)
-{
- uchar *value= ((uchar*) map->bitmap) + (bitmap_bit / 8);
- uchar bit= 1 << ((bitmap_bit) & 7);
- uchar res= (*value) & bit;
- *value|= bit;
- return res;
-}
-
-
-/*
- test if bit already set and set it if it was not (thread safe method)
-
- SYNOPSIS
- bitmap_fast_test_and_set()
- map bit map struct
- bitmap_bit bit number
-
- RETURN
- 0 bit was not set
- !=0 bit was set
-*/
-
-my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit)
-{
- my_bool res;
- DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
- bitmap_lock(map);
- res= bitmap_fast_test_and_set(map, bitmap_bit);
- bitmap_unlock(map);
- return res;
-}
-
-/*
- test if bit already set and clear it if it was set(thread unsafe method)
-
- SYNOPSIS
- bitmap_fast_test_and_set()
- MAP bit map struct
- BIT bit number
-
- RETURN
- 0 bit was not set
- !=0 bit was set
-*/
-
-my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
-{
- uchar *byte= (uchar*) map->bitmap + (bitmap_bit / 8);
- uchar bit= 1 << ((bitmap_bit) & 7);
- uchar res= (*byte) & bit;
- *byte&= ~bit;
- return res;
-}
-
-
-my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
-{
- my_bool res;
- DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
- bitmap_lock(map);
- res= bitmap_fast_test_and_clear(map, bitmap_bit);
- bitmap_unlock(map);
- return res;
-}
-
-
-uint bitmap_set_next(MY_BITMAP *map)
-{
- uint bit_found;
- DBUG_ASSERT(map->bitmap);
- if ((bit_found= bitmap_get_first(map)) != MY_BIT_NONE)
- bitmap_set_bit(map, bit_found);
- return bit_found;
-}
-
-
-void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size)
-{
- uint prefix_bytes, prefix_bits, d;
- uchar *m= (uchar *)map->bitmap;
-
- DBUG_ASSERT(map->bitmap &&
- (prefix_size <= map->n_bits || prefix_size == (uint) ~0));
- set_if_smaller(prefix_size, map->n_bits);
- if ((prefix_bytes= prefix_size / 8))
- memset(m, 0xff, prefix_bytes);
- m+= prefix_bytes;
- if ((prefix_bits= prefix_size & 7))
- *m++= (1 << prefix_bits)-1;
- if ((d= no_bytes_in_map(map)-prefix_bytes))
- bzero(m, d);
-}
-
-
-my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
-{
- uint prefix_bits= prefix_size & 0x7, res;
- uchar *m= (uchar*)map->bitmap;
- uchar *end_prefix= m+prefix_size/8;
- uchar *end;
- DBUG_ASSERT(m && prefix_size <= map->n_bits);
- end= m+no_bytes_in_map(map);
-
- while (m < end_prefix)
- if (*m++ != 0xff)
- return 0;
-
- *map->last_word_ptr&= ~map->last_word_mask; /*Clear bits*/
- res= 0;
- if (prefix_bits && *m++ != (1 << prefix_bits)-1)
- goto ret;
-
- while (m < end)
- if (*m++ != 0)
- goto ret;
- res= 1;
-ret:
- return res;
-}
-
-
-my_bool bitmap_is_set_all(const MY_BITMAP *map)
-{
- my_bitmap_map *data_ptr= map->bitmap;
- my_bitmap_map *end= map->last_word_ptr;
- *map->last_word_ptr |= map->last_word_mask;
- for (; data_ptr <= end; data_ptr++)
- if (*data_ptr != 0xFFFFFFFF)
- return FALSE;
- return TRUE;
-}
-
-
-my_bool bitmap_is_clear_all(const MY_BITMAP *map)
-{
- my_bitmap_map *data_ptr= map->bitmap;
- my_bitmap_map *end;
- if (*map->last_word_ptr & ~map->last_word_mask)
- return FALSE;
- end= map->last_word_ptr;
- for (; data_ptr < end; data_ptr++)
- if (*data_ptr)
- return FALSE;
- return TRUE;
-}
-
-/* Return TRUE if map1 is a subset of map2 */
-
-my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
-{
- my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
-
- DBUG_ASSERT(map1->bitmap && map2->bitmap &&
- map1->n_bits==map2->n_bits);
-
- end= map1->last_word_ptr;
- *map1->last_word_ptr &= ~map1->last_word_mask;
- *map2->last_word_ptr &= ~map2->last_word_mask;
- while (m1 <= end)
- {
- if ((*m1++) & ~(*m2++))
- return 0;
- }
- return 1;
-}
-
-/* True if bitmaps has any common bits */
-
-my_bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2)
-{
- my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
-
- DBUG_ASSERT(map1->bitmap && map2->bitmap &&
- map1->n_bits==map2->n_bits);
-
- end= map1->last_word_ptr;
- *map1->last_word_ptr &= ~map1->last_word_mask;
- *map2->last_word_ptr &= ~map2->last_word_mask;
- while (m1 <= end)
- {
- if ((*m1++) & (*m2++))
- return 1;
- }
- return 0;
-}
-
-
-void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
-{
- my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
- uint len= no_words_in_map(map), len2 = no_words_in_map(map2);
-
- DBUG_ASSERT(map->bitmap && map2->bitmap);
-
- end= to+min(len,len2);
- *map2->last_word_ptr&= ~map2->last_word_mask; /*Clear last bits in map2*/
- while (to < end)
- *to++ &= *from++;
-
- if (len2 < len)
- {
- end+=len-len2;
- while (to < end)
- *to++=0;
- }
-}
-
-
-/*
- Set/clear all bits above a bit.
-
- SYNOPSIS
- bitmap_set_above()
- map RETURN The bitmap to change.
- from_byte The bitmap buffer byte offset to start with.
- use_bit The bit value (1/0) to use for all upper bits.
-
- NOTE
- You can only set/clear full bytes.
- The function is meant for the situation that you copy a smaller bitmap
- to a bigger bitmap. Bitmap lengths are always multiple of eigth (the
- size of a byte). Using 'from_byte' saves multiplication and division
- by eight during parameter passing.
-
- RETURN
- void
-*/
-
-void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit)
-{
- uchar use_byte= use_bit ? 0xff : 0;
- uchar *to= (uchar *)map->bitmap + from_byte;
- uchar *end= (uchar *)map->bitmap + (map->n_bits+7)/8;
-
- while (to < end)
- *to++= use_byte;
-}
-
-
-void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
-{
- my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
- DBUG_ASSERT(map->bitmap && map2->bitmap &&
- map->n_bits==map2->n_bits);
-
- end= map->last_word_ptr;
-
- while (to <= end)
- *to++ &= ~(*from++);
-}
-
-
-void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
-{
- my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
-
- DBUG_ASSERT(map->bitmap && map2->bitmap &&
- map->n_bits==map2->n_bits);
- end= map->last_word_ptr;
-
- while (to <= end)
- *to++ |= *from++;
-}
-
-
-void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2)
-{
- my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end= map->last_word_ptr;
- DBUG_ASSERT(map->bitmap && map2->bitmap &&
- map->n_bits==map2->n_bits);
- while (to <= end)
- *to++ ^= *from++;
-}
-
-
-void bitmap_invert(MY_BITMAP *map)
-{
- my_bitmap_map *to= map->bitmap, *end;
-
- DBUG_ASSERT(map->bitmap);
- end= map->last_word_ptr;
-
- while (to <= end)
- *to++ ^= 0xFFFFFFFF;
-}
-
-
-uint bitmap_bits_set(const MY_BITMAP *map)
-{
- uchar *m= (uchar*)map->bitmap;
- uchar *end= m + no_bytes_in_map(map);
- uint res= 0;
-
- DBUG_ASSERT(map->bitmap);
- *map->last_word_ptr&= ~map->last_word_mask; /*Reset last bits to zero*/
- while (m < end)
- res+= my_count_bits_ushort(*m++);
- return res;
-}
-
-
-void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2)
-{
- my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
-
- DBUG_ASSERT(map->bitmap && map2->bitmap &&
- map->n_bits==map2->n_bits);
- end= map->last_word_ptr;
- while (to <= end)
- *to++ = *from++;
-}
-
-
-uint bitmap_get_first_set(const MY_BITMAP *map)
-{
- uchar *byte_ptr;
- uint i,j,k;
- my_bitmap_map *data_ptr, *end= map->last_word_ptr;
-
- DBUG_ASSERT(map->bitmap);
- data_ptr= map->bitmap;
- *map->last_word_ptr &= ~map->last_word_mask;
-
- for (i=0; data_ptr <= end; data_ptr++, i++)
- {
- if (*data_ptr)
- {
- byte_ptr= (uchar*)data_ptr;
- for (j=0; ; j++, byte_ptr++)
- {
- if (*byte_ptr)
- {
- for (k=0; ; k++)
- {
- if (*byte_ptr & (1 << k))
- return (i*32) + (j*8) + k;
- }
- DBUG_ASSERT(0);
- }
- }
- DBUG_ASSERT(0);
- }
- }
- return MY_BIT_NONE;
-}
-
-
-uint bitmap_get_first(const MY_BITMAP *map)
-{
- uchar *byte_ptr;
- uint i,j,k;
- my_bitmap_map *data_ptr, *end= map->last_word_ptr;
-
- DBUG_ASSERT(map->bitmap);
- data_ptr= map->bitmap;
- *map->last_word_ptr|= map->last_word_mask;
-
- for (i=0; data_ptr <= end; data_ptr++, i++)
- {
- if (*data_ptr != 0xFFFFFFFF)
- {
- byte_ptr= (uchar*)data_ptr;
- for (j=0; ; j++, byte_ptr++)
- {
- if (*byte_ptr != 0xFF)
- {
- for (k=0; ; k++)
- {
- if (!(*byte_ptr & (1 << k)))
- return (i*32) + (j*8) + k;
- }
- DBUG_ASSERT(0);
- }
- }
- DBUG_ASSERT(0);
- }
- }
- return MY_BIT_NONE;
-}
-
-
-uint bitmap_lock_set_next(MY_BITMAP *map)
-{
- uint bit_found;
- bitmap_lock(map);
- bit_found= bitmap_set_next(map);
- bitmap_unlock(map);
- return bit_found;
-}
-
-
-void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit)
-{
- bitmap_lock(map);
- DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
- bitmap_clear_bit(map, bitmap_bit);
- bitmap_unlock(map);
-}
-
-
-#ifdef NOT_USED
-my_bool bitmap_lock_is_prefix(const MY_BITMAP *map, uint prefix_size)
-{
- my_bool res;
- bitmap_lock((MY_BITMAP *)map);
- res= bitmap_is_prefix(map, prefix_size);
- bitmap_unlock((MY_BITMAP *)map);
- return res;
-}
-
-
-void bitmap_lock_set_all(MY_BITMAP *map)
-{
- bitmap_lock(map);
- bitmap_set_all(map);
- bitmap_unlock(map);
-}
-
-
-void bitmap_lock_clear_all(MY_BITMAP *map)
-{
- bitmap_lock(map);
- bitmap_clear_all(map);
- bitmap_unlock(map);
-}
-
-
-void bitmap_lock_set_prefix(MY_BITMAP *map, uint prefix_size)
-{
- bitmap_lock(map);
- bitmap_set_prefix(map, prefix_size);
- bitmap_unlock(map);
-}
-
-
-my_bool bitmap_lock_is_clear_all(const MY_BITMAP *map)
-{
- uint res;
- bitmap_lock((MY_BITMAP *)map);
- res= bitmap_is_clear_all(map);
- bitmap_unlock((MY_BITMAP *)map);
- return res;
-}
-
-
-my_bool bitmap_lock_is_set_all(const MY_BITMAP *map)
-{
- uint res;
- bitmap_lock((MY_BITMAP *)map);
- res= bitmap_is_set_all(map);
- bitmap_unlock((MY_BITMAP *)map);
- return res;
-}
-
-
-my_bool bitmap_lock_is_set(const MY_BITMAP *map, uint bitmap_bit)
-{
- my_bool res;
- DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
- bitmap_lock((MY_BITMAP *)map);
- res= bitmap_is_set(map, bitmap_bit);
- bitmap_unlock((MY_BITMAP *)map);
- return res;
-}
-
-
-my_bool bitmap_lock_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
-{
- uint res;
- bitmap_lock((MY_BITMAP *)map1);
- bitmap_lock((MY_BITMAP *)map2);
- res= bitmap_is_subset(map1, map2);
- bitmap_unlock((MY_BITMAP *)map2);
- bitmap_unlock((MY_BITMAP *)map1);
- return res;
-}
-
-
-my_bool bitmap_lock_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
-{
- uint res;
-
- DBUG_ASSERT(map1->bitmap && map2->bitmap &&
- map1->n_bits==map2->n_bits);
- bitmap_lock((MY_BITMAP *)map1);
- bitmap_lock((MY_BITMAP *)map2);
- res= bitmap_cmp(map1, map2);
- bitmap_unlock((MY_BITMAP *)map2);
- bitmap_unlock((MY_BITMAP *)map1);
- return res;
-}
-
-
-void bitmap_lock_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
-{
- bitmap_lock(map);
- bitmap_lock((MY_BITMAP *)map2);
- bitmap_intersect(map, map2);
- bitmap_unlock((MY_BITMAP *)map2);
- bitmap_unlock(map);
-}
-
-
-void bitmap_lock_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
-{
- bitmap_lock(map);
- bitmap_lock((MY_BITMAP *)map2);
- bitmap_subtract(map, map2);
- bitmap_unlock((MY_BITMAP *)map2);
- bitmap_unlock(map);
-}
-
-
-void bitmap_lock_union(MY_BITMAP *map, const MY_BITMAP *map2)
-{
- bitmap_lock(map);
- bitmap_lock((MY_BITMAP *)map2);
- bitmap_union(map, map2);
- bitmap_unlock((MY_BITMAP *)map2);
- bitmap_unlock(map);
-}
-
-
-/*
- SYNOPSIS
- bitmap_bits_set()
- map
- RETURN
- Number of set bits in the bitmap.
-*/
-uint bitmap_lock_bits_set(const MY_BITMAP *map)
-{
- uint res;
- bitmap_lock((MY_BITMAP *)map);
- DBUG_ASSERT(map->bitmap);
- res= bitmap_bits_set(map);
- bitmap_unlock((MY_BITMAP *)map);
- return res;
-}
-
-
-/*
- SYNOPSIS
- bitmap_get_first()
- map
- RETURN
- Number of first unset bit in the bitmap or MY_BIT_NONE if all bits are set.
-*/
-uint bitmap_lock_get_first(const MY_BITMAP *map)
-{
- uint res;
- bitmap_lock((MY_BITMAP*)map);
- res= bitmap_get_first(map);
- bitmap_unlock((MY_BITMAP*)map);
- return res;
-}
-
-
-uint bitmap_lock_get_first_set(const MY_BITMAP *map)
-{
- uint res;
- bitmap_lock((MY_BITMAP*)map);
- res= bitmap_get_first_set(map);
- bitmap_unlock((MY_BITMAP*)map);
- return res;
-}
-
-
-void bitmap_lock_set_bit(MY_BITMAP *map, uint bitmap_bit)
-{
- DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
- bitmap_lock(map);
- bitmap_set_bit(map, bitmap_bit);
- bitmap_unlock(map);
-}
-
-
-void bitmap_lock_flip_bit(MY_BITMAP *map, uint bitmap_bit)
-{
- DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
- bitmap_lock(map);
- bitmap_flip_bit(map, bitmap_bit);
- bitmap_unlock(map);
-}
-#endif
-#ifdef MAIN
-
-uint get_rand_bit(uint bitsize)
-{
- return (rand() % bitsize);
-}
-
-bool test_set_get_clear_bit(MY_BITMAP *map, uint bitsize)
-{
- uint i, test_bit;
- uint no_loops= bitsize > 128 ? 128 : bitsize;
- for (i=0; i < no_loops; i++)
- {
- test_bit= get_rand_bit(bitsize);
- bitmap_set_bit(map, test_bit);
- if (!bitmap_is_set(map, test_bit))
- goto error1;
- bitmap_clear_bit(map, test_bit);
- if (bitmap_is_set(map, test_bit))
- goto error2;
- }
- return FALSE;
-error1:
- printf("Error in set bit, bit %u, bitsize = %u", test_bit, bitsize);
- return TRUE;
-error2:
- printf("Error in clear bit, bit %u, bitsize = %u", test_bit, bitsize);
- return TRUE;
-}
-
-bool test_flip_bit(MY_BITMAP *map, uint bitsize)
-{
- uint i, test_bit;
- uint no_loops= bitsize > 128 ? 128 : bitsize;
- for (i=0; i < no_loops; i++)
- {
- test_bit= get_rand_bit(bitsize);
- bitmap_flip_bit(map, test_bit);
- if (!bitmap_is_set(map, test_bit))
- goto error1;
- bitmap_flip_bit(map, test_bit);
- if (bitmap_is_set(map, test_bit))
- goto error2;
- }
- return FALSE;
-error1:
- printf("Error in flip bit 1, bit %u, bitsize = %u", test_bit, bitsize);
- return TRUE;
-error2:
- printf("Error in flip bit 2, bit %u, bitsize = %u", test_bit, bitsize);
- return TRUE;
-}
-
-bool test_operators(MY_BITMAP *map __attribute__((unused)),
- uint bitsize __attribute__((unused)))
-{
- return FALSE;
-}
-
-bool test_get_all_bits(MY_BITMAP *map, uint bitsize)
-{
- uint i;
- bitmap_set_all(map);
- if (!bitmap_is_set_all(map))
- goto error1;
- if (!bitmap_is_prefix(map, bitsize))
- goto error5;
- bitmap_clear_all(map);
- if (!bitmap_is_clear_all(map))
- goto error2;
- if (!bitmap_is_prefix(map, 0))
- goto error6;
- for (i=0; i<bitsize;i++)
- bitmap_set_bit(map, i);
- if (!bitmap_is_set_all(map))
- goto error3;
- for (i=0; i<bitsize;i++)
- bitmap_clear_bit(map, i);
- if (!bitmap_is_clear_all(map))
- goto error4;
- return FALSE;
-error1:
- printf("Error in set_all, bitsize = %u", bitsize);
- return TRUE;
-error2:
- printf("Error in clear_all, bitsize = %u", bitsize);
- return TRUE;
-error3:
- printf("Error in bitmap_is_set_all, bitsize = %u", bitsize);
- return TRUE;
-error4:
- printf("Error in bitmap_is_clear_all, bitsize = %u", bitsize);
- return TRUE;
-error5:
- printf("Error in set_all through set_prefix, bitsize = %u", bitsize);
- return TRUE;
-error6:
- printf("Error in clear_all through set_prefix, bitsize = %u", bitsize);
- return TRUE;
-}
-
-bool test_compare_operators(MY_BITMAP *map, uint bitsize)
-{
- uint i, j, test_bit1, test_bit2, test_bit3,test_bit4;
- uint no_loops= bitsize > 128 ? 128 : bitsize;
- MY_BITMAP map2_obj, map3_obj;
- MY_BITMAP *map2= &map2_obj, *map3= &map3_obj;
- my_bitmap_map map2buf[1024];
- my_bitmap_map map3buf[1024];
- bitmap_init(&map2_obj, map2buf, bitsize, FALSE);
- bitmap_init(&map3_obj, map3buf, bitsize, FALSE);
- bitmap_clear_all(map2);
- bitmap_clear_all(map3);
- for (i=0; i < no_loops; i++)
- {
- test_bit1=get_rand_bit(bitsize);
- bitmap_set_prefix(map, test_bit1);
- test_bit2=get_rand_bit(bitsize);
- bitmap_set_prefix(map2, test_bit2);
- bitmap_intersect(map, map2);
- test_bit3= test_bit2 < test_bit1 ? test_bit2 : test_bit1;
- bitmap_set_prefix(map3, test_bit3);
- if (!bitmap_cmp(map, map3))
- goto error1;
- bitmap_clear_all(map);
- bitmap_clear_all(map2);
- bitmap_clear_all(map3);
- test_bit1=get_rand_bit(bitsize);
- test_bit2=get_rand_bit(bitsize);
- test_bit3=get_rand_bit(bitsize);
- bitmap_set_prefix(map, test_bit1);
- bitmap_set_prefix(map2, test_bit2);
- test_bit3= test_bit2 > test_bit1 ? test_bit2 : test_bit1;
- bitmap_set_prefix(map3, test_bit3);
- bitmap_union(map, map2);
- if (!bitmap_cmp(map, map3))
- goto error2;
- bitmap_clear_all(map);
- bitmap_clear_all(map2);
- bitmap_clear_all(map3);
- test_bit1=get_rand_bit(bitsize);
- test_bit2=get_rand_bit(bitsize);
- test_bit3=get_rand_bit(bitsize);
- bitmap_set_prefix(map, test_bit1);
- bitmap_set_prefix(map2, test_bit2);
- bitmap_xor(map, map2);
- test_bit3= test_bit2 > test_bit1 ? test_bit2 : test_bit1;
- test_bit4= test_bit2 < test_bit1 ? test_bit2 : test_bit1;
- bitmap_set_prefix(map3, test_bit3);
- for (j=0; j < test_bit4; j++)
- bitmap_clear_bit(map3, j);
- if (!bitmap_cmp(map, map3))
- goto error3;
- bitmap_clear_all(map);
- bitmap_clear_all(map2);
- bitmap_clear_all(map3);
- test_bit1=get_rand_bit(bitsize);
- test_bit2=get_rand_bit(bitsize);
- test_bit3=get_rand_bit(bitsize);
- bitmap_set_prefix(map, test_bit1);
- bitmap_set_prefix(map2, test_bit2);
- bitmap_subtract(map, map2);
- if (test_bit2 < test_bit1)
- {
- bitmap_set_prefix(map3, test_bit1);
- for (j=0; j < test_bit2; j++)
- bitmap_clear_bit(map3, j);
- }
- if (!bitmap_cmp(map, map3))
- goto error4;
- bitmap_clear_all(map);
- bitmap_clear_all(map2);
- bitmap_clear_all(map3);
- test_bit1=get_rand_bit(bitsize);
- bitmap_set_prefix(map, test_bit1);
- bitmap_invert(map);
- bitmap_set_all(map3);
- for (j=0; j < test_bit1; j++)
- bitmap_clear_bit(map3, j);
- if (!bitmap_cmp(map, map3))
- goto error5;
- bitmap_clear_all(map);
- bitmap_clear_all(map3);
- }
- return FALSE;
-error1:
- printf("intersect error bitsize=%u,size1=%u,size2=%u", bitsize,
- test_bit1,test_bit2);
- return TRUE;
-error2:
- printf("union error bitsize=%u,size1=%u,size2=%u", bitsize,
- test_bit1,test_bit2);
- return TRUE;
-error3:
- printf("xor error bitsize=%u,size1=%u,size2=%u", bitsize,
- test_bit1,test_bit2);
- return TRUE;
-error4:
- printf("subtract error bitsize=%u,size1=%u,size2=%u", bitsize,
- test_bit1,test_bit2);
- return TRUE;
-error5:
- printf("invert error bitsize=%u,size=%u", bitsize,
- test_bit1);
- return TRUE;
-}
-
-bool test_count_bits_set(MY_BITMAP *map, uint bitsize)
-{
- uint i, bit_count=0, test_bit;
- uint no_loops= bitsize > 128 ? 128 : bitsize;
- for (i=0; i < no_loops; i++)
- {
- test_bit=get_rand_bit(bitsize);
- if (!bitmap_is_set(map, test_bit))
- {
- bitmap_set_bit(map, test_bit);
- bit_count++;
- }
- }
- if (bit_count==0 && bitsize > 0)
- goto error1;
- if (bitmap_bits_set(map) != bit_count)
- goto error2;
- return FALSE;
-error1:
- printf("No bits set bitsize = %u", bitsize);
- return TRUE;
-error2:
- printf("Wrong count of bits set, bitsize = %u", bitsize);
- return TRUE;
-}
-
-bool test_get_first_bit(MY_BITMAP *map, uint bitsize)
-{
- uint i, test_bit;
- uint no_loops= bitsize > 128 ? 128 : bitsize;
- for (i=0; i < no_loops; i++)
- {
- test_bit=get_rand_bit(bitsize);
- bitmap_set_bit(map, test_bit);
- if (bitmap_get_first_set(map) != test_bit)
- goto error1;
- bitmap_set_all(map);
- bitmap_clear_bit(map, test_bit);
- if (bitmap_get_first(map) != test_bit)
- goto error2;
- bitmap_clear_all(map);
- }
- return FALSE;
-error1:
- printf("get_first_set error bitsize=%u,prefix_size=%u",bitsize,test_bit);
- return TRUE;
-error2:
- printf("get_first error bitsize= %u, prefix_size= %u",bitsize,test_bit);
- return TRUE;
-}
-
-bool test_get_next_bit(MY_BITMAP *map, uint bitsize)
-{
- uint i, j, test_bit;
- uint no_loops= bitsize > 128 ? 128 : bitsize;
- for (i=0; i < no_loops; i++)
- {
- test_bit=get_rand_bit(bitsize);
- for (j=0; j < test_bit; j++)
- bitmap_set_next(map);
- if (!bitmap_is_prefix(map, test_bit))
- goto error1;
- bitmap_clear_all(map);
- }
- return FALSE;
-error1:
- printf("get_next error bitsize= %u, prefix_size= %u", bitsize,test_bit);
- return TRUE;
-}
-
-bool test_prefix(MY_BITMAP *map, uint bitsize)
-{
- uint i, j, test_bit;
- uint no_loops= bitsize > 128 ? 128 : bitsize;
- for (i=0; i < no_loops; i++)
- {
- test_bit=get_rand_bit(bitsize);
- bitmap_set_prefix(map, test_bit);
- if (!bitmap_is_prefix(map, test_bit))
- goto error1;
- bitmap_clear_all(map);
- for (j=0; j < test_bit; j++)
- bitmap_set_bit(map, j);
- if (!bitmap_is_prefix(map, test_bit))
- goto error2;
- bitmap_set_all(map);
- for (j=bitsize - 1; ~(j-test_bit); j--)
- bitmap_clear_bit(map, j);
- if (!bitmap_is_prefix(map, test_bit))
- goto error3;
- bitmap_clear_all(map);
- }
- return FALSE;
-error1:
- printf("prefix1 error bitsize = %u, prefix_size = %u", bitsize,test_bit);
- return TRUE;
-error2:
- printf("prefix2 error bitsize = %u, prefix_size = %u", bitsize,test_bit);
- return TRUE;
-error3:
- printf("prefix3 error bitsize = %u, prefix_size = %u", bitsize,test_bit);
- return TRUE;
-}
-
-
-bool do_test(uint bitsize)
-{
- MY_BITMAP map;
- my_bitmap_map buf[1024];
- if (bitmap_init(&map, buf, bitsize, FALSE))
- {
- printf("init error for bitsize %d", bitsize);
- goto error;
- }
- if (test_set_get_clear_bit(&map,bitsize))
- goto error;
- bitmap_clear_all(&map);
- if (test_flip_bit(&map,bitsize))
- goto error;
- bitmap_clear_all(&map);
- if (test_operators(&map,bitsize))
- goto error;
- bitmap_clear_all(&map);
- if (test_get_all_bits(&map, bitsize))
- goto error;
- bitmap_clear_all(&map);
- if (test_compare_operators(&map,bitsize))
- goto error;
- bitmap_clear_all(&map);
- if (test_count_bits_set(&map,bitsize))
- goto error;
- bitmap_clear_all(&map);
- if (test_get_first_bit(&map,bitsize))
- goto error;
- bitmap_clear_all(&map);
- if (test_get_next_bit(&map,bitsize))
- goto error;
- if (test_prefix(&map,bitsize))
- goto error;
- return FALSE;
-error:
- printf("\n");
- return TRUE;
-}
-
-int main()
-{
- int i;
- for (i= 1; i < 4096; i++)
- {
- printf("Start test for bitsize=%u\n",i);
- if (do_test(i))
- return -1;
- }
- printf("OK\n");
- return 0;
-}
-
-/*
- In directory mysys:
- make test_bitmap
- will build the bitmap tests and ./test_bitmap will execute it
-*/
-
-#endif
diff -Nrup a/mysys/my_bitmap.cc b/mysys/my_bitmap.cc
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/mysys/my_bitmap.cc 2008-04-23 13:03:25 -07:00
@@ -0,0 +1,1130 @@
+/* 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; version 2 of the License.
+
+ 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 */
+
+/*
+ Handling of uchar arrays as large bitmaps.
+
+ API limitations (or, rather asserted safety assumptions,
+ to encourage correct programming)
+
+ * the internal size is a set of 32 bit words
+ * the number of bits specified in creation can be any number > 0
+ * there are THREAD safe versions of most calls called bitmap_lock_*
+ many of those are not used and not compiled normally but the code
+ already exist for them in an #ifdef:ed part. These can only be used
+ if THREAD was specified in bitmap_init
+
+ TODO:
+ Make assembler THREAD safe versions of these using test-and-set instructions
+
+ Original version created by Sergei Golubchik 2001 - 2004.
+ New version written and test program added and some changes to the interface
+ was made by Mikael Ronström 2005, with assistance of Tomas Ulin and Mats
+ Kindahl.
+*/
+
+#include "mysys_priv.h"
+#include <my_bitmap.h>
+#include <m_string.h>
+#include <my_bit.h>
+
+void create_last_word_mask(MY_BITMAP *map)
+{
+ /* Get the number of used bits (1..8) in the last byte */
+ unsigned int const used= 1U + ((map->n_bits-1U) & 0x7U);
+
+ /*
+ Create a mask with the upper 'unused' bits set and the lower 'used'
+ bits clear. The bits within each byte is stored in big-endian order.
+ */
+ unsigned char const mask= (~((1 << used) - 1)) & 255;
+
+ /*
+ The first bytes are to be set to zero since they represent real bits
+ in the bitvector. The last bytes are set to 0xFF since they represent
+ bytes not used by the bitvector. Finally the last byte contains bits
+ as set by the mask above.
+ */
+ unsigned char *ptr= (unsigned char*)&map->last_word_mask;
+
+ map->last_word_ptr= map->bitmap + no_words_in_map(map)-1;
+ switch (no_bytes_in_map(map) & 3) {
+ case 1:
+ map->last_word_mask= ~0U;
+ ptr[0]= mask;
+ return;
+ case 2:
+ map->last_word_mask= ~0U;
+ ptr[0]= 0;
+ ptr[1]= mask;
+ return;
+ case 3:
+ map->last_word_mask= 0U;
+ ptr[2]= mask;
+ ptr[3]= 0xFFU;
+ return;
+ case 0:
+ map->last_word_mask= 0U;
+ ptr[3]= mask;
+ return;
+ }
+}
+
+
+static inline void bitmap_lock(MY_BITMAP *map __attribute__((unused)))
+{
+#ifdef THREAD
+ if (map->mutex)
+ pthread_mutex_lock(map->mutex);
+#endif
+}
+
+static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused)))
+{
+#ifdef THREAD
+ if (map->mutex)
+ pthread_mutex_unlock(map->mutex);
+#endif
+}
+
+
+my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
+ my_bool thread_safe __attribute__((unused)))
+{
+ DBUG_ENTER("bitmap_init");
+ if (!buf)
+ {
+ uint size_in_bytes= bitmap_buffer_size(n_bits);
+ uint extra= 0;
+#ifdef THREAD
+ if (thread_safe)
+ {
+ size_in_bytes= ALIGN_SIZE(size_in_bytes);
+ extra= sizeof(pthread_mutex_t);
+ }
+ map->mutex= 0;
+#endif
+ if (!(buf= (my_bitmap_map*) my_malloc(size_in_bytes+extra, MYF(MY_WME))))
+ DBUG_RETURN(1);
+#ifdef THREAD
+ if (thread_safe)
+ {
+ map->mutex= (pthread_mutex_t *) ((char*) buf + size_in_bytes);
+ pthread_mutex_init(map->mutex, MY_MUTEX_INIT_FAST);
+ }
+#endif
+ }
+#ifdef THREAD
+ else
+ {
+ DBUG_ASSERT(thread_safe == 0);
+ }
+#endif
+
+ map->bitmap= buf;
+ map->n_bits= n_bits;
+ create_last_word_mask(map);
+ bitmap_clear_all(map);
+ DBUG_RETURN(0);
+}
+
+
+void bitmap_free(MY_BITMAP *map)
+{
+ DBUG_ENTER("bitmap_free");
+ if (map->bitmap)
+ {
+#ifdef THREAD
+ if (map->mutex)
+ pthread_mutex_destroy(map->mutex);
+#endif
+ my_free((char*) map->bitmap, MYF(0));
+ map->bitmap=0;
+ }
+ DBUG_VOID_RETURN;
+}
+
+
+/*
+ test if bit already set and set it if it was not (thread unsafe method)
+
+ SYNOPSIS
+ bitmap_fast_test_and_set()
+ MAP bit map struct
+ BIT bit number
+
+ RETURN
+ 0 bit was not set
+ !=0 bit was set
+*/
+
+my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit)
+{
+ uchar *value= ((uchar*) map->bitmap) + (bitmap_bit / 8);
+ uchar bit= 1 << ((bitmap_bit) & 7);
+ uchar res= (*value) & bit;
+ *value|= bit;
+ return res;
+}
+
+
+/*
+ test if bit already set and set it if it was not (thread safe method)
+
+ SYNOPSIS
+ bitmap_fast_test_and_set()
+ map bit map struct
+ bitmap_bit bit number
+
+ RETURN
+ 0 bit was not set
+ !=0 bit was set
+*/
+
+my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit)
+{
+ my_bool res;
+ DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
+ bitmap_lock(map);
+ res= bitmap_fast_test_and_set(map, bitmap_bit);
+ bitmap_unlock(map);
+ return res;
+}
+
+/*
+ test if bit already set and clear it if it was set(thread unsafe method)
+
+ SYNOPSIS
+ bitmap_fast_test_and_set()
+ MAP bit map struct
+ BIT bit number
+
+ RETURN
+ 0 bit was not set
+ !=0 bit was set
+*/
+
+my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
+{
+ uchar *byte= (uchar*) map->bitmap + (bitmap_bit / 8);
+ uchar bit= 1 << ((bitmap_bit) & 7);
+ uchar res= (*byte) & bit;
+ *byte&= ~bit;
+ return res;
+}
+
+
+my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
+{
+ my_bool res;
+ DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
+ bitmap_lock(map);
+ res= bitmap_fast_test_and_clear(map, bitmap_bit);
+ bitmap_unlock(map);
+ return res;
+}
+
+
+uint bitmap_set_next(MY_BITMAP *map)
+{
+ uint bit_found;
+ DBUG_ASSERT(map->bitmap);
+ if ((bit_found= bitmap_get_first(map)) != MY_BIT_NONE)
+ bitmap_set_bit(map, bit_found);
+ return bit_found;
+}
+
+
+void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size)
+{
+ uint prefix_bytes, prefix_bits, d;
+ uchar *m= (uchar *)map->bitmap;
+
+ DBUG_ASSERT(map->bitmap &&
+ (prefix_size <= map->n_bits || prefix_size == (uint) ~0));
+ set_if_smaller(prefix_size, map->n_bits);
+ if ((prefix_bytes= prefix_size / 8))
+ memset(m, 0xff, prefix_bytes);
+ m+= prefix_bytes;
+ if ((prefix_bits= prefix_size & 7))
+ *m++= (1 << prefix_bits)-1;
+ if ((d= no_bytes_in_map(map)-prefix_bytes))
+ bzero(m, d);
+}
+
+
+my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
+{
+ uint prefix_bits= prefix_size & 0x7, res;
+ uchar *m= (uchar*)map->bitmap;
+ uchar *end_prefix= m+prefix_size/8;
+ uchar *end;
+ DBUG_ASSERT(m && prefix_size <= map->n_bits);
+ end= m+no_bytes_in_map(map);
+
+ while (m < end_prefix)
+ if (*m++ != 0xff)
+ return 0;
+
+ *map->last_word_ptr&= ~map->last_word_mask; /*Clear bits*/
+ res= 0;
+ if (prefix_bits && *m++ != (1 << prefix_bits)-1)
+ goto ret;
+
+ while (m < end)
+ if (*m++ != 0)
+ goto ret;
+ res= 1;
+ret:
+ return res;
+}
+
+
+my_bool bitmap_is_set_all(const MY_BITMAP *map)
+{
+ my_bitmap_map *data_ptr= map->bitmap;
+ my_bitmap_map *end= map->last_word_ptr;
+ *map->last_word_ptr |= map->last_word_mask;
+ for (; data_ptr <= end; data_ptr++)
+ if (*data_ptr != 0xFFFFFFFF)
+ return FALSE;
+ return TRUE;
+}
+
+
+my_bool bitmap_is_clear_all(const MY_BITMAP *map)
+{
+ my_bitmap_map *data_ptr= map->bitmap;
+ my_bitmap_map *end;
+ if (*map->last_word_ptr & ~map->last_word_mask)
+ return FALSE;
+ end= map->last_word_ptr;
+ for (; data_ptr < end; data_ptr++)
+ if (*data_ptr)
+ return FALSE;
+ return TRUE;
+}
+
+/* Return TRUE if map1 is a subset of map2 */
+
+my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
+{
+ my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
+
+ DBUG_ASSERT(map1->bitmap && map2->bitmap &&
+ map1->n_bits==map2->n_bits);
+
+ end= map1->last_word_ptr;
+ *map1->last_word_ptr &= ~map1->last_word_mask;
+ *map2->last_word_ptr &= ~map2->last_word_mask;
+ while (m1 <= end)
+ {
+ if ((*m1++) & ~(*m2++))
+ return 0;
+ }
+ return 1;
+}
+
+/* True if bitmaps has any common bits */
+
+my_bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2)
+{
+ my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
+
+ DBUG_ASSERT(map1->bitmap && map2->bitmap &&
+ map1->n_bits==map2->n_bits);
+
+ end= map1->last_word_ptr;
+ *map1->last_word_ptr &= ~map1->last_word_mask;
+ *map2->last_word_ptr &= ~map2->last_word_mask;
+ while (m1 <= end)
+ {
+ if ((*m1++) & (*m2++))
+ return 1;
+ }
+ return 0;
+}
+
+
+void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
+{
+ my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
+ uint len= no_words_in_map(map), len2 = no_words_in_map(map2);
+
+ DBUG_ASSERT(map->bitmap && map2->bitmap);
+
+ end= to+min(len,len2);
+ *map2->last_word_ptr&= ~map2->last_word_mask; /*Clear last bits in map2*/
+ while (to < end)
+ *to++ &= *from++;
+
+ if (len2 < len)
+ {
+ end+=len-len2;
+ while (to < end)
+ *to++=0;
+ }
+}
+
+
+/*
+ Set/clear all bits above a bit.
+
+ SYNOPSIS
+ bitmap_set_above()
+ map RETURN The bitmap to change.
+ from_byte The bitmap buffer byte offset to start with.
+ use_bit The bit value (1/0) to use for all upper bits.
+
+ NOTE
+ You can only set/clear full bytes.
+ The function is meant for the situation that you copy a smaller bitmap
+ to a bigger bitmap. Bitmap lengths are always multiple of eigth (the
+ size of a byte). Using 'from_byte' saves multiplication and division
+ by eight during parameter passing.
+
+ RETURN
+ void
+*/
+
+void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit)
+{
+ uchar use_byte= use_bit ? 0xff : 0;
+ uchar *to= (uchar *)map->bitmap + from_byte;
+ uchar *end= (uchar *)map->bitmap + (map->n_bits+7)/8;
+
+ while (to < end)
+ *to++= use_byte;
+}
+
+
+void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
+{
+ my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
+ DBUG_ASSERT(map->bitmap && map2->bitmap &&
+ map->n_bits==map2->n_bits);
+
+ end= map->last_word_ptr;
+
+ while (to <= end)
+ *to++ &= ~(*from++);
+}
+
+
+void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
+{
+ my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
+
+ DBUG_ASSERT(map->bitmap && map2->bitmap &&
+ map->n_bits==map2->n_bits);
+ end= map->last_word_ptr;
+
+ while (to <= end)
+ *to++ |= *from++;
+}
+
+
+void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2)
+{
+ my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end= map->last_word_ptr;
+ DBUG_ASSERT(map->bitmap && map2->bitmap &&
+ map->n_bits==map2->n_bits);
+ while (to <= end)
+ *to++ ^= *from++;
+}
+
+
+void bitmap_invert(MY_BITMAP *map)
+{
+ my_bitmap_map *to= map->bitmap, *end;
+
+ DBUG_ASSERT(map->bitmap);
+ end= map->last_word_ptr;
+
+ while (to <= end)
+ *to++ ^= 0xFFFFFFFF;
+}
+
+
+uint bitmap_bits_set(const MY_BITMAP *map)
+{
+ uchar *m= (uchar*)map->bitmap;
+ uchar *end= m + no_bytes_in_map(map);
+ uint res= 0;
+
+ DBUG_ASSERT(map->bitmap);
+ *map->last_word_ptr&= ~map->last_word_mask; /*Reset last bits to zero*/
+ while (m < end)
+ res+= my_count_bits_ushort(*m++);
+ return res;
+}
+
+
+void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2)
+{
+ my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
+
+ DBUG_ASSERT(map->bitmap && map2->bitmap &&
+ map->n_bits==map2->n_bits);
+ end= map->last_word_ptr;
+ while (to <= end)
+ *to++ = *from++;
+}
+
+
+uint bitmap_get_first_set(const MY_BITMAP *map)
+{
+ uchar *byte_ptr;
+ uint i,j,k;
+ my_bitmap_map *data_ptr, *end= map->last_word_ptr;
+
+ DBUG_ASSERT(map->bitmap);
+ data_ptr= map->bitmap;
+ *map->last_word_ptr &= ~map->last_word_mask;
+
+ for (i=0; data_ptr <= end; data_ptr++, i++)
+ {
+ if (*data_ptr)
+ {
+ byte_ptr= (uchar*)data_ptr;
+ for (j=0; ; j++, byte_ptr++)
+ {
+ if (*byte_ptr)
+ {
+ for (k=0; ; k++)
+ {
+ if (*byte_ptr & (1 << k))
+ return (i*32) + (j*8) + k;
+ }
+ DBUG_ASSERT(0);
+ }
+ }
+ DBUG_ASSERT(0);
+ }
+ }
+ return MY_BIT_NONE;
+}
+
+
+uint bitmap_get_first(const MY_BITMAP *map)
+{
+ uchar *byte_ptr;
+ uint i,j,k;
+ my_bitmap_map *data_ptr, *end= map->last_word_ptr;
+
+ DBUG_ASSERT(map->bitmap);
+ data_ptr= map->bitmap;
+ *map->last_word_ptr|= map->last_word_mask;
+
+ for (i=0; data_ptr <= end; data_ptr++, i++)
+ {
+ if (*data_ptr != 0xFFFFFFFF)
+ {
+ byte_ptr= (uchar*)data_ptr;
+ for (j=0; ; j++, byte_ptr++)
+ {
+ if (*byte_ptr != 0xFF)
+ {
+ for (k=0; ; k++)
+ {
+ if (!(*byte_ptr & (1 << k)))
+ return (i*32) + (j*8) + k;
+ }
+ DBUG_ASSERT(0);
+ }
+ }
+ DBUG_ASSERT(0);
+ }
+ }
+ return MY_BIT_NONE;
+}
+
+
+uint bitmap_lock_set_next(MY_BITMAP *map)
+{
+ uint bit_found;
+ bitmap_lock(map);
+ bit_found= bitmap_set_next(map);
+ bitmap_unlock(map);
+ return bit_found;
+}
+
+
+void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit)
+{
+ bitmap_lock(map);
+ DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
+ bitmap_clear_bit(map, bitmap_bit);
+ bitmap_unlock(map);
+}
+
+
+#ifdef NOT_USED
+my_bool bitmap_lock_is_prefix(const MY_BITMAP *map, uint prefix_size)
+{
+ my_bool res;
+ bitmap_lock((MY_BITMAP *)map);
+ res= bitmap_is_prefix(map, prefix_size);
+ bitmap_unlock((MY_BITMAP *)map);
+ return res;
+}
+
+
+void bitmap_lock_set_all(MY_BITMAP *map)
+{
+ bitmap_lock(map);
+ bitmap_set_all(map);
+ bitmap_unlock(map);
+}
+
+
+void bitmap_lock_clear_all(MY_BITMAP *map)
+{
+ bitmap_lock(map);
+ bitmap_clear_all(map);
+ bitmap_unlock(map);
+}
+
+
+void bitmap_lock_set_prefix(MY_BITMAP *map, uint prefix_size)
+{
+ bitmap_lock(map);
+ bitmap_set_prefix(map, prefix_size);
+ bitmap_unlock(map);
+}
+
+
+my_bool bitmap_lock_is_clear_all(const MY_BITMAP *map)
+{
+ uint res;
+ bitmap_lock((MY_BITMAP *)map);
+ res= bitmap_is_clear_all(map);
+ bitmap_unlock((MY_BITMAP *)map);
+ return res;
+}
+
+
+my_bool bitmap_lock_is_set_all(const MY_BITMAP *map)
+{
+ uint res;
+ bitmap_lock((MY_BITMAP *)map);
+ res= bitmap_is_set_all(map);
+ bitmap_unlock((MY_BITMAP *)map);
+ return res;
+}
+
+
+my_bool bitmap_lock_is_set(const MY_BITMAP *map, uint bitmap_bit)
+{
+ my_bool res;
+ DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
+ bitmap_lock((MY_BITMAP *)map);
+ res= bitmap_is_set(map, bitmap_bit);
+ bitmap_unlock((MY_BITMAP *)map);
+ return res;
+}
+
+
+my_bool bitmap_lock_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
+{
+ uint res;
+ bitmap_lock((MY_BITMAP *)map1);
+ bitmap_lock((MY_BITMAP *)map2);
+ res= bitmap_is_subset(map1, map2);
+ bitmap_unlock((MY_BITMAP *)map2);
+ bitmap_unlock((MY_BITMAP *)map1);
+ return res;
+}
+
+
+my_bool bitmap_lock_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
+{
+ uint res;
+
+ DBUG_ASSERT(map1->bitmap && map2->bitmap &&
+ map1->n_bits==map2->n_bits);
+ bitmap_lock((MY_BITMAP *)map1);
+ bitmap_lock((MY_BITMAP *)map2);
+ res= bitmap_cmp(map1, map2);
+ bitmap_unlock((MY_BITMAP *)map2);
+ bitmap_unlock((MY_BITMAP *)map1);
+ return res;
+}
+
+
+void bitmap_lock_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
+{
+ bitmap_lock(map);
+ bitmap_lock((MY_BITMAP *)map2);
+ bitmap_intersect(map, map2);
+ bitmap_unlock((MY_BITMAP *)map2);
+ bitmap_unlock(map);
+}
+
+
+void bitmap_lock_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
+{
+ bitmap_lock(map);
+ bitmap_lock((MY_BITMAP *)map2);
+ bitmap_subtract(map, map2);
+ bitmap_unlock((MY_BITMAP *)map2);
+ bitmap_unlock(map);
+}
+
+
+void bitmap_lock_union(MY_BITMAP *map, const MY_BITMAP *map2)
+{
+ bitmap_lock(map);
+ bitmap_lock((MY_BITMAP *)map2);
+ bitmap_union(map, map2);
+ bitmap_unlock((MY_BITMAP *)map2);
+ bitmap_unlock(map);
+}
+
+
+/*
+ SYNOPSIS
+ bitmap_bits_set()
+ map
+ RETURN
+ Number of set bits in the bitmap.
+*/
+uint bitmap_lock_bits_set(const MY_BITMAP *map)
+{
+ uint res;
+ bitmap_lock((MY_BITMAP *)map);
+ DBUG_ASSERT(map->bitmap);
+ res= bitmap_bits_set(map);
+ bitmap_unlock((MY_BITMAP *)map);
+ return res;
+}
+
+
+/*
+ SYNOPSIS
+ bitmap_get_first()
+ map
+ RETURN
+ Number of first unset bit in the bitmap or MY_BIT_NONE if all bits are set.
+*/
+uint bitmap_lock_get_first(const MY_BITMAP *map)
+{
+ uint res;
+ bitmap_lock((MY_BITMAP*)map);
+ res= bitmap_get_first(map);
+ bitmap_unlock((MY_BITMAP*)map);
+ return res;
+}
+
+
+uint bitmap_lock_get_first_set(const MY_BITMAP *map)
+{
+ uint res;
+ bitmap_lock((MY_BITMAP*)map);
+ res= bitmap_get_first_set(map);
+ bitmap_unlock((MY_BITMAP*)map);
+ return res;
+}
+
+
+void bitmap_lock_set_bit(MY_BITMAP *map, uint bitmap_bit)
+{
+ DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
+ bitmap_lock(map);
+ bitmap_set_bit(map, bitmap_bit);
+ bitmap_unlock(map);
+}
+
+
+void bitmap_lock_flip_bit(MY_BITMAP *map, uint bitmap_bit)
+{
+ DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
+ bitmap_lock(map);
+ bitmap_flip_bit(map, bitmap_bit);
+ bitmap_unlock(map);
+}
+#endif
+#ifdef MAIN
+
+uint get_rand_bit(uint bitsize)
+{
+ return (rand() % bitsize);
+}
+
+bool test_set_get_clear_bit(MY_BITMAP *map, uint bitsize)
+{
+ uint i, test_bit;
+ uint no_loops= bitsize > 128 ? 128 : bitsize;
+ for (i=0; i < no_loops; i++)
+ {
+ test_bit= get_rand_bit(bitsize);
+ bitmap_set_bit(map, test_bit);
+ if (!bitmap_is_set(map, test_bit))
+ goto error1;
+ bitmap_clear_bit(map, test_bit);
+ if (bitmap_is_set(map, test_bit))
+ goto error2;
+ }
+ return FALSE;
+error1:
+ printf("Error in set bit, bit %u, bitsize = %u", test_bit, bitsize);
+ return TRUE;
+error2:
+ printf("Error in clear bit, bit %u, bitsize = %u", test_bit, bitsize);
+ return TRUE;
+}
+
+bool test_flip_bit(MY_BITMAP *map, uint bitsize)
+{
+ uint i, test_bit;
+ uint no_loops= bitsize > 128 ? 128 : bitsize;
+ for (i=0; i < no_loops; i++)
+ {
+ test_bit= get_rand_bit(bitsize);
+ bitmap_flip_bit(map, test_bit);
+ if (!bitmap_is_set(map, test_bit))
+ goto error1;
+ bitmap_flip_bit(map, test_bit);
+ if (bitmap_is_set(map, test_bit))
+ goto error2;
+ }
+ return FALSE;
+error1:
+ printf("Error in flip bit 1, bit %u, bitsize = %u", test_bit, bitsize);
+ return TRUE;
+error2:
+ printf("Error in flip bit 2, bit %u, bitsize = %u", test_bit, bitsize);
+ return TRUE;
+}
+
+bool test_operators(MY_BITMAP *map __attribute__((unused)),
+ uint bitsize __attribute__((unused)))
+{
+ return FALSE;
+}
+
+bool test_get_all_bits(MY_BITMAP *map, uint bitsize)
+{
+ uint i;
+ bitmap_set_all(map);
+ if (!bitmap_is_set_all(map))
+ goto error1;
+ if (!bitmap_is_prefix(map, bitsize))
+ goto error5;
+ bitmap_clear_all(map);
+ if (!bitmap_is_clear_all(map))
+ goto error2;
+ if (!bitmap_is_prefix(map, 0))
+ goto error6;
+ for (i=0; i<bitsize;i++)
+ bitmap_set_bit(map, i);
+ if (!bitmap_is_set_all(map))
+ goto error3;
+ for (i=0; i<bitsize;i++)
+ bitmap_clear_bit(map, i);
+ if (!bitmap_is_clear_all(map))
+ goto error4;
+ return FALSE;
+error1:
+ printf("Error in set_all, bitsize = %u", bitsize);
+ return TRUE;
+error2:
+ printf("Error in clear_all, bitsize = %u", bitsize);
+ return TRUE;
+error3:
+ printf("Error in bitmap_is_set_all, bitsize = %u", bitsize);
+ return TRUE;
+error4:
+ printf("Error in bitmap_is_clear_all, bitsize = %u", bitsize);
+ return TRUE;
+error5:
+ printf("Error in set_all through set_prefix, bitsize = %u", bitsize);
+ return TRUE;
+error6:
+ printf("Error in clear_all through set_prefix, bitsize = %u", bitsize);
+ return TRUE;
+}
+
+bool test_compare_operators(MY_BITMAP *map, uint bitsize)
+{
+ uint i, j, test_bit1, test_bit2, test_bit3,test_bit4;
+ uint no_loops= bitsize > 128 ? 128 : bitsize;
+ MY_BITMAP map2_obj, map3_obj;
+ MY_BITMAP *map2= &map2_obj, *map3= &map3_obj;
+ my_bitmap_map map2buf[1024];
+ my_bitmap_map map3buf[1024];
+ bitmap_init(&map2_obj, map2buf, bitsize, FALSE);
+ bitmap_init(&map3_obj, map3buf, bitsize, FALSE);
+ bitmap_clear_all(map2);
+ bitmap_clear_all(map3);
+ for (i=0; i < no_loops; i++)
+ {
+ test_bit1=get_rand_bit(bitsize);
+ bitmap_set_prefix(map, test_bit1);
+ test_bit2=get_rand_bit(bitsize);
+ bitmap_set_prefix(map2, test_bit2);
+ bitmap_intersect(map, map2);
+ test_bit3= test_bit2 < test_bit1 ? test_bit2 : test_bit1;
+ bitmap_set_prefix(map3, test_bit3);
+ if (!bitmap_cmp(map, map3))
+ goto error1;
+ bitmap_clear_all(map);
+ bitmap_clear_all(map2);
+ bitmap_clear_all(map3);
+ test_bit1=get_rand_bit(bitsize);
+ test_bit2=get_rand_bit(bitsize);
+ test_bit3=get_rand_bit(bitsize);
+ bitmap_set_prefix(map, test_bit1);
+ bitmap_set_prefix(map2, test_bit2);
+ test_bit3= test_bit2 > test_bit1 ? test_bit2 : test_bit1;
+ bitmap_set_prefix(map3, test_bit3);
+ bitmap_union(map, map2);
+ if (!bitmap_cmp(map, map3))
+ goto error2;
+ bitmap_clear_all(map);
+ bitmap_clear_all(map2);
+ bitmap_clear_all(map3);
+ test_bit1=get_rand_bit(bitsize);
+ test_bit2=get_rand_bit(bitsize);
+ test_bit3=get_rand_bit(bitsize);
+ bitmap_set_prefix(map, test_bit1);
+ bitmap_set_prefix(map2, test_bit2);
+ bitmap_xor(map, map2);
+ test_bit3= test_bit2 > test_bit1 ? test_bit2 : test_bit1;
+ test_bit4= test_bit2 < test_bit1 ? test_bit2 : test_bit1;
+ bitmap_set_prefix(map3, test_bit3);
+ for (j=0; j < test_bit4; j++)
+ bitmap_clear_bit(map3, j);
+ if (!bitmap_cmp(map, map3))
+ goto error3;
+ bitmap_clear_all(map);
+ bitmap_clear_all(map2);
+ bitmap_clear_all(map3);
+ test_bit1=get_rand_bit(bitsize);
+ test_bit2=get_rand_bit(bitsize);
+ test_bit3=get_rand_bit(bitsize);
+ bitmap_set_prefix(map, test_bit1);
+ bitmap_set_prefix(map2, test_bit2);
+ bitmap_subtract(map, map2);
+ if (test_bit2 < test_bit1)
+ {
+ bitmap_set_prefix(map3, test_bit1);
+ for (j=0; j < test_bit2; j++)
+ bitmap_clear_bit(map3, j);
+ }
+ if (!bitmap_cmp(map, map3))
+ goto error4;
+ bitmap_clear_all(map);
+ bitmap_clear_all(map2);
+ bitmap_clear_all(map3);
+ test_bit1=get_rand_bit(bitsize);
+ bitmap_set_prefix(map, test_bit1);
+ bitmap_invert(map);
+ bitmap_set_all(map3);
+ for (j=0; j < test_bit1; j++)
+ bitmap_clear_bit(map3, j);
+ if (!bitmap_cmp(map, map3))
+ goto error5;
+ bitmap_clear_all(map);
+ bitmap_clear_all(map3);
+ }
+ return FALSE;
+error1:
+ printf("intersect error bitsize=%u,size1=%u,size2=%u", bitsize,
+ test_bit1,test_bit2);
+ return TRUE;
+error2:
+ printf("union error bitsize=%u,size1=%u,size2=%u", bitsize,
+ test_bit1,test_bit2);
+ return TRUE;
+error3:
+ printf("xor error bitsize=%u,size1=%u,size2=%u", bitsize,
+ test_bit1,test_bit2);
+ return TRUE;
+error4:
+ printf("subtract error bitsize=%u,size1=%u,size2=%u", bitsize,
+ test_bit1,test_bit2);
+ return TRUE;
+error5:
+ printf("invert error bitsize=%u,size=%u", bitsize,
+ test_bit1);
+ return TRUE;
+}
+
+bool test_count_bits_set(MY_BITMAP *map, uint bitsize)
+{
+ uint i, bit_count=0, test_bit;
+ uint no_loops= bitsize > 128 ? 128 : bitsize;
+ for (i=0; i < no_loops; i++)
+ {
+ test_bit=get_rand_bit(bitsize);
+ if (!bitmap_is_set(map, test_bit))
+ {
+ bitmap_set_bit(map, test_bit);
+ bit_count++;
+ }
+ }
+ if (bit_count==0 && bitsize > 0)
+ goto error1;
+ if (bitmap_bits_set(map) != bit_count)
+ goto error2;
+ return FALSE;
+error1:
+ printf("No bits set bitsize = %u", bitsize);
+ return TRUE;
+error2:
+ printf("Wrong count of bits set, bitsize = %u", bitsize);
+ return TRUE;
+}
+
+bool test_get_first_bit(MY_BITMAP *map, uint bitsize)
+{
+ uint i, test_bit;
+ uint no_loops= bitsize > 128 ? 128 : bitsize;
+ for (i=0; i < no_loops; i++)
+ {
+ test_bit=get_rand_bit(bitsize);
+ bitmap_set_bit(map, test_bit);
+ if (bitmap_get_first_set(map) != test_bit)
+ goto error1;
+ bitmap_set_all(map);
+ bitmap_clear_bit(map, test_bit);
+ if (bitmap_get_first(map) != test_bit)
+ goto error2;
+ bitmap_clear_all(map);
+ }
+ return FALSE;
+error1:
+ printf("get_first_set error bitsize=%u,prefix_size=%u",bitsize,test_bit);
+ return TRUE;
+error2:
+ printf("get_first error bitsize= %u, prefix_size= %u",bitsize,test_bit);
+ return TRUE;
+}
+
+bool test_get_next_bit(MY_BITMAP *map, uint bitsize)
+{
+ uint i, j, test_bit;
+ uint no_loops= bitsize > 128 ? 128 : bitsize;
+ for (i=0; i < no_loops; i++)
+ {
+ test_bit=get_rand_bit(bitsize);
+ for (j=0; j < test_bit; j++)
+ bitmap_set_next(map);
+ if (!bitmap_is_prefix(map, test_bit))
+ goto error1;
+ bitmap_clear_all(map);
+ }
+ return FALSE;
+error1:
+ printf("get_next error bitsize= %u, prefix_size= %u", bitsize,test_bit);
+ return TRUE;
+}
+
+bool test_prefix(MY_BITMAP *map, uint bitsize)
+{
+ uint i, j, test_bit;
+ uint no_loops= bitsize > 128 ? 128 : bitsize;
+ for (i=0; i < no_loops; i++)
+ {
+ test_bit=get_rand_bit(bitsize);
+ bitmap_set_prefix(map, test_bit);
+ if (!bitmap_is_prefix(map, test_bit))
+ goto error1;
+ bitmap_clear_all(map);
+ for (j=0; j < test_bit; j++)
+ bitmap_set_bit(map, j);
+ if (!bitmap_is_prefix(map, test_bit))
+ goto error2;
+ bitmap_set_all(map);
+ for (j=bitsize - 1; ~(j-test_bit); j--)
+ bitmap_clear_bit(map, j);
+ if (!bitmap_is_prefix(map, test_bit))
+ goto error3;
+ bitmap_clear_all(map);
+ }
+ return FALSE;
+error1:
+ printf("prefix1 error bitsize = %u, prefix_size = %u", bitsize,test_bit);
+ return TRUE;
+error2:
+ printf("prefix2 error bitsize = %u, prefix_size = %u", bitsize,test_bit);
+ return TRUE;
+error3:
+ printf("prefix3 error bitsize = %u, prefix_size = %u", bitsize,test_bit);
+ return TRUE;
+}
+
+
+bool do_test(uint bitsize)
+{
+ MY_BITMAP map;
+ my_bitmap_map buf[1024];
+ if (bitmap_init(&map, buf, bitsize, FALSE))
+ {
+ printf("init error for bitsize %d", bitsize);
+ goto error;
+ }
+ if (test_set_get_clear_bit(&map,bitsize))
+ goto error;
+ bitmap_clear_all(&map);
+ if (test_flip_bit(&map,bitsize))
+ goto error;
+ bitmap_clear_all(&map);
+ if (test_operators(&map,bitsize))
+ goto error;
+ bitmap_clear_all(&map);
+ if (test_get_all_bits(&map, bitsize))
+ goto error;
+ bitmap_clear_all(&map);
+ if (test_compare_operators(&map,bitsize))
+ goto error;
+ bitmap_clear_all(&map);
+ if (test_count_bits_set(&map,bitsize))
+ goto error;
+ bitmap_clear_all(&map);
+ if (test_get_first_bit(&map,bitsize))
+ goto error;
+ bitmap_clear_all(&map);
+ if (test_get_next_bit(&map,bitsize))
+ goto error;
+ if (test_prefix(&map,bitsize))
+ goto error;
+ return FALSE;
+error:
+ printf("\n");
+ return TRUE;
+}
+
+int main()
+{
+ int i;
+ for (i= 1; i < 4096; i++)
+ {
+ printf("Start test for bitsize=%u\n",i);
+ if (do_test(i))
+ return -1;
+ }
+ printf("OK\n");
+ return 0;
+}
+
+/*
+ In directory mysys:
+ make test_bitmap
+ will build the bitmap tests and ./test_bitmap will execute it
+*/
+
+#endif
diff -Nrup a/mysys/queues.c b/mysys/queues.c
--- a/mysys/queues.c 2008-02-18 14:29:35 -08:00
+++ /dev/null Wed Dec 31 16:00:00 196900
@@ -1,690 +0,0 @@
-/* Copyright (C) 2000, 2005 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; version 2 of the License.
-
- 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 */
-
-/*
- Code for generell handling of priority Queues.
- Implemention of queues from "Algoritms in C" by Robert Sedgewick.
- An optimisation of _downheap suggested in Exercise 7.51 in "Data
- Structures & Algorithms in C++" by Mark Allen Weiss, Second Edition
- was implemented by Mikael Ronstrom 2005. Also the O(N) algorithm
- of queue_fix was implemented.
-*/
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <queues.h>
-
-
-/*
- Init queue
-
- SYNOPSIS
- init_queue()
- queue Queue to initialise
- max_elements Max elements that will be put in queue
- offset_to_key Offset to key in element stored in queue
- Used when sending pointers to compare function
- max_at_top Set to 1 if you want biggest element on top.
- compare Compare function for elements, takes 3 arguments.
- first_cmp_arg First argument to compare function
-
- NOTES
- Will allocate max_element pointers for queue array
-
- RETURN
- 0 ok
- 1 Could not allocate memory
-*/
-
-int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
- pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
- void *first_cmp_arg)
-{
- DBUG_ENTER("init_queue");
- if ((queue->root= (uchar **) my_malloc((max_elements+1)*sizeof(void*),
- MYF(MY_WME))) == 0)
- DBUG_RETURN(1);
- queue->elements=0;
- queue->compare=compare;
- queue->first_cmp_arg=first_cmp_arg;
- queue->max_elements=max_elements;
- queue->offset_to_key=offset_to_key;
- queue_set_max_at_top(queue, max_at_top);
- DBUG_RETURN(0);
-}
-
-
-
-/*
- Init queue, uses init_queue internally for init work but also accepts
- auto_extent as parameter
-
- SYNOPSIS
- init_queue_ex()
- queue Queue to initialise
- max_elements Max elements that will be put in queue
- offset_to_key Offset to key in element stored in queue
- Used when sending pointers to compare function
- max_at_top Set to 1 if you want biggest element on top.
- compare Compare function for elements, takes 3 arguments.
- first_cmp_arg First argument to compare function
- auto_extent When the queue is full and there is insert operation
- extend the queue.
-
- NOTES
- Will allocate max_element pointers for queue array
-
- RETURN
- 0 ok
- 1 Could not allocate memory
-*/
-
-int init_queue_ex(QUEUE *queue, uint max_elements, uint offset_to_key,
- pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
- void *first_cmp_arg, uint auto_extent)
-{
- int ret;
- DBUG_ENTER("init_queue_ex");
-
- if ((ret= init_queue(queue, max_elements, offset_to_key, max_at_top, compare,
- first_cmp_arg)))
- DBUG_RETURN(ret);
-
- queue->auto_extent= auto_extent;
- DBUG_RETURN(0);
-}
-
-/*
- Reinitialize queue for other usage
-
- SYNOPSIS
- reinit_queue()
- queue Queue to initialise
- max_elements Max elements that will be put in queue
- offset_to_key Offset to key in element stored in queue
- Used when sending pointers to compare function
- max_at_top Set to 1 if you want biggest element on top.
- compare Compare function for elements, takes 3 arguments.
- first_cmp_arg First argument to compare function
-
- NOTES
- This will delete all elements from the queue. If you don't want this,
- use resize_queue() instead.
-
- RETURN
- 0 ok
- EE_OUTOFMEMORY Wrong max_elements
-*/
-
-int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
- pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
- void *first_cmp_arg)
-{
- DBUG_ENTER("reinit_queue");
- queue->elements=0;
- queue->compare=compare;
- queue->first_cmp_arg=first_cmp_arg;
- queue->offset_to_key=offset_to_key;
- queue_set_max_at_top(queue, max_at_top);
- resize_queue(queue, max_elements);
- DBUG_RETURN(0);
-}
-
-
-/*
- Resize queue
-
- SYNOPSIS
- resize_queue()
- queue Queue
- max_elements New max size for queue
-
- NOTES
- If you resize queue to be less than the elements you have in it,
- the extra elements will be deleted
-
- RETURN
- 0 ok
- 1 Error. In this case the queue is unchanged
-*/
-
-int resize_queue(QUEUE *queue, uint max_elements)
-{
- uchar **new_root;
- DBUG_ENTER("resize_queue");
- if (queue->max_elements == max_elements)
- DBUG_RETURN(0);
- if ((new_root= (uchar **) my_realloc((void *)queue->root,
- (max_elements+1)*sizeof(void*),
- MYF(MY_WME))) == 0)
- DBUG_RETURN(1);
- set_if_smaller(queue->elements, max_elements);
- queue->max_elements= max_elements;
- queue->root= new_root;
- DBUG_RETURN(0);
-}
-
-
-/*
- Delete queue
-
- SYNOPSIS
- delete_queue()
- queue Queue to delete
-
- IMPLEMENTATION
- Just free allocated memory.
-
- NOTES
- Can be called safely multiple times
-*/
-
-void delete_queue(QUEUE *queue)
-{
- DBUG_ENTER("delete_queue");
- if (queue->root)
- {
- my_free((uchar*) queue->root,MYF(0));
- queue->root=0;
- }
- DBUG_VOID_RETURN;
-}
-
-
- /* Code for insert, search and delete of elements */
-
-void queue_insert(register QUEUE *queue, uchar *element)
-{
- reg2 uint idx, next;
- DBUG_ASSERT(queue->elements < queue->max_elements);
- queue->root[0]= element;
- idx= ++queue->elements;
- /* max_at_top swaps the comparison if we want to order by desc */
- while ((queue->compare(queue->first_cmp_arg,
- element + queue->offset_to_key,
- queue->root[(next= idx >> 1)] +
- queue->offset_to_key) * queue->max_at_top) < 0)
- {
- queue->root[idx]= queue->root[next];
- idx= next;
- }
- queue->root[idx]= element;
-}
-
-/*
- Does safe insert. If no more space left on the queue resize it.
- Return codes:
- 0 - OK
- 1 - Cannot allocate more memory
- 2 - auto_extend is 0, the operation would
-
-*/
-
-int queue_insert_safe(register QUEUE *queue, uchar *element)
-{
-
- if (queue->elements == queue->max_elements)
- {
- if (!queue->auto_extent)
- return 2;
- else if (resize_queue(queue, queue->max_elements + queue->auto_extent))
- return 1;
- }
-
- queue_insert(queue, element);
- return 0;
-}
-
-
- /* Remove item from queue */
- /* Returns pointer to removed element */
-
-uchar *queue_remove(register QUEUE *queue, uint idx)
-{
- uchar *element;
- DBUG_ASSERT(idx < queue->max_elements);
- element= queue->root[++idx]; /* Intern index starts from 1 */
- queue->root[idx]= queue->root[queue->elements--];
- _downheap(queue, idx);
- return element;
-}
-
- /* Fix when element on top has been replaced */
-
-#ifndef queue_replaced
-void queue_replaced(QUEUE *queue)
-{
- _downheap(queue,1);
-}
-#endif
-
-#ifndef OLD_VERSION
-
-void _downheap(register QUEUE *queue, uint idx)
-{
- uchar *element;
- uint elements,half_queue,offset_to_key, next_index;
- my_bool first= TRUE;
- uint start_idx= idx;
-
- offset_to_key=queue->offset_to_key;
- element=queue->root[idx];
- half_queue=(elements=queue->elements) >> 1;
-
- while (idx <= half_queue)
- {
- next_index=idx+idx;
- if (next_index < elements &&
- (queue->compare(queue->first_cmp_arg,
- queue->root[next_index]+offset_to_key,
- queue->root[next_index+1]+offset_to_key) *
- queue->max_at_top) > 0)
- next_index++;
- if (first &&
- (((queue->compare(queue->first_cmp_arg,
- queue->root[next_index]+offset_to_key,
- element+offset_to_key) * queue->max_at_top) >= 0)))
- {
- queue->root[idx]= element;
- return;
- }
- queue->root[idx]=queue->root[next_index];
- idx=next_index;
- first= FALSE;
- }
-
- next_index= idx >> 1;
- while (next_index > start_idx)
- {
- if ((queue->compare(queue->first_cmp_arg,
- queue->root[next_index]+offset_to_key,
- element+offset_to_key) *
- queue->max_at_top) < 0)
- break;
- queue->root[idx]=queue->root[next_index];
- idx=next_index;
- next_index= idx >> 1;
- }
- queue->root[idx]=element;
-}
-
-#else
- /*
- The old _downheap version is kept for comparisons with the benchmark
- suit or new benchmarks anyone wants to run for comparisons.
- */
- /* Fix heap when index have changed */
-void _downheap(register QUEUE *queue, uint idx)
-{
- uchar *element;
- uint elements,half_queue,next_index,offset_to_key;
-
- offset_to_key=queue->offset_to_key;
- element=queue->root[idx];
- half_queue=(elements=queue->elements) >> 1;
-
- while (idx <= half_queue)
- {
- next_index=idx+idx;
- if (next_index < elements &&
- (queue->compare(queue->first_cmp_arg,
- queue->root[next_index]+offset_to_key,
- queue->root[next_index+1]+offset_to_key) *
- queue->max_at_top) > 0)
- next_index++;
- if ((queue->compare(queue->first_cmp_arg,
- queue->root[next_index]+offset_to_key,
- element+offset_to_key) * queue->max_at_top) >= 0)
- break;
- queue->root[idx]=queue->root[next_index];
- idx=next_index;
- }
- queue->root[idx]=element;
-}
-
-
-#endif
-
-/*
- Fix heap when every element was changed.
-*/
-
-void queue_fix(QUEUE *queue)
-{
- uint i;
- for (i= queue->elements >> 1; i > 0; i--)
- _downheap(queue, i);
-}
-
-#ifdef MAIN
- /*
- A test program for the priority queue implementation.
- It can also be used to benchmark changes of the implementation
- Build by doing the following in the directory mysys
- make test_priority_queue
- ./test_priority_queue
-
- Written by Mikael Ronström, 2005
- */
-
-static uint num_array[1025];
-static uint tot_no_parts= 0;
-static uint tot_no_loops= 0;
-static uint expected_part= 0;
-static uint expected_num= 0;
-static bool max_ind= 0;
-static bool fix_used= 0;
-static ulonglong start_time= 0;
-
-static bool is_divisible_by(uint num, uint divisor)
-{
- uint quotient= num / divisor;
- if (quotient * divisor == num)
- return TRUE;
- return FALSE;
-}
-
-void calculate_next()
-{
- uint part= expected_part, num= expected_num;
- uint no_parts= tot_no_parts;
- if (max_ind)
- {
- do
- {
- while (++part <= no_parts)
- {
- if (is_divisible_by(num, part) &&
- (num <= ((1 << 21) + part)))
- {
- expected_part= part;
- expected_num= num;
- return;
- }
- }
- part= 0;
- } while (--num);
- }
- else
- {
- do
- {
- while (--part > 0)
- {
- if (is_divisible_by(num, part))
- {
- expected_part= part;
- expected_num= num;
- return;
- }
- }
- part= no_parts + 1;
- } while (++num);
- }
-}
-
-void calculate_end_next(uint part)
-{
- uint no_parts= tot_no_parts, num;
- num_array[part]= 0;
- if (max_ind)
- {
- expected_num= 0;
- for (part= no_parts; part > 0 ; part--)
- {
- if (num_array[part])
- {
- num= num_array[part] & 0x3FFFFF;
- if (num >= expected_num)
- {
- expected_num= num;
- expected_part= part;
- }
- }
- }
- if (expected_num == 0)
- expected_part= 0;
- }
- else
- {
- expected_num= 0xFFFFFFFF;
- for (part= 1; part <= no_parts; part++)
- {
- if (num_array[part])
- {
- num= num_array[part] & 0x3FFFFF;
- if (num <= expected_num)
- {
- expected_num= num;
- expected_part= part;
- }
- }
- }
- if (expected_num == 0xFFFFFFFF)
- expected_part= 0;
- }
- return;
-}
-static int test_compare(void *null_arg, uchar *a, uchar *b)
-{
- uint a_num= (*(uint*)a) & 0x3FFFFF;
- uint b_num= (*(uint*)b) & 0x3FFFFF;
- uint a_part, b_part;
- if (a_num > b_num)
- return +1;
- if (a_num < b_num)
- return -1;
- a_part= (*(uint*)a) >> 22;
- b_part= (*(uint*)b) >> 22;
- if (a_part < b_part)
- return +1;
- if (a_part > b_part)
- return -1;
- return 0;
-}
-
-bool check_num(uint num_part)
-{
- uint part= num_part >> 22;
- uint num= num_part & 0x3FFFFF;
- if (part == expected_part)
- if (num == expected_num)
- return FALSE;
- printf("Expect part %u Expect num 0x%x got part %u num 0x%x max_ind %u fix_used %u \n",
- expected_part, expected_num, part, num, max_ind, fix_used);
- return TRUE;
-}
-
-
-void perform_insert(QUEUE *queue)
-{
- uint i= 1, no_parts= tot_no_parts;
- uint backward_start= 0;
-
- expected_part= 1;
- expected_num= 1;
-
- if (max_ind)
- backward_start= 1 << 21;
-
- do
- {
- uint num= (i + backward_start);
- if (max_ind)
- {
- while (!is_divisible_by(num, i))
- num--;
- if (max_ind && (num > expected_num ||
- (num == expected_num && i < expected_part)))
- {
- expected_num= num;
- expected_part= i;
- }
- }
- num_array[i]= num + (i << 22);
- if (fix_used)
- queue_element(queue, i-1)= (uchar*)&num_array[i];
- else
- queue_insert(queue, (uchar*)&num_array[i]);
- } while (++i <= no_parts);
- if (fix_used)
- {
- queue->elements= no_parts;
- queue_fix(queue);
- }
-}
-
-bool perform_ins_del(QUEUE *queue, bool max_ind)
-{
- uint i= 0, no_loops= tot_no_loops, j= tot_no_parts;
- do
- {
- uint num_part= *(uint*)queue_top(queue);
- uint part= num_part >> 22;
- if (check_num(num_part))
- return TRUE;
- if (j++ >= no_loops)
- {
- calculate_end_next(part);
- queue_remove(queue, (uint) 0);
- }
- else
- {
- calculate_next();
- if (max_ind)
- num_array[part]-= part;
- else
- num_array[part]+= part;
- queue_top(queue)= (uchar*)&num_array[part];
- queue_replaced(queue);
- }
- } while (++i < no_loops);
- return FALSE;
-}
-
-bool do_test(uint no_parts, uint l_max_ind, bool l_fix_used)
-{
- QUEUE queue;
- bool result;
- max_ind= l_max_ind;
- fix_used= l_fix_used;
- init_queue(&queue, no_parts, 0, max_ind, test_compare, NULL);
- tot_no_parts= no_parts;
- tot_no_loops= 1024;
- perform_insert(&queue);
- if ((result= perform_ins_del(&queue, max_ind)))
- delete_queue(&queue);
- if (result)
- {
- printf("Error\n");
- return TRUE;
- }
- return FALSE;
-}
-
-static void start_measurement()
-{
- start_time= my_getsystime();
-}
-
-static void stop_measurement()
-{
- ulonglong stop_time= my_getsystime();
- uint time_in_micros;
- stop_time-= start_time;
- stop_time/= 10; /* Convert to microseconds */
- time_in_micros= (uint)stop_time;
- printf("Time expired is %u microseconds \n", time_in_micros);
-}
-
-static void benchmark_test()
-{
- QUEUE queue_real;
- QUEUE *queue= &queue_real;
- uint i, add;
- fix_used= TRUE;
- max_ind= FALSE;
- tot_no_parts= 1024;
- init_queue(queue, tot_no_parts, 0, max_ind, test_compare, NULL);
- /*
- First benchmark whether queue_fix is faster than using queue_insert
- for sizes of 16 partitions.
- */
- for (tot_no_parts= 2, add=2; tot_no_parts < 128;
- tot_no_parts+= add, add++)
- {
- printf("Start benchmark queue_fix, tot_no_parts= %u \n", tot_no_parts);
- start_measurement();
- for (i= 0; i < 128; i++)
- {
- perform_insert(queue);
- queue_remove_all(queue);
- }
- stop_measurement();
-
- fix_used= FALSE;
- printf("Start benchmark queue_insert\n");
- start_measurement();
- for (i= 0; i < 128; i++)
- {
- perform_insert(queue);
- queue_remove_all(queue);
- }
- stop_measurement();
- }
- /*
- Now benchmark insertion and deletion of 16400 elements.
- Used in consecutive runs this shows whether the optimised _downheap
- is faster than the standard implementation.
- */
- printf("Start benchmarking _downheap \n");
- start_measurement();
- perform_insert(queue);
- for (i= 0; i < 65536; i++)
- {
- uint num, part;
- num= *(uint*)queue_top(queue);
- num+= 16;
- part= num >> 22;
- num_array[part]= num;
- queue_top(queue)= (uchar*)&num_array[part];
- queue_replaced(queue);
- }
- for (i= 0; i < 16; i++)
- queue_remove(queue, (uint) 0);
- queue_remove_all(queue);
- stop_measurement();
-}
-
-int main()
-{
- int i, add= 1;
- for (i= 1; i < 1024; i+=add, add++)
- {
- printf("Start test for priority queue of size %u\n", i);
- if (do_test(i, 0, 1))
- return -1;
- if (do_test(i, 1, 1))
- return -1;
- if (do_test(i, 0, 0))
- return -1;
- if (do_test(i, 1, 0))
- return -1;
- }
- benchmark_test();
- printf("OK\n");
- return 0;
-}
-#endif
diff -Nrup a/mysys/queues.cc b/mysys/queues.cc
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/mysys/queues.cc 2008-04-23 13:03:22 -07:00
@@ -0,0 +1,690 @@
+/* Copyright (C) 2000, 2005 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; version 2 of the License.
+
+ 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 */
+
+/*
+ Code for generell handling of priority Queues.
+ Implemention of queues from "Algoritms in C" by Robert Sedgewick.
+ An optimisation of _downheap suggested in Exercise 7.51 in "Data
+ Structures & Algorithms in C++" by Mark Allen Weiss, Second Edition
+ was implemented by Mikael Ronstrom 2005. Also the O(N) algorithm
+ of queue_fix was implemented.
+*/
+
+#include "mysys_priv.h"
+#include "mysys_err.h"
+#include <queues.h>
+
+
+/*
+ Init queue
+
+ SYNOPSIS
+ init_queue()
+ queue Queue to initialise
+ max_elements Max elements that will be put in queue
+ offset_to_key Offset to key in element stored in queue
+ Used when sending pointers to compare function
+ max_at_top Set to 1 if you want biggest element on top.
+ compare Compare function for elements, takes 3 arguments.
+ first_cmp_arg First argument to compare function
+
+ NOTES
+ Will allocate max_element pointers for queue array
+
+ RETURN
+ 0 ok
+ 1 Could not allocate memory
+*/
+
+int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
+ pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
+ void *first_cmp_arg)
+{
+ DBUG_ENTER("init_queue");
+ if ((queue->root= (uchar **) my_malloc((max_elements+1)*sizeof(void*),
+ MYF(MY_WME))) == 0)
+ DBUG_RETURN(1);
+ queue->elements=0;
+ queue->compare=compare;
+ queue->first_cmp_arg=first_cmp_arg;
+ queue->max_elements=max_elements;
+ queue->offset_to_key=offset_to_key;
+ queue_set_max_at_top(queue, max_at_top);
+ DBUG_RETURN(0);
+}
+
+
+
+/*
+ Init queue, uses init_queue internally for init work but also accepts
+ auto_extent as parameter
+
+ SYNOPSIS
+ init_queue_ex()
+ queue Queue to initialise
+ max_elements Max elements that will be put in queue
+ offset_to_key Offset to key in element stored in queue
+ Used when sending pointers to compare function
+ max_at_top Set to 1 if you want biggest element on top.
+ compare Compare function for elements, takes 3 arguments.
+ first_cmp_arg First argument to compare function
+ auto_extent When the queue is full and there is insert operation
+ extend the queue.
+
+ NOTES
+ Will allocate max_element pointers for queue array
+
+ RETURN
+ 0 ok
+ 1 Could not allocate memory
+*/
+
+int init_queue_ex(QUEUE *queue, uint max_elements, uint offset_to_key,
+ pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
+ void *first_cmp_arg, uint auto_extent)
+{
+ int ret;
+ DBUG_ENTER("init_queue_ex");
+
+ if ((ret= init_queue(queue, max_elements, offset_to_key, max_at_top, compare,
+ first_cmp_arg)))
+ DBUG_RETURN(ret);
+
+ queue->auto_extent= auto_extent;
+ DBUG_RETURN(0);
+}
+
+/*
+ Reinitialize queue for other usage
+
+ SYNOPSIS
+ reinit_queue()
+ queue Queue to initialise
+ max_elements Max elements that will be put in queue
+ offset_to_key Offset to key in element stored in queue
+ Used when sending pointers to compare function
+ max_at_top Set to 1 if you want biggest element on top.
+ compare Compare function for elements, takes 3 arguments.
+ first_cmp_arg First argument to compare function
+
+ NOTES
+ This will delete all elements from the queue. If you don't want this,
+ use resize_queue() instead.
+
+ RETURN
+ 0 ok
+ EE_OUTOFMEMORY Wrong max_elements
+*/
+
+int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
+ pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
+ void *first_cmp_arg)
+{
+ DBUG_ENTER("reinit_queue");
+ queue->elements=0;
+ queue->compare=compare;
+ queue->first_cmp_arg=first_cmp_arg;
+ queue->offset_to_key=offset_to_key;
+ queue_set_max_at_top(queue, max_at_top);
+ resize_queue(queue, max_elements);
+ DBUG_RETURN(0);
+}
+
+
+/*
+ Resize queue
+
+ SYNOPSIS
+ resize_queue()
+ queue Queue
+ max_elements New max size for queue
+
+ NOTES
+ If you resize queue to be less than the elements you have in it,
+ the extra elements will be deleted
+
+ RETURN
+ 0 ok
+ 1 Error. In this case the queue is unchanged
+*/
+
+int resize_queue(QUEUE *queue, uint max_elements)
+{
+ uchar **new_root;
+ DBUG_ENTER("resize_queue");
+ if (queue->max_elements == max_elements)
+ DBUG_RETURN(0);
+ if ((new_root= (uchar **) my_realloc((void *)queue->root,
+ (max_elements+1)*sizeof(void*),
+ MYF(MY_WME))) == 0)
+ DBUG_RETURN(1);
+ set_if_smaller(queue->elements, max_elements);
+ queue->max_elements= max_elements;
+ queue->root= new_root;
+ DBUG_RETURN(0);
+}
+
+
+/*
+ Delete queue
+
+ SYNOPSIS
+ delete_queue()
+ queue Queue to delete
+
+ IMPLEMENTATION
+ Just free allocated memory.
+
+ NOTES
+ Can be called safely multiple times
+*/
+
+void delete_queue(QUEUE *queue)
+{
+ DBUG_ENTER("delete_queue");
+ if (queue->root)
+ {
+ my_free((uchar*) queue->root,MYF(0));
+ queue->root=0;
+ }
+ DBUG_VOID_RETURN;
+}
+
+
+ /* Code for insert, search and delete of elements */
+
+void queue_insert(register QUEUE *queue, uchar *element)
+{
+ reg2 uint idx, next;
+ DBUG_ASSERT(queue->elements < queue->max_elements);
+ queue->root[0]= element;
+ idx= ++queue->elements;
+ /* max_at_top swaps the comparison if we want to order by desc */
+ while ((queue->compare(queue->first_cmp_arg,
+ element + queue->offset_to_key,
+ queue->root[(next= idx >> 1)] +
+ queue->offset_to_key) * queue->max_at_top) < 0)
+ {
+ queue->root[idx]= queue->root[next];
+ idx= next;
+ }
+ queue->root[idx]= element;
+}
+
+/*
+ Does safe insert. If no more space left on the queue resize it.
+ Return codes:
+ 0 - OK
+ 1 - Cannot allocate more memory
+ 2 - auto_extend is 0, the operation would
+
+*/
+
+int queue_insert_safe(register QUEUE *queue, uchar *element)
+{
+
+ if (queue->elements == queue->max_elements)
+ {
+ if (!queue->auto_extent)
+ return 2;
+ else if (resize_queue(queue, queue->max_elements + queue->auto_extent))
+ return 1;
+ }
+
+ queue_insert(queue, element);
+ return 0;
+}
+
+
+ /* Remove item from queue */
+ /* Returns pointer to removed element */
+
+uchar *queue_remove(register QUEUE *queue, uint idx)
+{
+ uchar *element;
+ DBUG_ASSERT(idx < queue->max_elements);
+ element= queue->root[++idx]; /* Intern index starts from 1 */
+ queue->root[idx]= queue->root[queue->elements--];
+ _downheap(queue, idx);
+ return element;
+}
+
+ /* Fix when element on top has been replaced */
+
+#ifndef queue_replaced
+void queue_replaced(QUEUE *queue)
+{
+ _downheap(queue,1);
+}
+#endif
+
+#ifndef OLD_VERSION
+
+void _downheap(register QUEUE *queue, uint idx)
+{
+ uchar *element;
+ uint elements,half_queue,offset_to_key, next_index;
+ my_bool first= TRUE;
+ uint start_idx= idx;
+
+ offset_to_key=queue->offset_to_key;
+ element=queue->root[idx];
+ half_queue=(elements=queue->elements) >> 1;
+
+ while (idx <= half_queue)
+ {
+ next_index=idx+idx;
+ if (next_index < elements &&
+ (queue->compare(queue->first_cmp_arg,
+ queue->root[next_index]+offset_to_key,
+ queue->root[next_index+1]+offset_to_key) *
+ queue->max_at_top) > 0)
+ next_index++;
+ if (first &&
+ (((queue->compare(queue->first_cmp_arg,
+ queue->root[next_index]+offset_to_key,
+ element+offset_to_key) * queue->max_at_top) >= 0)))
+ {
+ queue->root[idx]= element;
+ return;
+ }
+ queue->root[idx]=queue->root[next_index];
+ idx=next_index;
+ first= FALSE;
+ }
+
+ next_index= idx >> 1;
+ while (next_index > start_idx)
+ {
+ if ((queue->compare(queue->first_cmp_arg,
+ queue->root[next_index]+offset_to_key,
+ element+offset_to_key) *
+ queue->max_at_top) < 0)
+ break;
+ queue->root[idx]=queue->root[next_index];
+ idx=next_index;
+ next_index= idx >> 1;
+ }
+ queue->root[idx]=element;
+}
+
+#else
+ /*
+ The old _downheap version is kept for comparisons with the benchmark
+ suit or new benchmarks anyone wants to run for comparisons.
+ */
+ /* Fix heap when index have changed */
+void _downheap(register QUEUE *queue, uint idx)
+{
+ uchar *element;
+ uint elements,half_queue,next_index,offset_to_key;
+
+ offset_to_key=queue->offset_to_key;
+ element=queue->root[idx];
+ half_queue=(elements=queue->elements) >> 1;
+
+ while (idx <= half_queue)
+ {
+ next_index=idx+idx;
+ if (next_index < elements &&
+ (queue->compare(queue->first_cmp_arg,
+ queue->root[next_index]+offset_to_key,
+ queue->root[next_index+1]+offset_to_key) *
+ queue->max_at_top) > 0)
+ next_index++;
+ if ((queue->compare(queue->first_cmp_arg,
+ queue->root[next_index]+offset_to_key,
+ element+offset_to_key) * queue->max_at_top) >= 0)
+ break;
+ queue->root[idx]=queue->root[next_index];
+ idx=next_index;
+ }
+ queue->root[idx]=element;
+}
+
+
+#endif
+
+/*
+ Fix heap when every element was changed.
+*/
+
+void queue_fix(QUEUE *queue)
+{
+ uint i;
+ for (i= queue->elements >> 1; i > 0; i--)
+ _downheap(queue, i);
+}
+
+#ifdef MAIN
+ /*
+ A test program for the priority queue implementation.
+ It can also be used to benchmark changes of the implementation
+ Build by doing the following in the directory mysys
+ make test_priority_queue
+ ./test_priority_queue
+
+ Written by Mikael Ronström, 2005
+ */
+
+static uint num_array[1025];
+static uint tot_no_parts= 0;
+static uint tot_no_loops= 0;
+static uint expected_part= 0;
+static uint expected_num= 0;
+static bool max_ind= 0;
+static bool fix_used= 0;
+static ulonglong start_time= 0;
+
+static bool is_divisible_by(uint num, uint divisor)
+{
+ uint quotient= num / divisor;
+ if (quotient * divisor == num)
+ return TRUE;
+ return FALSE;
+}
+
+void calculate_next()
+{
+ uint part= expected_part, num= expected_num;
+ uint no_parts= tot_no_parts;
+ if (max_ind)
+ {
+ do
+ {
+ while (++part <= no_parts)
+ {
+ if (is_divisible_by(num, part) &&
+ (num <= ((1 << 21) + part)))
+ {
+ expected_part= part;
+ expected_num= num;
+ return;
+ }
+ }
+ part= 0;
+ } while (--num);
+ }
+ else
+ {
+ do
+ {
+ while (--part > 0)
+ {
+ if (is_divisible_by(num, part))
+ {
+ expected_part= part;
+ expected_num= num;
+ return;
+ }
+ }
+ part= no_parts + 1;
+ } while (++num);
+ }
+}
+
+void calculate_end_next(uint part)
+{
+ uint no_parts= tot_no_parts, num;
+ num_array[part]= 0;
+ if (max_ind)
+ {
+ expected_num= 0;
+ for (part= no_parts; part > 0 ; part--)
+ {
+ if (num_array[part])
+ {
+ num= num_array[part] & 0x3FFFFF;
+ if (num >= expected_num)
+ {
+ expected_num= num;
+ expected_part= part;
+ }
+ }
+ }
+ if (expected_num == 0)
+ expected_part= 0;
+ }
+ else
+ {
+ expected_num= 0xFFFFFFFF;
+ for (part= 1; part <= no_parts; part++)
+ {
+ if (num_array[part])
+ {
+ num= num_array[part] & 0x3FFFFF;
+ if (num <= expected_num)
+ {
+ expected_num= num;
+ expected_part= part;
+ }
+ }
+ }
+ if (expected_num == 0xFFFFFFFF)
+ expected_part= 0;
+ }
+ return;
+}
+static int test_compare(void *null_arg, uchar *a, uchar *b)
+{
+ uint a_num= (*(uint*)a) & 0x3FFFFF;
+ uint b_num= (*(uint*)b) & 0x3FFFFF;
+ uint a_part, b_part;
+ if (a_num > b_num)
+ return +1;
+ if (a_num < b_num)
+ return -1;
+ a_part= (*(uint*)a) >> 22;
+ b_part= (*(uint*)b) >> 22;
+ if (a_part < b_part)
+ return +1;
+ if (a_part > b_part)
+ return -1;
+ return 0;
+}
+
+bool check_num(uint num_part)
+{
+ uint part= num_part >> 22;
+ uint num= num_part & 0x3FFFFF;
+ if (part == expected_part)
+ if (num == expected_num)
+ return FALSE;
+ printf("Expect part %u Expect num 0x%x got part %u num 0x%x max_ind %u fix_used %u \n",
+ expected_part, expected_num, part, num, max_ind, fix_used);
+ return TRUE;
+}
+
+
+void perform_insert(QUEUE *queue)
+{
+ uint i= 1, no_parts= tot_no_parts;
+ uint backward_start= 0;
+
+ expected_part= 1;
+ expected_num= 1;
+
+ if (max_ind)
+ backward_start= 1 << 21;
+
+ do
+ {
+ uint num= (i + backward_start);
+ if (max_ind)
+ {
+ while (!is_divisible_by(num, i))
+ num--;
+ if (max_ind && (num > expected_num ||
+ (num == expected_num && i < expected_part)))
+ {
+ expected_num= num;
+ expected_part= i;
+ }
+ }
+ num_array[i]= num + (i << 22);
+ if (fix_used)
+ queue_element(queue, i-1)= (uchar*)&num_array[i];
+ else
+ queue_insert(queue, (uchar*)&num_array[i]);
+ } while (++i <= no_parts);
+ if (fix_used)
+ {
+ queue->elements= no_parts;
+ queue_fix(queue);
+ }
+}
+
+bool perform_ins_del(QUEUE *queue, bool max_ind)
+{
+ uint i= 0, no_loops= tot_no_loops, j= tot_no_parts;
+ do
+ {
+ uint num_part= *(uint*)queue_top(queue);
+ uint part= num_part >> 22;
+ if (check_num(num_part))
+ return TRUE;
+ if (j++ >= no_loops)
+ {
+ calculate_end_next(part);
+ queue_remove(queue, (uint) 0);
+ }
+ else
+ {
+ calculate_next();
+ if (max_ind)
+ num_array[part]-= part;
+ else
+ num_array[part]+= part;
+ queue_top(queue)= (uchar*)&num_array[part];
+ queue_replaced(queue);
+ }
+ } while (++i < no_loops);
+ return FALSE;
+}
+
+bool do_test(uint no_parts, uint l_max_ind, bool l_fix_used)
+{
+ QUEUE queue;
+ bool result;
+ max_ind= l_max_ind;
+ fix_used= l_fix_used;
+ init_queue(&queue, no_parts, 0, max_ind, test_compare, NULL);
+ tot_no_parts= no_parts;
+ tot_no_loops= 1024;
+ perform_insert(&queue);
+ if ((result= perform_ins_del(&queue, max_ind)))
+ delete_queue(&queue);
+ if (result)
+ {
+ printf("Error\n");
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void start_measurement()
+{
+ start_time= my_getsystime();
+}
+
+static void stop_measurement()
+{
+ ulonglong stop_time= my_getsystime();
+ uint time_in_micros;
+ stop_time-= start_time;
+ stop_time/= 10; /* Convert to microseconds */
+ time_in_micros= (uint)stop_time;
+ printf("Time expired is %u microseconds \n", time_in_micros);
+}
+
+static void benchmark_test()
+{
+ QUEUE queue_real;
+ QUEUE *queue= &queue_real;
+ uint i, add;
+ fix_used= TRUE;
+ max_ind= FALSE;
+ tot_no_parts= 1024;
+ init_queue(queue, tot_no_parts, 0, max_ind, test_compare, NULL);
+ /*
+ First benchmark whether queue_fix is faster than using queue_insert
+ for sizes of 16 partitions.
+ */
+ for (tot_no_parts= 2, add=2; tot_no_parts < 128;
+ tot_no_parts+= add, add++)
+ {
+ printf("Start benchmark queue_fix, tot_no_parts= %u \n", tot_no_parts);
+ start_measurement();
+ for (i= 0; i < 128; i++)
+ {
+ perform_insert(queue);
+ queue_remove_all(queue);
+ }
+ stop_measurement();
+
+ fix_used= FALSE;
+ printf("Start benchmark queue_insert\n");
+ start_measurement();
+ for (i= 0; i < 128; i++)
+ {
+ perform_insert(queue);
+ queue_remove_all(queue);
+ }
+ stop_measurement();
+ }
+ /*
+ Now benchmark insertion and deletion of 16400 elements.
+ Used in consecutive runs this shows whether the optimised _downheap
+ is faster than the standard implementation.
+ */
+ printf("Start benchmarking _downheap \n");
+ start_measurement();
+ perform_insert(queue);
+ for (i= 0; i < 65536; i++)
+ {
+ uint num, part;
+ num= *(uint*)queue_top(queue);
+ num+= 16;
+ part= num >> 22;
+ num_array[part]= num;
+ queue_top(queue)= (uchar*)&num_array[part];
+ queue_replaced(queue);
+ }
+ for (i= 0; i < 16; i++)
+ queue_remove(queue, (uint) 0);
+ queue_remove_all(queue);
+ stop_measurement();
+}
+
+int main()
+{
+ int i, add= 1;
+ for (i= 1; i < 1024; i+=add, add++)
+ {
+ printf("Start test for priority queue of size %u\n", i);
+ if (do_test(i, 0, 1))
+ return -1;
+ if (do_test(i, 1, 1))
+ return -1;
+ if (do_test(i, 0, 0))
+ return -1;
+ if (do_test(i, 1, 0))
+ return -1;
+ }
+ benchmark_test();
+ printf("OK\n");
+ return 0;
+}
+#endif
diff -Nrup a/mysys/test_charset.c b/mysys/test_charset.c
--- a/mysys/test_charset.c 2007-08-15 06:42:54 -07:00
+++ /dev/null Wed Dec 31 16:00:00 196900
@@ -1,91 +0,0 @@
-/* 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; version 2 of the License.
-
- 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_ctype.h>
-#include <my_sys.h>
-#include <mysql_version.h>
-
-#include <stdio.h>
-
-static void _print_array(uint8 *data, uint size)
-{
- uint i;
- for (i = 0; i < size; ++i)
- {
- if (i == 0 || i % 16 == size % 16) printf(" ");
- printf(" %02x", data[i]);
- if ((i+1) % 16 == size % 16) printf("\n");
- }
-}
-
-static void _print_csinfo(CHARSET_INFO *cs)
-{
- printf("%s #%d\n", cs->name, cs->number);
- printf("ctype:\n"); _print_array(cs->ctype, 257);
- printf("to_lower:\n"); _print_array(cs->to_lower, 256);
- printf("to_upper:\n"); _print_array(cs->to_upper, 256);
- printf("sort_order:\n"); _print_array(cs->sort_order, 256);
- printf("collate: %3s (%d, %p, %p, %p)\n",
- cs->strxfrm_multiply ? "yes" : "no",
- cs->strxfrm_multiply,
- cs->strnncoll,
- cs->strnxfrm,
- cs->like_range);
- printf("multi-byte: %3s (%d, %p, %p, %p)\n",
- cs->mbmaxlen > 1 ? "yes" : "no",
- cs->mbmaxlen,
- cs->ismbchar,
- cs->ismbhead,
- cs->mbcharlen);
-}
-
-
-int main(int argc, char **argv) {
- const char *the_set = MYSQL_CHARSET;
- char *cs_list;
- int argcnt = 1;
- CHARSET_INFO *cs;
-
- my_init();
-
- if (argc > argcnt && argv[argcnt][0] == '-' && argv[argcnt][1] ==
'#')
- DBUG_PUSH(argv[argcnt++]+2);
-
- if (argc > argcnt)
- the_set = argv[argcnt++];
-
- if (argc > argcnt)
- charsets_dir = argv[argcnt++];
-
- if (!(cs= get_charset_by_name(the_set, MYF(MY_WME))))
- return 1;
-
- puts("CHARSET INFO:");
- _print_csinfo(cs);
- fflush(stdout);
-
-#ifdef NOT_USED_ANYMORE
- cs_list = list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
- printf("LIST OF CHARSETS (compiled + *.conf):\n%s\n", cs_list);
- my_free(cs_list,MYF(0));
-
- cs_list = list_charsets(MYF(MY_CS_INDEX | MY_CS_LOADED));
- printf("LIST OF CHARSETS (index + loaded):\n%s\n", cs_list);
- my_free(cs_list,MYF(0));
-#endif
-
- return 0;
-}
diff -Nrup a/mysys/test_dir.c b/mysys/test_dir.c
--- a/mysys/test_dir.c 2006-12-23 11:19:47 -08:00
+++ /dev/null Wed Dec 31 16:00:00 196900
@@ -1,47 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-/* TODO: Test all functions */
-
-#include "mysys_priv.h"
-#include "my_dir.h"
-
-int main(int argc, char *argv[])
-{
- MY_DIR *a;
- uint f;
- DBUG_ENTER ("main");
- DBUG_PROCESS (argv[0]);
-
- if (--argc > 0 && (*(++argv))[0] == '-' && (*argv)[1] == '#' )
- DBUG_PUSH (*argv+2);
-
- a = my_dir("./", 0);
- for (f = 0; f < a->number_off_files; f++)
- {
- printf("%s\n", a->dir_entry[f].name);
- }
-
- a = my_dir("./", MY_WANT_STAT);
- for (f = 0; f < a->number_off_files; f++)
- {
- printf("%s %d %d %d %s\n", a->dir_entry[f].name,
- (int) a->dir_entry[f].mystat.st_size,
- (int) a->dir_entry[f].mystat.st_uid,
- (int) a->dir_entry[f].mystat.st_gid,
- S_ISDIR(a->dir_entry[f].mystat.st_mode) ? "dir" : "");
- }
- return 0;
-}
diff -Nrup a/mysys/testhash.c b/mysys/testhash.c
--- a/mysys/testhash.c 2007-05-10 02:59:26 -07:00
+++ /dev/null Wed Dec 31 16:00:00 196900
@@ -1,290 +0,0 @@
-/* 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; version 2 of the License.
-
- 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 */
-
-/* Test of hash library: big test */
-
-#include <my_global.h>
-#include <my_sys.h>
-#include <hash.h>
-#include <m_string.h>
-
-#define MAX_RECORDS 100000
-#define MAX_KEYS 3
-
-static int get_options(int argc, char *argv[]);
-static int do_test();
-static int rnd(int max_value);
-
-static uint testflag=0,recant=10000,reclength=37;
-static uint16 key1[1000];
-
-#ifdef DBUG_OFF
-#define hash_check(A) 0
-#else
-my_bool hash_check(HASH *hash);
-#endif
-
-void free_record(void *record);
-
-static uchar *hash2_key(const uchar *rec,uint *length,
- my_bool not_used __attribute__((unused)))
-{
- *length=(uint) (uchar) rec[reclength-1];
- return (uchar*) rec;
-}
-
-/* main program */
-
-int main(int argc,char *argv[])
-{
- MY_INIT(argv[0]);
- DBUG_PROCESS(argv[0]);
-
- get_options(argc,argv);
-
- exit(do_test());
-}
-
-static int do_test()
-{
- register uint i,j;
- uint n1,n2,n3;
- uint write_count,update,delete;
- ulong pos;
- unsigned long key_check;
- char *record,*recpos,oldrecord[120],key[10];
- HASH hash,hash2;
- DBUG_ENTER("do_test");
-
- write_count=update=delete=0;
- key_check=0;
- bzero((char*) key1,sizeof(key1[0])*1000);
-
- printf("- Creating hash\n");
- if (hash_init(&hash, default_charset_info, recant/2, 0, 6, 0, free_record, 0))
- goto err;
- printf("- Writing records:\n");
-
- for (i=0 ; i < recant ; i++)
- {
- n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*5,MAX_RECORDS));
- record= (char*) my_malloc(reclength,MYF(MY_FAE));
- sprintf(record,"%6d:%4d:%8d:Pos: %4d ",n1,n2,n3,write_count);
- if (my_hash_insert(&hash,record))
- {
- printf("Error: %d in write at record: %d\n",my_errno,i);
- goto err;
- }
- key1[n1]++;
- key_check+=n1;
- write_count++;
- }
- if (hash_check(&hash))
- {
- puts("Heap keys crashed");
- goto err;
- }
- printf("- Delete\n");
- for (i=0 ; i < write_count/10 ; i++)
- {
- for (j=rnd(1000) ; j>0 && key1[j] == 0 ; j--) ;
- if (j != 0)
- {
- sprintf(key,"%6d",j);
- if (!(recpos=hash_search(&hash,key,0)))
- {
- printf("can't find key1: \"%s\"\n",key);
- goto err;
- }
- key1[atoi(recpos)]--;
- key_check-=atoi(recpos);
- memcpy(oldrecord,recpos,reclength);
- if (hash_delete(&hash,recpos))
- {
- printf("error: %d; can't delete record: \"%s\"\n", my_errno,oldrecord);
- goto err;
- }
- delete++;
- if (testflag == 2 && hash_check(&hash))
- {
- puts("Heap keys crashed");
- goto err;
- }
- }
- }
- if (hash_check(&hash))
- {
- puts("Hash keys crashed");
- goto err;
- }
-
- printf("- Update\n");
- for (i=0 ; i < write_count/10 ; i++)
- {
- n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*2,MAX_RECORDS));
- for (j=rnd(1000) ; j>0 && key1[j] == 0 ; j--) ;
- if (j)
- {
- sprintf(key,"%6d",j);
- if (!(recpos=hash_search(&hash,key,0)))
- {
- printf("can't find key1: \"%s\"\n",key);
- goto err;
- }
- key1[atoi(recpos)]--;
- key_check=key_check-atoi(recpos)+n1;
- key1[n1]++;
- sprintf(recpos,"%6d:%4d:%8d:XXX: %4d ",n1,n2,n3,update);
- update++;
- if (hash_update(&hash,recpos,key,0))
- {
- printf("can't update key1: \"%s\"\n",key);
- goto err;
- }
- if (testflag == 3 && hash_check(&hash))
- {
- printf("Heap keys crashed for %d update\n",update);
- goto err;
- }
- }
- }
- if (hash_check(&hash))
- {
- puts("Heap keys crashed");
- goto err;
- }
-
- for (j=0 ; j < 1000 ; j++)
- if (key1[j] > 1)
- break;
- if (key1[j] > 1)
- {
- HASH_SEARCH_STATE state;
- printf("- Testing identical read\n");
- sprintf(key,"%6d",j);
- pos=1;
- if (!(recpos= hash_first(&hash, key, 0, &state)))
- {
- printf("can't find key1: \"%s\"\n",key);
- goto err;
- }
- while (hash_next(&hash, key, 0, &state) && pos < (ulong)
(key1[j]+10))
- pos++;
- if (pos != (ulong) key1[j])
- {
- printf("Found %ld copies of key: %s. Should be %d",pos,key,key1[j]);
- goto err;
- }
- }
- printf("- Creating output heap-file 2\n");
- if (hash_init(&hash2, default_charset_info, hash.records, 0, 0, hash2_key,
free_record,0))
- goto err;
-
- printf("- Copying and removing records\n");
- pos=0;
- while ((recpos=hash_element(&hash,0)))
- {
- record=(uchar*) my_malloc(reclength,MYF(MY_FAE));
- memcpy(record,recpos,reclength);
- record[reclength-1]=rnd(5)+1;
- if (my_hash_insert(&hash2,record))
- {
- printf("Got error when inserting record: %*s",reclength,record);
- goto err;
- }
- key_check-=atoi(record);
- write_count++;
- if (hash_delete(&hash,recpos))
- {
- printf("Got error when deleting record: %*s",reclength,recpos);
- goto err;
- }
- if (testflag==4)
- {
- if (hash_check(&hash) || hash_check(&hash2))
- {
- puts("Hash keys crashed");
- goto err;
- }
- }
- pos++;
- }
- if (hash_check(&hash) || hash_check(&hash2))
- {
- puts("Hash keys crashed");
- goto err;
- }
- if (key_check != 0)
- {
- printf("Key check didn't get to 0 (%ld)\n",key_check);
- }
-
- printf("\nFollowing test have been made:\n");
- printf("Write records: %d\nUpdate records: %d\nDelete records: %d\n", write_count,
- update,delete);
- hash_free(&hash); hash_free(&hash2);
- my_end(MY_GIVE_INFO);
- DBUG_RETURN(0);
-err:
- printf("Got error: %d when using hashing\n",my_errno);
- DBUG_RETURN(-1);
-} /* main */
-
-
-/* read options */
-/* NOTE! DBUG not initialised - no debugging here! */
-
-static int get_options(int argc, char **argv)
-{
- char *pos,*progname;
-
- progname= argv[0];
-
- while (--argc >0 && *(pos = *(++argv)) == '-' ) {
- switch(*++pos) {
- case 'm': /* records */
- recant=atoi(++pos);
- break;
- case 't':
- testflag=atoi(++pos); /* testmod */
- break;
- case 'V':
- case 'I':
- case '?':
- printf("%s Ver 1.0 for %s at %s\n",progname,SYSTEM_TYPE,MACHINE_TYPE);
- printf("MySQL AB, by Monty\n\n");
- printf("Usage: %s [-?ABIKLWv] [-m#] [-t#]\n",progname);
- exit(0);
- case '#':
- DBUG_PUSH (++pos);
- break;
- }
- }
- return 0;
-} /* get_options */
-
-
-/* Get a random number in the interval 0 <= x <= n */
-
-static int rnd(int max_value)
-{
- return (int) ((rand() & 32767)/32767.0*max_value);
-} /* rnd */
-
-
-void free_record(void *record)
-{
- my_free(record,MYF(0));
-}
diff -Nrup a/mysys/tests/Makefile.am b/mysys/tests/Makefile.am
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/mysys/tests/Makefile.am 2008-04-23 13:04:28 -07:00
@@ -0,0 +1,52 @@
+# Copyright (C) 2000-2006 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; version 2 of the License.
+#
+# 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
+
+MYSQLDATAdir = $(localstatedir)
+MYSQLSHAREdir = $(pkgdatadir)
+MYSQLBASEdir= $(prefix)
+INCLUDES = @ZLIB_INCLUDES@ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include -I$(srcdir) \
+ -I$(top_srcdir)/mysys
+LDADD = $(top_builddir)/mysys/libmysys.la $(top_builddir)/strings/libmystrings.la
$(top_builddir)/dbug/libdbug.la
+
+DEFS = -DMAIN \
+ -DDEFAULT_BASEDIR=\"$(prefix)\" \
+ -DDATADIR="\"$(MYSQLDATAdir)\"" \
+ -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
+ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
+ -DDEFAULT_HOME_ENV=MYSQL_HOME \
+ -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
+ -DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
+ @DEFS@
+
+# I hope this always does the right thing. Otherwise this is only test programs
+FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
+
+noinst_PROGRAMS = test_bitmap test_priority_queue test_thr_alarm test_thr_lock
test_vsnprintf test_io_cache testhash test_gethwaddr test_base64 #test_charset
+test_bitmap_SOURCES = $(top_srcdir)/mysys/my_bitmap.cc
+test_thr_alarm_SOURCES = $(top_srcdir)/mysys/thr_alarm.c
+test_priority_queue_SOURCES = $(top_srcdir)/mysys/queues.cc
+test_thr_lock_SOURCES = $(top_srcdir)/mysys/thr_lock.c
+test_vsnprintf_SOURCES = $(top_srcdir)/strings/my_vsnprintf.c
+test_io_cache_SOURCES = $(top_srcdir)/mysys/mf_iocache.c
+#test_dir_SOURCES = test_dir.c
+#test_charset_SOURCES = test_charset.c
+testhash_SOURCES = testhash.c
+test_gethwaddr_SOURCES = $(top_srcdir)/mysys/my_gethwaddr.c
+test_base64_SOURCES = $(top_srcdir)/mysys/base64.c
+test_base64_LDADD = @M_LIBS@ $(top_builddir)/mysys/libmysys.la
$(top_builddir)/strings/libmystrings.la
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff -Nrup a/mysys/tests/test_charset.c b/mysys/tests/test_charset.c
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/mysys/tests/test_charset.c 2008-04-23 13:03:24 -07:00
@@ -0,0 +1,91 @@
+/* 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; version 2 of the License.
+
+ 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_ctype.h>
+#include <my_sys.h>
+#include <mysql_version.h>
+
+#include <stdio.h>
+
+static void _print_array(uint8 *data, uint size)
+{
+ uint i;
+ for (i = 0; i < size; ++i)
+ {
+ if (i == 0 || i % 16 == size % 16) printf(" ");
+ printf(" %02x", data[i]);
+ if ((i+1) % 16 == size % 16) printf("\n");
+ }
+}
+
+static void _print_csinfo(CHARSET_INFO *cs)
+{
+ printf("%s #%d\n", cs->name, cs->number);
+ printf("ctype:\n"); _print_array(cs->ctype, 257);
+ printf("to_lower:\n"); _print_array(cs->to_lower, 256);
+ printf("to_upper:\n"); _print_array(cs->to_upper, 256);
+ printf("sort_order:\n"); _print_array(cs->sort_order, 256);
+ printf("collate: %3s (%d, %p, %p, %p)\n",
+ cs->strxfrm_multiply ? "yes" : "no",
+ cs->strxfrm_multiply,
+ cs->strnncoll,
+ cs->strnxfrm,
+ cs->like_range);
+ printf("multi-byte: %3s (%d, %p, %p, %p)\n",
+ cs->mbmaxlen > 1 ? "yes" : "no",
+ cs->mbmaxlen,
+ cs->ismbchar,
+ cs->ismbhead,
+ cs->mbcharlen);
+}
+
+
+int main(int argc, char **argv) {
+ const char *the_set = MYSQL_CHARSET;
+ char *cs_list;
+ int argcnt = 1;
+ CHARSET_INFO *cs;
+
+ my_init();
+
+ if (argc > argcnt && argv[argcnt][0] == '-' && argv[argcnt][1] ==
'#')
+ DBUG_PUSH(argv[argcnt++]+2);
+
+ if (argc > argcnt)
+ the_set = argv[argcnt++];
+
+ if (argc > argcnt)
+ charsets_dir = argv[argcnt++];
+
+ if (!(cs= get_charset_by_name(the_set, MYF(MY_WME))))
+ return 1;
+
+ puts("CHARSET INFO:");
+ _print_csinfo(cs);
+ fflush(stdout);
+
+#ifdef NOT_USED_ANYMORE
+ cs_list = list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
+ printf("LIST OF CHARSETS (compiled + *.conf):\n%s\n", cs_list);
+ my_free(cs_list,MYF(0));
+
+ cs_list = list_charsets(MYF(MY_CS_INDEX | MY_CS_LOADED));
+ printf("LIST OF CHARSETS (index + loaded):\n%s\n", cs_list);
+ my_free(cs_list,MYF(0));
+#endif
+
+ return 0;
+}
diff -Nrup a/mysys/tests/test_dir.c b/mysys/tests/test_dir.c
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/mysys/tests/test_dir.c 2008-04-23 13:03:25 -07:00
@@ -0,0 +1,47 @@
+/* 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; version 2 of the License.
+
+ 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 */
+
+/* TODO: Test all functions */
+
+#include "mysys_priv.h"
+#include "my_dir.h"
+
+int main(int argc, char *argv[])
+{
+ MY_DIR *a;
+ uint f;
+ DBUG_ENTER ("main");
+ DBUG_PROCESS (argv[0]);
+
+ if (--argc > 0 && (*(++argv))[0] == '-' && (*argv)[1] == '#' )
+ DBUG_PUSH (*argv+2);
+
+ a = my_dir("./", 0);
+ for (f = 0; f < a->number_off_files; f++)
+ {
+ printf("%s\n", a->dir_entry[f].name);
+ }
+
+ a = my_dir("./", MY_WANT_STAT);
+ for (f = 0; f < a->number_off_files; f++)
+ {
+ printf("%s %d %d %d %s\n", a->dir_entry[f].name,
+ (int) a->dir_entry[f].mystat.st_size,
+ (int) a->dir_entry[f].mystat.st_uid,
+ (int) a->dir_entry[f].mystat.st_gid,
+ S_ISDIR(a->dir_entry[f].mystat.st_mode) ? "dir" : "");
+ }
+ return 0;
+}
diff -Nrup a/mysys/tests/testhash.c b/mysys/tests/testhash.c
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/mysys/tests/testhash.c 2008-04-23 13:03:26 -07:00
@@ -0,0 +1,290 @@
+/* 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; version 2 of the License.
+
+ 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 */
+
+/* Test of hash library: big test */
+
+#include <my_global.h>
+#include <my_sys.h>
+#include <hash.h>
+#include <m_string.h>
+
+#define MAX_RECORDS 100000
+#define MAX_KEYS 3
+
+static int get_options(int argc, char *argv[]);
+static int do_test();
+static int rnd(int max_value);
+
+static uint testflag=0,recant=10000,reclength=37;
+static uint16 key1[1000];
+
+#ifdef DBUG_OFF
+#define hash_check(A) 0
+#else
+my_bool hash_check(HASH *hash);
+#endif
+
+void free_record(void *record);
+
+static uchar *hash2_key(const uchar *rec,uint *length,
+ my_bool not_used __attribute__((unused)))
+{
+ *length=(uint) (uchar) rec[reclength-1];
+ return (uchar*) rec;
+}
+
+/* main program */
+
+int main(int argc,char *argv[])
+{
+ MY_INIT(argv[0]);
+ DBUG_PROCESS(argv[0]);
+
+ get_options(argc,argv);
+
+ exit(do_test());
+}
+
+static int do_test()
+{
+ register uint i,j;
+ uint n1,n2,n3;
+ uint write_count,update,delete;
+ ulong pos;
+ unsigned long key_check;
+ char *record,*recpos,oldrecord[120],key[10];
+ HASH hash,hash2;
+ DBUG_ENTER("do_test");
+
+ write_count=update=delete=0;
+ key_check=0;
+ bzero((char*) key1,sizeof(key1[0])*1000);
+
+ printf("- Creating hash\n");
+ if (hash_init(&hash, default_charset_info, recant/2, 0, 6, 0, free_record, 0))
+ goto err;
+ printf("- Writing records:\n");
+
+ for (i=0 ; i < recant ; i++)
+ {
+ n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*5,MAX_RECORDS));
+ record= (char*) my_malloc(reclength,MYF(MY_FAE));
+ sprintf(record,"%6d:%4d:%8d:Pos: %4d ",n1,n2,n3,write_count);
+ if (my_hash_insert(&hash,record))
+ {
+ printf("Error: %d in write at record: %d\n",my_errno,i);
+ goto err;
+ }
+ key1[n1]++;
+ key_check+=n1;
+ write_count++;
+ }
+ if (hash_check(&hash))
+ {
+ puts("Heap keys crashed");
+ goto err;
+ }
+ printf("- Delete\n");
+ for (i=0 ; i < write_count/10 ; i++)
+ {
+ for (j=rnd(1000) ; j>0 && key1[j] == 0 ; j--) ;
+ if (j != 0)
+ {
+ sprintf(key,"%6d",j);
+ if (!(recpos=hash_search(&hash,key,0)))
+ {
+ printf("can't find key1: \"%s\"\n",key);
+ goto err;
+ }
+ key1[atoi(recpos)]--;
+ key_check-=atoi(recpos);
+ memcpy(oldrecord,recpos,reclength);
+ if (hash_delete(&hash,recpos))
+ {
+ printf("error: %d; can't delete record: \"%s\"\n", my_errno,oldrecord);
+ goto err;
+ }
+ delete++;
+ if (testflag == 2 && hash_check(&hash))
+ {
+ puts("Heap keys crashed");
+ goto err;
+ }
+ }
+ }
+ if (hash_check(&hash))
+ {
+ puts("Hash keys crashed");
+ goto err;
+ }
+
+ printf("- Update\n");
+ for (i=0 ; i < write_count/10 ; i++)
+ {
+ n1=rnd(1000); n2=rnd(100); n3=rnd(min(recant*2,MAX_RECORDS));
+ for (j=rnd(1000) ; j>0 && key1[j] == 0 ; j--) ;
+ if (j)
+ {
+ sprintf(key,"%6d",j);
+ if (!(recpos=hash_search(&hash,key,0)))
+ {
+ printf("can't find key1: \"%s\"\n",key);
+ goto err;
+ }
+ key1[atoi(recpos)]--;
+ key_check=key_check-atoi(recpos)+n1;
+ key1[n1]++;
+ sprintf(recpos,"%6d:%4d:%8d:XXX: %4d ",n1,n2,n3,update);
+ update++;
+ if (hash_update(&hash,recpos,key,0))
+ {
+ printf("can't update key1: \"%s\"\n",key);
+ goto err;
+ }
+ if (testflag == 3 && hash_check(&hash))
+ {
+ printf("Heap keys crashed for %d update\n",update);
+ goto err;
+ }
+ }
+ }
+ if (hash_check(&hash))
+ {
+ puts("Heap keys crashed");
+ goto err;
+ }
+
+ for (j=0 ; j < 1000 ; j++)
+ if (key1[j] > 1)
+ break;
+ if (key1[j] > 1)
+ {
+ HASH_SEARCH_STATE state;
+ printf("- Testing identical read\n");
+ sprintf(key,"%6d",j);
+ pos=1;
+ if (!(recpos= hash_first(&hash, key, 0, &state)))
+ {
+ printf("can't find key1: \"%s\"\n",key);
+ goto err;
+ }
+ while (hash_next(&hash, key, 0, &state) && pos < (ulong)
(key1[j]+10))
+ pos++;
+ if (pos != (ulong) key1[j])
+ {
+ printf("Found %ld copies of key: %s. Should be %d",pos,key,key1[j]);
+ goto err;
+ }
+ }
+ printf("- Creating output heap-file 2\n");
+ if (hash_init(&hash2, default_charset_info, hash.records, 0, 0, hash2_key,
free_record,0))
+ goto err;
+
+ printf("- Copying and removing records\n");
+ pos=0;
+ while ((recpos=hash_element(&hash,0)))
+ {
+ record=(uchar*) my_malloc(reclength,MYF(MY_FAE));
+ memcpy(record,recpos,reclength);
+ record[reclength-1]=rnd(5)+1;
+ if (my_hash_insert(&hash2,record))
+ {
+ printf("Got error when inserting record: %*s",reclength,record);
+ goto err;
+ }
+ key_check-=atoi(record);
+ write_count++;
+ if (hash_delete(&hash,recpos))
+ {
+ printf("Got error when deleting record: %*s",reclength,recpos);
+ goto err;
+ }
+ if (testflag==4)
+ {
+ if (hash_check(&hash) || hash_check(&hash2))
+ {
+ puts("Hash keys crashed");
+ goto err;
+ }
+ }
+ pos++;
+ }
+ if (hash_check(&hash) || hash_check(&hash2))
+ {
+ puts("Hash keys crashed");
+ goto err;
+ }
+ if (key_check != 0)
+ {
+ printf("Key check didn't get to 0 (%ld)\n",key_check);
+ }
+
+ printf("\nFollowing test have been made:\n");
+ printf("Write records: %d\nUpdate records: %d\nDelete records: %d\n", write_count,
+ update,delete);
+ hash_free(&hash); hash_free(&hash2);
+ my_end(MY_GIVE_INFO);
+ DBUG_RETURN(0);
+err:
+ printf("Got error: %d when using hashing\n",my_errno);
+ DBUG_RETURN(-1);
+} /* main */
+
+
+/* read options */
+/* NOTE! DBUG not initialised - no debugging here! */
+
+static int get_options(int argc, char **argv)
+{
+ char *pos,*progname;
+
+ progname= argv[0];
+
+ while (--argc >0 && *(pos = *(++argv)) == '-' ) {
+ switch(*++pos) {
+ case 'm': /* records */
+ recant=atoi(++pos);
+ break;
+ case 't':
+ testflag=atoi(++pos); /* testmod */
+ break;
+ case 'V':
+ case 'I':
+ case '?':
+ printf("%s Ver 1.0 for %s at %s\n",progname,SYSTEM_TYPE,MACHINE_TYPE);
+ printf("MySQL AB, by Monty\n\n");
+ printf("Usage: %s [-?ABIKLWv] [-m#] [-t#]\n",progname);
+ exit(0);
+ case '#':
+ DBUG_PUSH (++pos);
+ break;
+ }
+ }
+ return 0;
+} /* get_options */
+
+
+/* Get a random number in the interval 0 <= x <= n */
+
+static int rnd(int max_value)
+{
+ return (int) ((rand() & 32767)/32767.0*max_value);
+} /* rnd */
+
+
+void free_record(void *record)
+{
+ my_free(record,MYF(0));
+}
diff -Nrup a/netware/Makefile.am b/netware/Makefile.am
--- a/netware/Makefile.am 2007-10-30 12:06:46 -07:00
+++ b/netware/Makefile.am 2008-04-23 13:04:24 -07:00
@@ -16,14 +16,16 @@
if HAVE_NETWARE
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
-LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
- ../dbug/libdbug.a ../strings/libmystrings.a
+LDADD = @CLIENT_EXTRA_LDFLAGS@ \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la
bin_PROGRAMS = mysqld_safe mysql_install_db mysql_test_run libmysql
mysqld_safe_SOURCES= mysqld_safe.c my_manage.c
mysql_install_db_SOURCES= mysql_install_db.c my_manage.c
mysql_test_run_SOURCES= mysql_test_run.c my_manage.c
libmysql_SOURCES= libmysqlmain.c
-libmysql_LDADD = ../libmysql/.libs/libmysqlclient.a \
+libmysql_LDADD = $(top_builddir)/libmysql/.libs/libmysqlclient.a \
@openssl_libs@ @yassl_libs@
netware_build_files = client/mysql.def client/mysqladmin.def \
diff -Nrup a/regex/Makefile.am b/regex/Makefile.am
--- a/regex/Makefile.am 2006-12-30 16:06:33 -08:00
+++ b/regex/Makefile.am 2008-04-23 13:04:24 -07:00
@@ -17,7 +17,7 @@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
noinst_LIBRARIES = libregex.a
-LDADD= libregex.a $(top_builddir)/strings/libmystrings.a
+LDADD= libregex.a $(top_builddir)/strings/libmystrings.la
noinst_HEADERS = cclass.h cname.h regex2.h utils.h engine.c my_regex.h
libregex_a_SOURCES = regerror.c regcomp.c regexec.c regfree.c reginit.c
noinst_PROGRAMS = re
diff -Nrup a/server-tools/instance-manager/Makefile.am
b/server-tools/instance-manager/Makefile.am
--- a/server-tools/instance-manager/Makefile.am 2007-02-18 04:45:24 -08:00
+++ b/server-tools/instance-manager/Makefile.am 2008-04-23 13:04:25 -07:00
@@ -88,9 +88,9 @@ mysqlmanager_LDADD= @CLIENT_EXTRA_LDFLAG
liboptions.la \
libnet.a \
$(top_builddir)/vio/libvio.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a \
- $(top_builddir)/dbug/libdbug.a \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la \
+ $(top_builddir)/dbug/libdbug.la \
@openssl_libs@ @yassl_libs@ @ZLIB_LIBS@
EXTRA_DIST = WindowsService.cpp WindowsService.h IMService.cpp \
diff -Nrup a/sql/Makefile.am b/sql/Makefile.am
--- a/sql/Makefile.am 2008-04-08 01:29:05 -07:00
+++ b/sql/Makefile.am 2008-04-23 13:04:25 -07:00
@@ -33,16 +33,17 @@ noinst_LTLIBRARIES= libndb.la \
udf_example.la
SUPPORTING_LIBS = $(top_builddir)/vio/libvio.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
$(top_builddir)/regex/libregex.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/strings/libmystrings.la
mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS) libndb.la
LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@
mysqld_LDADD = libndb.la \
@MYSQLD_EXTRA_LDFLAGS@ \
@pstack_libs@ \
@mysql_plugin_libs@ \
+ @CRYPT_LIBS@ \
$(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \
$(yassl_libs) $(openssl_libs) @MYSQLD_EXTRA_LIBS@
diff -Nrup a/storage/archive/Makefile.am b/storage/archive/Makefile.am
--- a/storage/archive/Makefile.am 2008-01-02 05:00:42 -08:00
+++ b/storage/archive/Makefile.am 2008-04-23 13:04:25 -07:00
@@ -50,17 +50,17 @@ libarchive_a_SOURCES = ha_archive.cc azi
archive_test_SOURCES = archive_test.c azio.c
archive_test_CFLAGS = $(AM_CFLAGS)
-archive_test_LDADD = $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a \
+archive_test_LDADD = $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la \
@ZLIB_LIBS@
archive_test_LDFLAGS = @NOINST_LDFLAGS@
archive_reader_SOURCES = archive_reader.c azio.c
archive_reader_CFLAGS = $(AM_CFLAGS)
-archive_reader_LDADD = $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a \
+archive_reader_LDADD = $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la \
@ZLIB_LIBS@
archive_reader_LDFLAGS = @NOINST_LDFLAGS@
diff -Nrup a/storage/heap/Makefile.am b/storage/heap/Makefile.am
--- a/storage/heap/Makefile.am 2006-12-30 16:06:38 -08:00
+++ b/storage/heap/Makefile.am 2008-04-23 13:04:25 -07:00
@@ -31,14 +31,14 @@ noinst_PROGRAMS = hp_test1 hp_test2
noinst_LIBRARIES = libheap.a
hp_test1_LDFLAGS = @NOINST_LDFLAGS@
hp_test1_LDADD = libheap.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la
hp_test2_LDFLAGS = @NOINST_LDFLAGS@
hp_test2_LDADD = libheap.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la
noinst_HEADERS = heapdef.h ha_heap.h
libheap_a_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \
hp_rrnd.c hp_scan.c hp_update.c hp_write.c hp_delete.c \
diff -Nrup a/storage/myisam/Makefile.am b/storage/myisam/Makefile.am
--- a/storage/myisam/Makefile.am 2006-12-30 16:06:39 -08:00
+++ b/storage/myisam/Makefile.am 2008-04-23 13:04:25 -07:00
@@ -34,55 +34,55 @@ pkglib_LIBRARIES = libmyisam.a
bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump
myisamchk_DEPENDENCIES= $(LIBRARIES)
myisamchk_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la @ZLIB_LIBS@ @M_LIBS@
myisamlog_DEPENDENCIES= $(LIBRARIES)
myisamlog_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la @ZLIB_LIBS@ @M_LIBS@
myisampack_DEPENDENCIES=$(LIBRARIES)
myisampack_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la @ZLIB_LIBS@ @M_LIBS@
noinst_PROGRAMS = mi_test1 mi_test2 mi_test3 rt_test sp_test #ft_test1 ft_eval
noinst_HEADERS = myisamdef.h rt_index.h rt_key.h rt_mbr.h sp_defs.h \
fulltext.h ftdefs.h ft_test1.h ft_eval.h \
ha_myisam.h
mi_test1_DEPENDENCIES= $(LIBRARIES)
mi_test1_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la @ZLIB_LIBS@ @M_LIBS@
mi_test2_DEPENDENCIES= $(LIBRARIES)
mi_test2_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la @ZLIB_LIBS@ @M_LIBS@
mi_test3_DEPENDENCIES= $(LIBRARIES)
mi_test3_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la @ZLIB_LIBS@ @M_LIBS@
#ft_test1_DEPENDENCIES= $(LIBRARIES)
#ft_eval_DEPENDENCIES= $(LIBRARIES)
myisam_ftdump_DEPENDENCIES= $(LIBRARIES)
myisam_ftdump_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la @ZLIB_LIBS@ @M_LIBS@
rt_test_DEPENDENCIES= $(LIBRARIES)
rt_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la @ZLIB_LIBS@ @M_LIBS@
sp_test_DEPENDENCIES= $(LIBRARIES)
sp_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la @ZLIB_LIBS@ @M_LIBS@
libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \
mi_rnext.c mi_rnext_same.c \
mi_search.c mi_page.c mi_key.c mi_locking.c \
diff -Nrup a/storage/ndb/config/type_ndbapitest.mk.am
b/storage/ndb/config/type_ndbapitest.mk.am
--- a/storage/ndb/config/type_ndbapitest.mk.am 2006-12-30 16:06:41 -08:00
+++ b/storage/ndb/config/type_ndbapitest.mk.am 2008-04-23 13:04:25 -07:00
@@ -15,9 +15,9 @@
LDADD += $(top_builddir)/storage/ndb/test/src/libNDBT.a \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la @NDB_SCI_LIBS@
INCLUDES += -I$(top_srcdir) \
-I$(top_builddir)/include \
diff -Nrup a/storage/ndb/config/type_ndbapitools.mk.am
b/storage/ndb/config/type_ndbapitools.mk.am
--- a/storage/ndb/config/type_ndbapitools.mk.am 2007-06-11 08:51:37 -07:00
+++ b/storage/ndb/config/type_ndbapitools.mk.am 2008-04-23 13:04:26 -07:00
@@ -15,9 +15,9 @@
LDADD += \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@ @ZLIB_LIBS@
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la @NDB_SCI_LIBS@ @ZLIB_LIBS@
INCLUDES += -I$(srcdir) \
-I$(top_builddir)/include \
diff -Nrup a/storage/ndb/src/Makefile.am b/storage/ndb/src/Makefile.am
--- a/storage/ndb/src/Makefile.am 2007-01-19 16:54:51 -08:00
+++ b/storage/ndb/src/Makefile.am 2008-04-23 13:04:26 -07:00
@@ -25,6 +25,9 @@ libndbclient_la_LDFLAGS = -version-info
libndbclient_la_LIBADD = \
ndbapi/libndbapi.la \
+ $(top_builddir)/strings/libmystrings.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
common/transporter/libtransporter.la \
common/debugger/libtrace.la \
common/debugger/signaldata/libsignaldataprint.la \
@@ -32,7 +35,7 @@ libndbclient_la_LIBADD = \
common/mgmcommon/libmgmsrvcommon.la \
common/logger/liblogger.la \
common/portlib/libportlib.la \
- common/util/libgeneral.la
+ common/util/libgeneral.la @ZLIB_LIBS@
windoze-dsp: libndbclient.dsp
diff -Nrup a/storage/ndb/src/common/util/Makefile.am
b/storage/ndb/src/common/util/Makefile.am
--- a/storage/ndb/src/common/util/Makefile.am 2008-04-22 12:36:00 -07:00
+++ b/storage/ndb/src/common/util/Makefile.am 2008-04-23 13:04:26 -07:00
@@ -31,9 +31,9 @@ EXTRA_PROGRAMS = testBitmask
testBitmask_SOURCES = testBitmask.cpp
testBitmask_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la
testBitmask.cpp : Bitmask.cpp
rm -f testBitmask.cpp
diff -Nrup a/storage/ndb/src/cw/cpcd/Makefile.am b/storage/ndb/src/cw/cpcd/Makefile.am
--- a/storage/ndb/src/cw/cpcd/Makefile.am 2007-02-12 17:38:47 -08:00
+++ b/storage/ndb/src/cw/cpcd/Makefile.am 2008-04-23 13:04:26 -07:00
@@ -19,9 +19,9 @@ ndb_cpcd_SOURCES = main.cpp CPCD.cpp Pro
LDADD_LOC = \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la @NDB_SCI_LIBS@
include $(top_srcdir)/storage/ndb/config/common.mk.am
include $(top_srcdir)/storage/ndb/config/type_util.mk.am
diff -Nrup a/storage/ndb/src/kernel/Makefile.am b/storage/ndb/src/kernel/Makefile.am
--- a/storage/ndb/src/kernel/Makefile.am 2006-12-30 16:26:56 -08:00
+++ b/storage/ndb/src/kernel/Makefile.am 2008-04-23 13:04:26 -07:00
@@ -53,9 +53,10 @@ LDADD += \
$(top_builddir)/storage/ndb/src/mgmapi/libmgmapi.la \
$(top_builddir)/storage/ndb/src/common/portlib/libportlib.la \
$(top_builddir)/storage/ndb/src/common/util/libgeneral.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la \
+ $(top_builddir)/zlib/libzlt.la @NDB_SCI_LIBS@
windoze-dsp: ndbd.dsp
diff -Nrup a/storage/ndb/src/kernel/blocks/Makefile.am
b/storage/ndb/src/kernel/blocks/Makefile.am
--- a/storage/ndb/src/kernel/blocks/Makefile.am 2006-12-30 16:06:42 -08:00
+++ b/storage/ndb/src/kernel/blocks/Makefile.am 2008-04-23 13:04:26 -07:00
@@ -57,9 +57,9 @@ EXTRA_PROGRAMS = ndb_print_file
ndb_print_file_SOURCES = print_file.cpp diskpage.cpp dbtup/tuppage.cpp
ndb_print_file_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la
include $(top_srcdir)/storage/ndb/config/common.mk.am
include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
diff -Nrup a/storage/ndb/src/kernel/blocks/backup/Makefile.am
b/storage/ndb/src/kernel/blocks/backup/Makefile.am
--- a/storage/ndb/src/kernel/blocks/backup/Makefile.am 2006-12-30 16:06:42 -08:00
+++ b/storage/ndb/src/kernel/blocks/backup/Makefile.am 2008-04-23 13:04:26 -07:00
@@ -17,9 +17,9 @@ ndbtools_PROGRAMS = ndb_print_backup_fil
ndb_print_backup_file_SOURCES = read.cpp
ndb_print_backup_file_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la
include $(top_srcdir)/storage/ndb/config/common.mk.am
include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
diff -Nrup a/storage/ndb/src/kernel/blocks/dbdict/Makefile.am
b/storage/ndb/src/kernel/blocks/dbdict/Makefile.am
--- a/storage/ndb/src/kernel/blocks/dbdict/Makefile.am 2006-12-30 16:28:02 -08:00
+++ b/storage/ndb/src/kernel/blocks/dbdict/Makefile.am 2008-04-23 13:04:27 -07:00
@@ -19,17 +19,17 @@ include $(top_srcdir)/storage/ndb/config
LDADD += \
$(top_builddir)/storage/ndb/src/common/util/libgeneral.la \
$(top_builddir)/storage/ndb/src/common/portlib/libportlib.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la
ndbtools_PROGRAMS = ndb_print_schema_file
ndb_print_schema_file_SOURCES = printSchemaFile.cpp
ndb_print_schema_file_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la
# Don't update the files from bitkeeper
%::SCCS/s.%
diff -Nrup a/storage/ndb/src/kernel/blocks/dbdih/Makefile.am
b/storage/ndb/src/kernel/blocks/dbdih/Makefile.am
--- a/storage/ndb/src/kernel/blocks/dbdih/Makefile.am 2006-12-30 16:29:35 -08:00
+++ b/storage/ndb/src/kernel/blocks/dbdih/Makefile.am 2008-04-23 13:04:27 -07:00
@@ -17,9 +17,9 @@ ndbtools_PROGRAMS = ndb_print_sys_file
ndb_print_sys_file_SOURCES = printSysfile.cpp
ndb_print_sys_file_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la
include $(top_srcdir)/storage/ndb/config/common.mk.am
diff -Nrup a/storage/ndb/src/kernel/blocks/dblqh/Makefile.am
b/storage/ndb/src/kernel/blocks/dblqh/Makefile.am
--- a/storage/ndb/src/kernel/blocks/dblqh/Makefile.am 2007-05-30 11:27:24 -07:00
+++ b/storage/ndb/src/kernel/blocks/dblqh/Makefile.am 2008-04-23 13:04:27 -07:00
@@ -23,9 +23,9 @@ include $(top_srcdir)/storage/ndb/config
ndbd_redo_log_reader_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la
# Don't update the files from bitkeeper
%::SCCS/s.%
diff -Nrup a/storage/ndb/src/kernel/blocks/dbtup/Makefile.am
b/storage/ndb/src/kernel/blocks/dbtup/Makefile.am
--- a/storage/ndb/src/kernel/blocks/dbtup/Makefile.am 2006-12-30 16:32:00 -08:00
+++ b/storage/ndb/src/kernel/blocks/dbtup/Makefile.am 2008-04-23 13:04:27 -07:00
@@ -20,9 +20,9 @@ EXTRA_PROGRAMS = test_varpage
test_varpage_SOURCES = test_varpage.cpp tuppage.cpp
test_varpage_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la
# Don't update the files from bitkeeper
%::SCCS/s.%
diff -Nrup a/storage/ndb/src/kernel/vm/Makefile.am b/storage/ndb/src/kernel/vm/Makefile.am
--- a/storage/ndb/src/kernel/vm/Makefile.am 2006-12-30 16:06:42 -08:00
+++ b/storage/ndb/src/kernel/vm/Makefile.am 2008-04-23 13:04:27 -07:00
@@ -65,24 +65,24 @@ ndbd_malloc_impl_test_CXXFLAGS = -DUNIT_
ndbd_malloc_impl_test_SOURCES = ndbd_malloc_impl.cpp
ndbd_malloc_impl_test_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la
bench_pool_SOURCES = bench_pool.cpp
bench_pool_LDFLAGS = @ndb_bin_am_ldflags@\
libkernel.a ../error/liberror.a \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la
testDynArr256_CXXFLAGS = -DUNIT_TEST
testDynArr256_SOURCES = DynArr256.cpp
testDynArr256_LDFLAGS = @ndb_bin_am_ldflags@ \
libkernel.a ../error/liberror.a \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la
diff -Nrup a/storage/ndb/src/mgmclient/Makefile.am b/storage/ndb/src/mgmclient/Makefile.am
--- a/storage/ndb/src/mgmclient/Makefile.am 2007-08-01 00:23:54 -07:00
+++ b/storage/ndb/src/mgmclient/Makefile.am 2008-04-23 13:04:27 -07:00
@@ -37,9 +37,9 @@ LDADD_LOC = $(noinst_LTLIBRARIES) \
../common/portlib/libportlib.la \
@readline_link@ \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la \
@TERMCAP_LIB@ @NDB_SCI_LIBS@
ndb_mgm_LDFLAGS = @ndb_bin_am_ldflags@
diff -Nrup a/storage/ndb/src/mgmsrv/Makefile.am b/storage/ndb/src/mgmsrv/Makefile.am
--- a/storage/ndb/src/mgmsrv/Makefile.am 2007-07-31 20:07:26 -07:00
+++ b/storage/ndb/src/mgmsrv/Makefile.am 2008-04-23 13:04:27 -07:00
@@ -40,9 +40,9 @@ INCLUDES_LOC = -I$(top_srcdir)/storage/n
LDADD_LOC = $(top_builddir)/storage/ndb/src/mgmclient/CommandInterpreter.lo \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la \
@readline_link@ \
@NDB_SCI_LIBS@ \
@TERMCAP_LIB@
diff -Nrup a/storage/ndb/src/ndbapi/Makefile.am b/storage/ndb/src/ndbapi/Makefile.am
--- a/storage/ndb/src/ndbapi/Makefile.am 2007-05-29 04:46:54 -07:00
+++ b/storage/ndb/src/ndbapi/Makefile.am 2008-04-23 13:04:27 -07:00
@@ -68,9 +68,10 @@ include $(top_srcdir)/storage/ndb/config
include $(top_srcdir)/storage/ndb/config/type_ndbapi.mk.am
ndberror_check_LDFLAGS = \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la \
+ $(top_builddir)/zlib/libzlt.la
# Don't update the files from bitkeeper
%::SCCS/s.%
diff -Nrup a/storage/ndb/test/run-test/Makefile.am b/storage/ndb/test/run-test/Makefile.am
--- a/storage/ndb/test/run-test/Makefile.am 2008-02-21 05:57:38 -08:00
+++ b/storage/ndb/test/run-test/Makefile.am 2008-04-23 13:04:28 -07:00
@@ -33,9 +33,9 @@ atrt_SOURCES = main.cpp setup.cpp files.
INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/test/include
LDADD_LOC = $(top_builddir)/storage/ndb/test/src/libNDBT.a \
$(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@ \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/strings/libmystrings.la @NDB_SCI_LIBS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la
atrt_CXXFLAGS = -I$(top_srcdir)/ndb/src/mgmapi \
diff -Nrup a/strings/Makefile.am b/strings/Makefile.am
--- a/strings/Makefile.am 2006-12-30 16:06:43 -08:00
+++ b/strings/Makefile.am 2008-04-23 13:04:28 -07:00
@@ -16,7 +16,7 @@
# This file is public domain and comes with NO WARRANTY of any kind
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
-pkglib_LIBRARIES = libmystrings.a
+noinst_LTLIBRARIES = libmystrings.la
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
@@ -37,7 +37,7 @@ CSRCS = strxmov.c bmove_upp.c strappend
endif
endif
-libmystrings_a_SOURCES = $(ASRCS) $(CSRCS)
+libmystrings_la_SOURCES = $(ASRCS) $(CSRCS)
noinst_PROGRAMS = conf_to_src
CLEANFILES = str_test uctypedump test_decimal
# Default charset definitions
@@ -55,9 +55,9 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c
strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \
t_ctype.h my_strchr.c CMakeLists.txt
-libmystrings_a_LIBADD=
-conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c
-conf_to_src_LDADD=
+libmystrings_la_LIBADD=
+conf_to_src_SOURCES = conf_to_src.c
+conf_to_src_LDADD= libmystrings.la
#force static linking of conf_to_src - essential when linking against
#custom installation of libc
conf_to_src_LDFLAGS= @NOINST_LDFLAGS@
@@ -68,15 +68,15 @@ conf_to_src_LDFLAGS= @NOINST_LDFLAGS@
FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
-str_test: str_test.c $(pkglib_LIBRARIES)
- $(LINK) $(FLAGS) -DMAIN $(INCLUDES) $(srcdir)/str_test.c $(LDADD) $(pkglib_LIBRARIES)
+str_test: str_test.c $(noinst_LTLIBRARIES)
+ $(LINK) $(FLAGS) -DMAIN $(INCLUDES) $(srcdir)/str_test.c $(LDADD) $(noinst_LTLIBRARIES)
uctypedump: uctypedump.c
$(LINK) $(INCLUDES) $(srcdir)/uctypedump.c
-test_decimal$(EXEEXT): decimal.c $(pkglib_LIBRARIES)
+test_decimal$(EXEEXT): decimal.c $(noinst_LTLIBRARIES)
$(CP) $(srcdir)/decimal.c ./test_decimal.c
- $(LINK) $(FLAGS) -DMAIN ./test_decimal.c $(LDADD) $(pkglib_LIBRARIES)
+ $(LINK) $(FLAGS) -DMAIN ./test_decimal.c $(LDADD) $(noinst_LTLIBRARIES)
$(RM) -f ./test_decimal.c
# Don't update the files from bitkeeper
diff -Nrup a/unittest/mysys/Makefile.am b/unittest/mysys/Makefile.am
--- a/unittest/mysys/Makefile.am 2007-05-28 13:17:46 -07:00
+++ b/unittest/mysys/Makefile.am 2008-04-23 13:04:28 -07:00
@@ -17,9 +17,10 @@ AM_CPPFLAGS = @ZLIB_INCLUDES@ -I$(t
AM_CPPFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/unittest/mytap
LDADD = $(top_builddir)/unittest/mytap/libmytap.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/strings/libmystrings.a
+ $(top_builddir)/mysys/libmysys.la \
+ $(top_builddir)/dbug/libdbug.la \
+ $(top_builddir)/strings/libmystrings.la \
+ @M_LIBS@ @ZLIB_LIBS@
noinst_PROGRAMS = bitmap-t base64-t my_atomic-t
| Thread |
|---|
| • bk commit into 5.1 tree (mtaylor:1.2579) BUG#29791 | Monty Taylor | 23 Apr |