diff options
238 files changed, 1095 insertions, 6090 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index b5f1c7b200e..afb8eca08f2 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -15,7 +15,7 @@ Usage: $0 [-h|-n] [configure-options] -n, --just-print Don't actually run any commands; just print them. -c, --just-configure Stop after running configure. --with-debug=full Build with full debug. - --warning-mode=[old|pedantic] + --warning-mode=[old|pedantic|maintainer] Influences the debug flags. Old is default. --prefix=path Build with prefix 'path'. @@ -62,6 +62,7 @@ just_print= just_configure= full_debug= warning_mode= +maintainer_mode= parse_options "$@" @@ -88,7 +89,21 @@ AM_MAKEFLAGS="-j 6" # Ex --with-ssl=/usr SSL_LIBRARY=--with-ssl -if [ "x$warning_mode" != "xpedantic" ]; then +if [ "x$warning_mode" = "xpedantic" ]; then + warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE" + c_warnings="$warnings" + cxx_warnings="$warnings -std=c++98" +# NOTE: warning mode should not influence optimize/debug mode. +# Please feel free to add a separate option if you don't feel it's an overkill. + debug_extra_cflags="-O0" +# Reset CPU flags (-mtune), they don't work in -pedantic mode + check_cpu_cflags="" +elif [ "x$warning_mode" = "xmaintainer" ]; then + c_warnings="-Wall -Wextra" + cxx_warnings="$c_warnings -Wno-unused-parameter" + maintainer_mode="--enable-mysql-maintainer-mode" + debug_extra_cflags="-g3" +else # Both C and C++ warnings warnings="-Wall -Wextra -Wunused -Wwrite-strings" @@ -103,15 +118,6 @@ if [ "x$warning_mode" != "xpedantic" ]; then cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" # Added unless --with-debug=full debug_extra_cflags="-O0 -g3 -gdwarf-2" -else - warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE" - c_warnings="$warnings" - cxx_warnings="$warnings -std=c++98" -# NOTE: warning mode should not influence optimize/debug mode. -# Please feel free to add a separate option if you don't feel it's an overkill. - debug_extra_cflags="-O0" -# Reset CPU flags (-mtune), they don't work in -pedantic mode - check_cpu_cflags="" fi # Set flags for various build configurations. @@ -147,7 +153,7 @@ fi base_configs="--prefix=$prefix --enable-assembler " base_configs="$base_configs --with-extra-charsets=complex " base_configs="$base_configs --enable-thread-safe-client " -base_configs="$base_configs --with-big-tables" +base_configs="$base_configs --with-big-tables $maintainer_mode" if test -d "$path/../cmd-line-utils/readline" then diff --git a/Makefile.am b/Makefile.am index 297e923905e..a559972969b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,6 +30,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ @libmysqld_dirs@ \ mysql-test support-files sql-bench \ win \ + packaging \ cmake DIST_SUBDIRS = . include Docs zlib \ cmd-line-utils sql-common scripts \ @@ -40,6 +41,7 @@ DIST_SUBDIRS = . include Docs zlib \ mysql-test support-files sql-bench \ win \ cmake \ + packaging \ BUILD DISTCLEANFILES = ac_available_languages_fragment diff --git a/client/Makefile.am b/client/Makefile.am index 04f0ac39b0e..393573a061e 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -62,7 +62,6 @@ mysqlbinlog_SOURCES = mysqlbinlog.cc \ $(top_srcdir)/mysys/my_new.cc \ $(top_srcdir)/mysys/my_bit.c \ $(top_srcdir)/mysys/my_bitmap.c \ - $(top_srcdir)/mysys/my_vle.c \ $(top_srcdir)/mysys/base64.c mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) diff --git a/client/mysql.cc b/client/mysql.cc index abf01d8127d..d768a01eb5d 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -627,10 +627,6 @@ static COMMANDS commands[] = { { "QUARTER", 0, 0, 0, ""}, { "QUERY", 0, 0, 0, ""}, { "QUICK", 0, 0, 0, ""}, - { "RAID0", 0, 0, 0, ""}, - { "RAID_CHUNKS", 0, 0, 0, ""}, - { "RAID_CHUNKSIZE", 0, 0, 0, ""}, - { "RAID_TYPE", 0, 0, 0, ""}, { "READ", 0, 0, 0, ""}, { "READS", 0, 0, 0, ""}, { "REAL", 0, 0, 0, ""}, diff --git a/client/mysqltest.cc b/client/mysqltest.cc index c8ec6c981ef..20f0f6d3164 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5954,8 +5954,8 @@ static struct my_option my_long_options[] = GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"result-format-version", OPT_RESULT_FORMAT_VERSION, "Version of the result file format to use", - (uchar**) &opt_result_format_version, - (uchar**) &opt_result_format_version, 0, + &opt_result_format_version, + &opt_result_format_version, 0, GET_INT, REQUIRED_ARG, 1, 1, 2, 0, 0, 0}, {"server-arg", 'A', "Send option value to embedded server as a parameter.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -5998,8 +5998,7 @@ static struct my_option my_long_options[] = GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"connect_timeout", OPT_CONNECT_TIMEOUT, "Number of seconds before connection timeout.", - (uchar**) &opt_connect_timeout, - (uchar**) &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG, + &opt_connect_timeout, &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG, 120, 0, 3600 * 12, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -8513,7 +8512,7 @@ void free_replace_column() typedef struct st_pointer_array { /* when using array-strings */ TYPELIB typelib; /* Pointer to strings */ uchar *str; /* Strings is here */ - int7 *flag; /* Flag about each var. */ + uint8 *flag; /* Flag about each var. */ uint array_allocs,max_count,length,max_length; } POINTER_ARRAY; @@ -9644,7 +9643,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) } pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+ sizeof(*pa->flag)); - pa->flag= (int7*) (pa->typelib.type_names+pa->max_count); + pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count); pa->length=0; pa->max_length=PS_MALLOC-MALLOC_OVERHEAD; pa->array_allocs=1; @@ -9680,7 +9679,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) pa->typelib.type_names=new_array; old_count=pa->max_count; pa->max_count=len/(sizeof(uchar*) + sizeof(*pa->flag)); - pa->flag= (int7*) (pa->typelib.type_names+pa->max_count); + pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count); memcpy((uchar*) pa->flag,(char *) (pa->typelib.type_names+old_count), old_count*sizeof(*pa->flag)); } diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 81942a8c053..732f5d74181 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -339,4 +339,16 @@ SET(C_HAS_inline CACHE INTERNAL "") SET(C_HAS___inline 1 CACHE INTERNAL "") SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "") SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "") +SET(HAVE_CXXABI_H CACHE INTERNAL "") +SET(HAVE_NDIR_H CACHE INTERNAL "") +SET(HAVE_SYS_NDIR_H CACHE INTERNAL "") +SET(HAVE_SYS_NDIR_H CACHE INTERNAL "") +SET(HAVE_ASM_TERMBITS_H CACHE INTERNAL "") +SET(HAVE_TERMBITS_H CACHE INTERNAL "") +SET(HAVE_VIS_H CACHE INTERNAL "") +SET(HAVE_WCHAR_H 1 CACHE INTERNAL "") +SET(HAVE_WCTYPE_H 1 CACHE INTERNAL "") +SET(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP CACHE INTERNAL "") +SET(HAVE_SOCKADDR_IN_SIN_LEN CACHE INTERNAL "") +SET(HAVE_SOCKADDR_IN6_SIN6_LEN CACHE INTERNAL "") ENDIF() diff --git a/config.h.cmake b/config.h.cmake index 73cd94cace4..c484edb65a5 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -103,7 +103,6 @@ #cmakedefine HAVE_SYS_UTIME_H 1 #cmakedefine HAVE_SYS_WAIT_H 1 #cmakedefine HAVE_SYS_PARAM_H 1 -#cmakedefine HAVE_XFS_XFS_H 1 /* Libraries */ #cmakedefine HAVE_LIBPTHREAD 1 @@ -252,15 +251,6 @@ #cmakedefine HAVE_SIGWAIT 1 #cmakedefine HAVE_SLEEP 1 #cmakedefine HAVE_SNPRINTF 1 -/* Some that currently are not real defines, internal to CMake setup */ -/* #cmakedefine HAVE_FCNTL_NONBLOCK 1 */ -/* #cmakedefine HAVE_FINITE_IN_MATH_H 1 */ -/* #cmakedefine HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 */ -/* #cmakedefine HAVE_SOCKADDR_STORAGE___SS_FAMILY 1 */ -/* #cmakedefine HAVE_SOCKET_SIZE_T_AS_int 1 */ -/* #cmakedefine HAVE_SOCKET_SIZE_T_AS_size_t 1 */ -/* #cmakedefine HAVE_SOCKET_SIZE_T_AS_socklen_t */ -/* #cmakedefine HAVE_SOCKET_TIMEOUT */ #cmakedefine HAVE_STPCPY 1 #cmakedefine HAVE_STRERROR 1 #cmakedefine HAVE_STRCOLL 1 @@ -343,13 +333,13 @@ #endif #cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@ -#cmakedefine HAVE_CHAR 1 -#cmakedefine HAVE_LONG 1 -#cmakedefine HAVE_CHARP 1 +#define HAVE_CHAR 1 +#define HAVE_LONG 1 +#define HAVE_CHARP 1 #cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@ -#cmakedefine HAVE_SHORT 1 +#define HAVE_SHORT 1 #cmakedefine SIZEOF_INT @SIZEOF_INT@ -#cmakedefine HAVE_INT 1 +#define HAVE_INT 1 #cmakedefine SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@ #cmakedefine HAVE_LONG_LONG 1 #cmakedefine SIZEOF_OFF_T @SIZEOF_OFF_T@ @@ -581,23 +571,6 @@ #cmakedefine HAVE_UCA_COLLATIONS 1 #cmakedefine HAVE_COMPRESS 1 -/* - Hard coded platform settings -*/ - -/* This is ugly, but we need lots of tweaks for HP-UX */ -#cmakedefine HPUX11 1 -#cmakedefine DO_NOT_REMOVE_THREAD_WRAPPERS 1 -#cmakedefine HAVE_BROKEN_PREAD 1 -#cmakedefine HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT 1 -#cmakedefine SNPRINTF_RETURN_TRUNC 1 -#cmakedefine _INCLUDE_LONGLONG 1 - -/* Mac OS X */ -#cmakedefine SIGNALS_DONT_BREAK_READ 1 -#cmakedefine IGNORE_SIGHUP_SIGQUIT 1 -#cmakedefine _P1003_1B_VISIBLE 1 -#cmakedefine DONT_DECLARE_CXA_PURE_VIRTUAL 1 /* Stuff that always need to be defined (compile breaks without it) diff --git a/config/ac-macros/character_sets.m4 b/config/ac-macros/character_sets.m4 index 81967d383ec..c49e4f89316 100644 --- a/config/ac-macros/character_sets.m4 +++ b/config/ac-macros/character_sets.m4 @@ -5,9 +5,6 @@ dnl you must also create strings/ctype-$charset_name.c AC_DIVERT_PUSH(0) -# Any changes to the available character sets must also go into -# include/config-win.h - define(CHARSETS_AVAILABLE0,binary) define(CHARSETS_AVAILABLE1,armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257) define(CHARSETS_AVAILABLE2,cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8) diff --git a/configure.cmake b/configure.cmake index 27950513b36..c2e1dc4647b 100644 --- a/configure.cmake +++ b/configure.cmake @@ -257,7 +257,6 @@ CHECK_INCLUDE_FILES ("stdlib.h;sys/un.h" HAVE_SYS_UN_H) CHECK_INCLUDE_FILES (vis.h HAVE_VIS_H) CHECK_INCLUDE_FILES (wchar.h HAVE_WCHAR_H) CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H) -CHECK_INCLUDE_FILES (xfs/xfs.h HAVE_XFS_XFS_H) IF(HAVE_SYS_STREAM_H) # Needs sys/stream.h on Solaris @@ -502,14 +501,17 @@ IF(HAVE_STDINT_H) SET(CMAKE_EXTRA_INCLUDE_FILES stdint.h) ENDIF(HAVE_STDINT_H) -# These first four SIZE_* values are not really used on Mac OS X, -# as we only know at comile time what architecture to build for, -# see "config.h.cmake". But as same macro MY_CHECK_TYPE_SIZE also -# sets HAVE_* macros, we run the check here, doesn't hurt. +SET(HAVE_VOIDP 1) +SET(HAVE_CHARP 1) +SET(HAVE_LONG 1) +SET(HAVE_SIZE_T 1) + +IF(NOT APPLE) MY_CHECK_TYPE_SIZE("void *" VOIDP) MY_CHECK_TYPE_SIZE("char *" CHARP) MY_CHECK_TYPE_SIZE(long LONG) MY_CHECK_TYPE_SIZE(size_t SIZE_T) +ENDIF() MY_CHECK_TYPE_SIZE(char CHAR) MY_CHECK_TYPE_SIZE(short SHORT) @@ -1054,26 +1056,3 @@ SET(CMAKE_EXTRA_INCLUDE_FILES) CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_INO) CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN) SET(SPRINTF_RETURNS_INT 1) - -#-------------------------------------------------------------------- -# Hard coded platform settings -#-------------------------------------------------------------------- - -# This is ugly, but we need lots of tweaks for HP-UX -IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") - SET(HPUX11 1) - SET(DO_NOT_REMOVE_THREAD_WRAPPERS 1) - SET(HAVE_BROKEN_PREAD 1) - SET(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT 1) - SET(NO_FCNTL_NONBLOCK 1) # Set conditionally in code above - SET(SNPRINTF_RETURN_TRUNC 1) - SET(_INCLUDE_LONGLONG 1) -ENDIF() - -IF(APPLE) - SET(DONT_DECLARE_CXA_PURE_VIRTUAL 1) - SET(IGNORE_SIGHUP_SIGQUIT 1) - SET(SIGNALS_DONT_BREAK_READ 1) - SET(SIGNAL_WITH_VIO_CLOSE 1) # FIXME better handled in mysql-trunk - SET(_P1003_1B_VISIBLE 1) -ENDIF() diff --git a/configure.in b/configure.in index a2f0c432681..f4db1d2b39e 100644 --- a/configure.in +++ b/configure.in @@ -681,9 +681,8 @@ AC_ARG_ENABLE(assembler, AC_MSG_CHECKING(if we should use assembler functions) # For now we only support assembler on i386 and sparc systems AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386" && $AS strings/strings-x86.s -o checkassembler >/dev/null 2>&1 && test -f checkassembler && (rm -f checkassembler; exit 0;)) -AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc") AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9") -AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "") +AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "") if test "$ASSEMBLER_TRUE" = "" then @@ -1210,7 +1209,6 @@ case $SYSTEM_TYPE in # Fixes for HPUX 11.0 compiler if test "$ac_cv_prog_gcc" = "no" then - CFLAGS="$CFLAGS -DHAVE_BROKEN_INLINE" # set working flags first in line, letting override it (i. e. for debug): CXXFLAGS="+O2 $CXXFLAGS" MAX_C_OPTIMIZE="" @@ -1997,6 +1995,9 @@ fi dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE +AS_IF([test "x$ac_cv_c_inline" = "xno"], + [AC_MSG_WARN([The C compiler does not support inline. Beware that unused + functions might not be eliminated the object files.])]) AC_TYPE_OFF_T AC_STRUCT_ST_RDEV AC_HEADER_TIME @@ -3057,7 +3058,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl libmysqld/Makefile libmysqld/examples/Makefile dnl mysql-test/Makefile mysql-test/lib/My/SafeProcess/Makefile dnl sql-bench/Makefile include/mysql_version.h plugin/Makefile win/Makefile dnl - cmake/Makefile + cmake/Makefile packaging/Makefile ) AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h) diff --git a/extra/replace.c b/extra/replace.c index bbe70ba586e..2ce374726eb 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -39,7 +39,6 @@ fill_buffer_retaining() is taken from gnu-grep and modified. */ -#define DONT_USE_RAID #include <my_global.h> #include <m_ctype.h> #include <my_sys.h> @@ -52,7 +51,7 @@ typedef struct st_pointer_array { /* when using array-strings */ TYPELIB typelib; /* Pointer to strings */ uchar *str; /* Strings is here */ - int7 *flag; /* Flag about each var. */ + uint8 *flag; /* Flag about each var. */ uint array_allocs,max_count,length,max_length; } POINTER_ARRAY; @@ -267,7 +266,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) } pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+ sizeof(*pa->flag)); - pa->flag= (int7*) (pa->typelib.type_names+pa->max_count); + pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count); pa->length=0; pa->max_length=PS_MALLOC-MALLOC_OVERHEAD; pa->array_allocs=1; @@ -304,7 +303,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) pa->typelib.type_names=new_array; old_count=pa->max_count; pa->max_count=len/(sizeof(uchar*) + sizeof(*pa->flag)); - pa->flag= (int7*) (pa->typelib.type_names+pa->max_count); + pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count); memcpy((uchar*) pa->flag,(char *) (pa->typelib.type_names+old_count), old_count*sizeof(*pa->flag)); } diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 432a207f424..6ea818c601b 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -17,7 +17,6 @@ versions into symbolic names. By Sasha Pachev <sasha@mysql.com> */ -#define DONT_USE_RAID #include <my_global.h> #include <m_ctype.h> #include <my_sys.h> diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt index 63eabb45824..ea991fee8dc 100644 --- a/extra/yassl/CMakeLists.txt +++ b/extra/yassl/CMakeLists.txt @@ -28,7 +28,12 @@ ${CMAKE_CXX_FLAGS}) ENDIF() SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp - src/yassl_imp.cpp src/yassl_int.cpp src/template_instnt.cpp) + src/yassl_imp.cpp src/yassl_int.cpp) + +IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION) + SET(YASSL_SOURCES ${YASSL_SOURCES} src/template_instnt.cpp) +ENDIF() + ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES}) RESTRICT_SYMBOL_EXPORTS(yassl) diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt index 9417dda4095..1781ea6f2fa 100644 --- a/extra/yassl/taocrypt/CMakeLists.txt +++ b/extra/yassl/taocrypt/CMakeLists.txt @@ -21,12 +21,16 @@ ADD_DEFINITIONS(${SSL_DEFINES}) SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp - src/template_instnt.cpp include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp) + +IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION) + SET(TAOCRYPT_SOURCES ${TAOCRYPT_SOURCES} src/template_instnt.cpp) +ENDIF() + ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES}) RESTRICT_SYMBOL_EXPORTS(taocrypt) diff --git a/include/Makefile.am b/include/Makefile.am index ad023083829..e30588de065 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -33,16 +33,16 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \ $(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h -noinst_HEADERS = config-win.h lf.h my_bit.h \ +noinst_HEADERS = lf.h my_bit.h \ heap.h my_bitmap.h my_uctype.h password.h \ myisam.h myisampack.h myisammrg.h ft_global.h\ mysys_err.h my_base.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h sha2.h \ - my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ + my_aes.h my_tree.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \ my_handler.h my_time.h service_versions.h \ my_rdtsc.h mysql/psi/psi_abi_v1.h mysql/psi/psi_abi_v2.h \ - my_vle.h my_user.h my_atomic.h atomic/nolock.h \ + my_user.h my_atomic.h atomic/nolock.h \ atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \ atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \ atomic/solaris.h mysql/innodb_priv.h my_compiler.h diff --git a/include/atomic/gcc_builtins.h b/include/atomic/gcc_builtins.h index 100ff80cacd..d03d28f572e 100644 --- a/include/atomic/gcc_builtins.h +++ b/include/atomic/gcc_builtins.h @@ -22,8 +22,9 @@ v= __sync_lock_test_and_set(a, v); #define make_atomic_cas_body(S) \ int ## S sav; \ - sav= __sync_val_compare_and_swap(a, *cmp, set); \ - if (!(ret= (sav == *cmp))) *cmp= sav; + int ## S cmp_val= *cmp; \ + sav= __sync_val_compare_and_swap(a, cmp_val, set);\ + if (!(ret= (sav == cmp_val))) *cmp= sav #ifdef MY_ATOMIC_MODE_DUMMY #define make_atomic_load_body(S) ret= *a diff --git a/include/atomic/nolock.h b/include/atomic/nolock.h index 5a0c41d9078..4c871473b60 100644 --- a/include/atomic/nolock.h +++ b/include/atomic/nolock.h @@ -29,21 +29,22 @@ We choose implementation as follows: ------------------------------------ On Windows using Visual C++ the native implementation should be - preferrable. When using gcc we prefer the native x86 implementation, - we prefer the Solaris implementation before the gcc because of - stability preference, we choose gcc implementation if nothing else - works on gcc. If neither Visual C++ or gcc we still choose the - Solaris implementation on Solaris (mainly for SunStudio compiles. + preferrable. When using gcc we prefer the Solaris implementation + before the gcc because of stability preference, we choose gcc + builtins if available, otherwise we choose the somewhat broken + native x86 implementation. If neither Visual C++ or gcc we still + choose the Solaris implementation on Solaris (mainly for SunStudio + compilers). */ # if defined(_MSV_VER) # include "generic-msvc.h" # elif __GNUC__ -# if defined(__i386__) || defined(__x86_64__) -# include "x86-gcc.h" -# elif defined(HAVE_SOLARIS_ATOMIC) +# if defined(HAVE_SOLARIS_ATOMIC) # include "solaris.h" # elif defined(HAVE_GCC_ATOMIC_BUILTINS) # include "gcc_builtins.h" +# elif defined(__i386__) || defined(__x86_64__) +# include "x86-gcc.h" # endif # elif defined(HAVE_SOLARIS_ATOMIC) # include "solaris.h" diff --git a/include/atomic/solaris.h b/include/atomic/solaris.h index fc9f369c707..5643f878cd2 100644 --- a/include/atomic/solaris.h +++ b/include/atomic/solaris.h @@ -20,11 +20,17 @@ #define MY_ATOMIC_MODE "solaris-atomic" +#if defined(__GNUC__) +#define atomic_typeof(T,V) __typeof__(V) +#else +#define atomic_typeof(T,V) T +#endif + #define uintptr_t void * #define atomic_or_ptr_nv(X,Y) (void *)atomic_or_ulong_nv((volatile ulong_t *)X, Y) #define make_atomic_cas_body(S) \ - uint ## S ## _t sav; \ + atomic_typeof(uint ## S ## _t, *cmp) sav; \ sav = atomic_cas_ ## S( \ (volatile uint ## S ## _t *)a, \ (uint ## S ## _t)*cmp, \ diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h index 61b94a48568..8baa84e110e 100644 --- a/include/atomic/x86-gcc.h +++ b/include/atomic/x86-gcc.h @@ -53,18 +53,29 @@ #endif #define make_atomic_add_body32 \ - asm volatile (LOCK_prefix "; xadd %0, %1;" : "+r" (v) , "+m" (*a)) + asm volatile (LOCK_prefix "; xadd %0, %1;" \ + : "+r" (v), "=m" (*a) \ + : "m" (*a) \ + : "memory") #define make_atomic_cas_body32 \ + __typeof__(*cmp) sav; \ asm volatile (LOCK_prefix "; cmpxchg %3, %0; setz %2;" \ - : "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set)) + : "=m" (*a), "=a" (sav), "=q" (ret) \ + : "r" (set), "m" (*a), "a" (*cmp) \ + : "memory"); \ + if (!ret) \ + *cmp= sav #ifdef __x86_64__ #define make_atomic_add_body64 make_atomic_add_body32 #define make_atomic_cas_body64 make_atomic_cas_body32 -#define make_atomic_fas_body(S) \ - asm volatile ("xchg %0, %1;" : "+r" (v) , "+m" (*a)) +#define make_atomic_fas_body(S) \ + asm volatile ("xchg %0, %1;" \ + : "+r" (v), "=m" (*a) \ + : "m" (*a) \ + : "memory") /* Actually 32-bit reads/writes are always atomic on x86 @@ -73,9 +84,14 @@ #define make_atomic_load_body(S) \ ret=0; \ asm volatile (LOCK_prefix "; cmpxchg %2, %0" \ - : "+m" (*a), "+a" (ret): "r" (ret)) + : "=m" (*a), "=a" (ret) \ + : "r" (ret), "m" (*a) \ + : "memory") #define make_atomic_store_body(S) \ - asm volatile ("; xchg %0, %1;" : "+m" (*a), "+r" (v)) + asm volatile ("; xchg %0, %1;" \ + : "=m" (*a), "+r" (v) \ + : "m" (*a) \ + : "memory") #else /* @@ -104,12 +120,13 @@ platforms the much simpler make_atomic_cas_body32 will work fine. */ -#define make_atomic_cas_body64 \ - int32 ebx=(set & 0xFFFFFFFF), ecx=(set >> 32); \ - asm volatile ("push %%ebx; movl %3, %%ebx;" \ - LOCK_prefix "; cmpxchg8b %0; setz %2; pop %%ebx"\ - : "+m" (*a), "+A" (*cmp), "=c" (ret) \ - :"m" (ebx), "c" (ecx)) +#define make_atomic_cas_body64 \ + int32 ebx=(set & 0xFFFFFFFF), ecx=(set >> 32); \ + asm volatile ("push %%ebx; movl %3, %%ebx;" \ + LOCK_prefix "; cmpxchg8b %0; setz %2; pop %%ebx" \ + : "=m" (*a), "+A" (*cmp), "=c" (ret) \ + : "m" (ebx), "c" (ecx), "m" (*a) \ + : "memory", "esp") #endif /* diff --git a/include/config-win.h b/include/config-win.h deleted file mode 100644 index 9e8bb19c12d..00000000000 --- a/include/config-win.h +++ /dev/null @@ -1,441 +0,0 @@ -#ifndef CONFIG_WIN_INCLUDED -#define CONFIG_WIN_INCLUDED - -/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. - - 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 */ - -/* Defines for Win32 to make it compatible for MySQL */ - -#define BIG_TABLES - -/* - Minimal version of Windows we should be able to run on. - Currently Windows XP. -*/ -#define _WIN32_WINNT 0x0501 - - -#if defined(_MSC_VER) && _MSC_VER >= 1400 -/* Avoid endless warnings about sprintf() etc. being unsafe. */ -#define _CRT_SECURE_NO_DEPRECATE 1 -#endif - -#include <sys/locking.h> -#include <winsock2.h> -#include <Ws2tcpip.h> -#include <fcntl.h> -#include <io.h> -#include <malloc.h> -#include <sys/stat.h> -#include <process.h> /* getpid()*/ - - -#define HAVE_SMEM 1 - -#if defined(_WIN64) || defined(WIN64) -#define SYSTEM_TYPE "Win64" -#elif defined(_WIN32) || defined(WIN32) -#define SYSTEM_TYPE "Win32" -#else -#define SYSTEM_TYPE "Windows" -#endif - -#if defined(_M_IA64) -#define MACHINE_TYPE "ia64" -#elif defined(_M_IX86) -#define MACHINE_TYPE "ia32" -#elif defined(_M_ALPHA) -#define MACHINE_TYPE "axp" -#else -#define MACHINE_TYPE "unknown" /* Define to machine type name */ -#endif - -#if !(defined(_WIN64) || defined(WIN64)) -#ifndef _WIN32 -#define _WIN32 /* Compatible with old source */ -#endif -#ifndef __WIN32__ -#define __WIN32__ -#endif -#endif /* _WIN64 */ -#ifndef __WIN__ -#define __WIN__ /* To make it easier in VC++ */ -#endif - -#ifndef MAX_INDEXES -#define MAX_INDEXES 64 -#endif - -/* File and lock constants */ -#ifdef __BORLANDC__ -#define F_RDLCK LK_NBLCK /* read lock */ -#define F_WRLCK LK_NBRLCK /* write lock */ -#define F_UNLCK LK_UNLCK /* remove lock(s) */ -#else -#define F_RDLCK _LK_NBLCK /* read lock */ -#define F_WRLCK _LK_NBRLCK /* write lock */ -#define F_UNLCK _LK_UNLCK /* remove lock(s) */ -#endif - -#define F_EXCLUSIVE 1 /* We have only exclusive locking */ -#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */ -#define F_OK 0 /* parameter to access() */ -#define W_OK 2 - -#define S_IROTH S_IREAD /* for my_lib */ - -/* Winsock2 constant (Vista SDK and later)*/ -#define IPPROTO_IPV6 41 -#ifndef IPV6_V6ONLY -#define IPV6_V6ONLY 27 -#endif - -#ifdef __BORLANDC__ -#define FILE_BINARY O_BINARY /* my_fopen in binary mode */ -#define O_TEMPORARY 0 -#define O_SHORT_LIVED 0 -#define SH_DENYNO _SH_DENYNO -#else -#define O_BINARY _O_BINARY /* compability with older style names */ -#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */ -#define O_TEMPORARY _O_TEMPORARY -#define O_SHORT_LIVED _O_SHORT_LIVED -#define SH_DENYNO _SH_DENYNO -#endif -#define NO_OPEN_3 /* For my_create() */ - -#define SIGQUIT SIGTERM /* No SIGQUIT */ - -#undef _REENTRANT /* Crashes something for win32 */ -#undef SAFE_MUTEX /* Can't be used on windows */ - -#if defined(_MSC_VER) && _MSC_VER >= 1310 -#define LL(A) A##ll -#define ULL(A) A##ull -#else -#define LL(A) ((__int64) A) -#define ULL(A) ((unsigned __int64) A) -#endif - -#define LONGLONG_MIN LL(0x8000000000000000) -#define LONGLONG_MAX LL(0x7FFFFFFFFFFFFFFF) -#define ULONGLONG_MAX ULL(0xFFFFFFFFFFFFFFFF) - -/* Type information */ - -#if !defined(HAVE_UINT) -#undef HAVE_UINT -#define HAVE_UINT -typedef unsigned short ushort; -typedef unsigned int uint; -#endif /* !defined(HAVE_UINT) */ - -typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */ -typedef __int64 longlong; -#ifndef HAVE_SIGSET_T -typedef int sigset_t; -#endif -#define longlong_defined -/* - off_t should not be __int64 because of conflicts in header files; - Use my_off_t or os_off_t instead -*/ -#ifndef HAVE_OFF_T -typedef long off_t; -#endif -typedef __int64 os_off_t; -#ifdef _WIN64 -typedef UINT_PTR rf_SetTimer; -#else -typedef uint rf_SetTimer; -#endif - -#ifndef HAVE_SIZE_T -#ifndef _SIZE_T_DEFINED -typedef SIZE_T size_t; -#define _SIZE_T_DEFINED -#endif -#endif - -#ifndef HAVE_SSIZE_T -#ifndef _SSIZE_T_DEFINED -typedef SSIZE_T ssize_t; -#define _SSIZE_T_DEFINED -#endif -#endif - -#define Socket_defined -#define my_socket SOCKET -#define SIGPIPE SIGINT -#define RETQSORTTYPE void -#define QSORT_TYPE_IS_VOID -#define RETSIGTYPE void -#define SOCKET_SIZE_TYPE int -#define my_socket_defined -#define byte_defined -#define STDCALL __stdcall /* Used by libmysql.dll */ -#define isnan(X) _isnan(X) -#define finite(X) _finite(X) - -#ifndef MYSQL_CLIENT_NO_THREADS -#define THREAD -#endif -#define VOID_SIGHANDLER -#define SIZEOF_CHAR 1 -#define SIZEOF_INT 4 -#define SIZEOF_LONG 4 -#define SIZEOF_LONG_LONG 8 -#define SIZEOF_OFF_T 8 -#ifdef _WIN64 -#define SIZEOF_CHARP 8 -#else -#define SIZEOF_CHARP 4 -#endif -#define HAVE_BROKEN_NETINET_INCLUDES -#ifdef _WIN32 -#define HAVE_NAMED_PIPE /* We can only create pipes on NT */ -#endif - -/* ERROR is defined in wingdi.h */ -#undef ERROR - -/* We need to close files to break connections on shutdown */ -#ifndef SIGNAL_WITH_VIO_CLOSE -#define SIGNAL_WITH_VIO_CLOSE -#endif - -/* All windows servers should support .sym files */ -#undef USE_SYMDIR -#define USE_SYMDIR - -/* If LOAD DATA LOCAL INFILE should be enabled by default */ -#define ENABLED_LOCAL_INFILE 1 - -/* If query profiling should be enabled by default */ -#define ENABLED_PROFILING 1 - -/* Convert some simple functions to Posix */ - -#define my_sigset(A,B) signal((A),(B)) -#define finite(A) _finite(A) -#define sleep(A) Sleep((A)*1000) -#define popen(A,B) _popen((A),(B)) -#define pclose(A) _pclose(A) - -#ifndef __BORLANDC__ -#define access(A,B) _access(A,B) -#endif - -#if !defined(__cplusplus) -#define inline __inline -#endif /* __cplusplus */ - -#ifdef _WIN64 -#define ulonglong2double(A) ((double) (ulonglong) (A)) -#define my_off_t2double(A) ((double) (my_off_t) (A)) - -#else -inline double ulonglong2double(ulonglong value) -{ - longlong nr=(longlong) value; - if (nr >= 0) - return (double) nr; - return (18446744073709551616.0 + (double) nr); -} -#define my_off_t2double(A) ulonglong2double(A) -#endif /* _WIN64 */ - -inline ulonglong double2ulonglong(double d) -{ - double t= d - (double) 0x8000000000000000ULL; - - if (t >= 0) - return ((ulonglong) t) + 0x8000000000000000ULL; - return (ulonglong) d; -} - -#if SIZEOF_OFF_T > 4 -#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C)) -#define tell(A) _telli64(A) -#endif - -#define STACK_DIRECTION -1 - -/* Difference between GetSystemTimeAsFileTime() and now() */ -#define OFFSET_TO_EPOCH ULL(116444736000000000) - -#define HAVE_PERROR -#define HAVE_VFPRINT -#define HAVE_RENAME /* Have rename() as function */ -#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */ -#define HAVE_LONG_JMP /* Have long jump function */ -#define HAVE_LOCKING /* have locking() call */ -#define HAVE_ERRNO_AS_DEFINE /* errno is a define */ -#define HAVE_STDLIB /* everything is include in this file */ -#define HAVE_MEMCPY -#define HAVE_MEMMOVE -#define HAVE_GETCWD -#define HAVE_TELL -#define HAVE_TZNAME -#define HAVE_PUTENV -#define HAVE_SELECT -#define HAVE_SETLOCALE -#define HAVE_SOCKET /* Giangi */ -#define HAVE_FLOAT_H -#define HAVE_LIMITS_H -#define HAVE_STDDEF_H -#define NO_FCNTL_NONBLOCK /* No FCNTL */ -#define HAVE_ALLOCA -#define HAVE_STRPBRK -#define HAVE_STRSTR -#define HAVE_COMPRESS -#define HAVE_CREATESEMAPHORE -#define HAVE_ISNAN -#define HAVE_FINITE -#define HAVE_QUERY_CACHE -#define SPRINTF_RETURNS_INT -#define HAVE_SETFILEPOINTER -#define HAVE_VIO_READ_BUFF -#if defined(_MSC_VER) && _MSC_VER >= 1400 -/* strnlen() appeared in Studio 2005 */ -#define HAVE_STRNLEN -#endif -#define HAVE_WINSOCK2 - -#define strcasecmp stricmp -#define strncasecmp strnicmp - -#define HAVE_SNPRINTF 1 -#define snprintf _snprintf - -#define HAVE_SETENV 1 -#define setenv(VAR,VAL,X) _putenv_s(VAR,VAL) - -#ifdef _MSC_VER -#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */ -#define HAVE_ANSI_INCLUDE -#define HAVE_SYS_UTIME_H -#define HAVE_STRTOUL -#endif -#define my_reinterpret_cast(A) reinterpret_cast <A> -#define my_const_cast(A) const_cast<A> - - -/* MYSQL OPTIONS */ - -#ifdef _CUSTOMCONFIG_ -#include <custom_conf.h> -#else -#ifndef CMAKE_CONFIGD -#define DEFAULT_MYSQL_HOME "c:\\mysql" -#define MYSQL_DATADIR "c:\\mysql\\data" -#define PACKAGE "mysql" -#define DEFAULT_BASEDIR "C:\\" -#define SHAREDIR "share" -#define DEFAULT_CHARSET_HOME "C:/mysql/" -#endif -#endif -#ifndef DEFAULT_HOME_ENV -#define DEFAULT_HOME_ENV MYSQL_HOME -#endif -#ifndef DEFAULT_GROUP_SUFFIX_ENV -#define DEFAULT_GROUP_SUFFIX_ENV MYSQL_GROUP_SUFFIX -#endif - -/* File name handling */ - -#define FN_LIBCHAR '\\' -#define FN_ROOTDIR "\\" -#define FN_DEVCHAR ':' -#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ -#define FN_NO_CASE_SENSE /* Files are not case-sensitive */ -#define OS_FILE_LIMIT UINT_MAX /* No limit*/ - -#define DO_NOT_REMOVE_THREAD_WRAPPERS -#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) -#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) -/* The following is only used for statistics, so it should be good enough */ -#ifdef _WIN32 -#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) -#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C)) -#endif - -#define shared_memory_buffer_length 16000 -#define default_shared_memory_base_name "MYSQL" - -#define HAVE_SPATIAL 1 -#define HAVE_RTREE_KEYS 1 - -#define HAVE_OPENSSL 1 -#define HAVE_YASSL 1 - -#define ENABLED_PROFILING 1 - -/* - Our Windows binaries include all character sets which MySQL supports. - Any changes to the available character sets must also go into - config/ac-macros/character_sets.m4 -*/ - -#define MYSQL_DEFAULT_CHARSET_NAME "latin1" -#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" - -#define USE_MB 1 -#define USE_MB_IDENT 1 -#define USE_STRCOLL 1 - -#define HAVE_CHARSET_armscii8 -#define HAVE_CHARSET_ascii -#define HAVE_CHARSET_big5 1 -#define HAVE_CHARSET_cp1250 1 -#define HAVE_CHARSET_cp1251 -#define HAVE_CHARSET_cp1256 -#define HAVE_CHARSET_cp1257 -#define HAVE_CHARSET_cp850 -#define HAVE_CHARSET_cp852 -#define HAVE_CHARSET_cp866 -#define HAVE_CHARSET_cp932 1 -#define HAVE_CHARSET_dec8 -#define HAVE_CHARSET_eucjpms 1 -#define HAVE_CHARSET_euckr 1 -#define HAVE_CHARSET_gb2312 1 -#define HAVE_CHARSET_gbk 1 -#define HAVE_CHARSET_geostd8 -#define HAVE_CHARSET_greek -#define HAVE_CHARSET_hebrew -#define HAVE_CHARSET_hp8 -#define HAVE_CHARSET_keybcs2 -#define HAVE_CHARSET_koi8r -#define HAVE_CHARSET_koi8u -#define HAVE_CHARSET_latin1 1 -#define HAVE_CHARSET_latin2 1 -#define HAVE_CHARSET_latin5 -#define HAVE_CHARSET_latin7 -#define HAVE_CHARSET_macce -#define HAVE_CHARSET_macroman -#define HAVE_CHARSET_sjis 1 -#define HAVE_CHARSET_swe7 -#define HAVE_CHARSET_tis620 1 -#define HAVE_CHARSET_ucs2 1 -#define HAVE_CHARSET_ujis 1 -#define HAVE_CHARSET_utf8 1 -#define HAVE_CHARSET_utf8mb4 1 -#define HAVE_CHARSET_utf16 1 -#define HAVE_CHARSET_utf32 1 - -#define HAVE_UCA_COLLATIONS 1 -#define HAVE_BOOL 1 - -#endif /* CONFIG_WIN_INCLUDED */ diff --git a/include/lf.h b/include/lf.h index d1f592d1047..e9fb094493f 100644 --- a/include/lf.h +++ b/include/lf.h @@ -187,8 +187,6 @@ typedef struct st_lf_allocator { uchar * volatile top; uint element_size; uint32 volatile mallocs; - void (*constructor)(uchar *); /* called, when an object is malloc()'ed */ - void (*destructor)(uchar *); /* called, when an object is free()'d */ } LF_ALLOCATOR; void lf_alloc_init(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset); @@ -222,8 +220,7 @@ C_MODE_START #define LF_HASH_UNIQUE 1 -/* lf_hash overhead per element (that is, sizeof(LF_SLIST) */ -extern const int LF_HASH_OVERHEAD; +/* lf_hash overhead per element is sizeof(LF_SLIST). */ typedef struct { LF_DYNARRAY array; /* hash itself */ diff --git a/include/m_string.h b/include/m_string.h index c2779c63941..2ec4eb64c8e 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -92,26 +92,12 @@ extern char _dig_vec_lower[]; #define strmake_overlapp(A,B,C) strmake(A,B,C) #endif -#ifdef BAD_MEMCPY /* Problem with gcc on Alpha */ -#define memcpy_fixed(A,B,C) bmove((A),(B),(C)) -#else -#define memcpy_fixed(A,B,C) memcpy((A),(B),(C)) -#endif - -#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512) -#define bmove512(A,B,C) memcpy(A,B,C) -#endif - /* Prototypes for string functions */ #if !defined(bfill) && !defined(HAVE_BFILL) extern void bfill(uchar *dst,size_t len,pchar fill); #endif -#ifndef bmove512 -extern void bmove512(uchar *dst,const uchar *src,size_t len); -#endif - #if !defined(HAVE_BMOVE) && !defined(bmove) extern void bmove(uuchar *dst, const uchar *src,size_t len); #endif @@ -122,12 +108,7 @@ extern void bchange(uchar *dst,size_t old_len,const uchar *src, extern void strappend(char *s,size_t len,pchar fill); extern char *strend(const char *s); extern char *strcend(const char *, pchar); -extern char *strfield(char *src,int fields,int chars,int blanks, - int tabch); extern char *strfill(char * s,size_t len,pchar fill); -extern size_t strinstr(const char *str,const char *search); -extern size_t r_strinstr(const char *str, size_t from, const char *search); -extern char *strkey(char *dst,char *head,char *tail,char *flags); extern char *strmake(char *dst,const char *src,size_t length); #ifndef strmov @@ -136,35 +117,16 @@ extern char *strmov(char *dst,const char *src); extern char *strmov_overlapp(char *dst,const char *src); #endif extern char *strnmov(char *dst, const char *src, size_t n); -extern char *strsuff(const char *src, const char *suffix); extern char *strcont(const char *src, const char *set); -extern char *strxcat(char *dst, const char *src, ...); extern char *strxmov(char *dst, const char *src, ...); -extern char *strxcpy(char *dst, const char *src, ...); -extern char *strxncat(char *dst, size_t len, const char *src, ...); extern char *strxnmov(char *dst, size_t len, const char *src, ...); -extern char *strxncpy(char *dst, size_t len, const char *src, ...); /* Prototypes of normal stringfunctions (with may ours) */ - -#ifdef WANT_STRING_PROTOTYPES -extern char *strcat(char *, const char *); -extern char *strchr(const char *, pchar); -extern char *strrchr(const char *, pchar); -extern char *strcpy(char *, const char *); -extern int strcmp(const char *, const char *); -#ifndef __GNUC__ -extern size_t strlen(const char *); -#endif -#endif #ifndef HAVE_STRNLEN extern size_t strnlen(const char *s, size_t n); #endif #if !defined(__cplusplus) -#ifndef HAVE_STRPBRK -extern char *strpbrk(const char *, const char *); -#endif #ifndef HAVE_STRSTR extern char *strstr(const char *, const char *); #endif diff --git a/include/my_atomic.h b/include/my_atomic.h index 8ba3e201730..c2d514012d9 100644 --- a/include/my_atomic.h +++ b/include/my_atomic.h @@ -20,6 +20,7 @@ This header defines five atomic operations: my_atomic_add#(&var, what) + 'Fetch and Add' add 'what' to *var, and return the old value of *var my_atomic_fas#(&var, what) @@ -27,9 +28,10 @@ store 'what' in *var, and return the old value of *var my_atomic_cas#(&var, &old, new) - 'Compare And Swap' + An odd variation of 'Compare And Set/Swap' if *var is equal to *old, then store 'new' in *var, and return TRUE otherwise store *var in *old, and return FALSE + Usually, &old should not be accessed if the operation is successful. my_atomic_load#(&var) return *var @@ -153,10 +155,8 @@ make_transparent_unions(ptr) #define U_set set #endif /* __GCC__ transparent_union magic */ -#ifdef HAVE_INLINE - #define make_atomic_cas(S) \ -STATIC_INLINE int my_atomic_cas ## S(Uv_ ## S U_a, \ +static inline int my_atomic_cas ## S(Uv_ ## S U_a, \ Uv_ ## S U_cmp, U_ ## S U_set) \ { \ int8 ret; \ @@ -165,7 +165,7 @@ STATIC_INLINE int my_atomic_cas ## S(Uv_ ## S U_a, \ } #define make_atomic_add(S) \ -STATIC_INLINE int ## S my_atomic_add ## S( \ +static inline int ## S my_atomic_add ## S( \ Uv_ ## S U_a, U_ ## S U_v) \ { \ make_atomic_add_body(S); \ @@ -173,7 +173,7 @@ STATIC_INLINE int ## S my_atomic_add ## S( \ } #define make_atomic_fas(S) \ -STATIC_INLINE int ## S my_atomic_fas ## S( \ +static inline int ## S my_atomic_fas ## S( \ Uv_ ## S U_a, U_ ## S U_v) \ { \ make_atomic_fas_body(S); \ @@ -181,7 +181,7 @@ STATIC_INLINE int ## S my_atomic_fas ## S( \ } #define make_atomic_load(S) \ -STATIC_INLINE int ## S my_atomic_load ## S(Uv_ ## S U_a) \ +static inline int ## S my_atomic_load ## S(Uv_ ## S U_a) \ { \ int ## S ret; \ make_atomic_load_body(S); \ @@ -189,31 +189,12 @@ STATIC_INLINE int ## S my_atomic_load ## S(Uv_ ## S U_a) \ } #define make_atomic_store(S) \ -STATIC_INLINE void my_atomic_store ## S( \ +static inline void my_atomic_store ## S( \ Uv_ ## S U_a, U_ ## S U_v) \ { \ make_atomic_store_body(S); \ } -#else /* no inline functions */ - -#define make_atomic_add(S) \ -extern int ## S my_atomic_add ## S(Uv_ ## S U_a, U_ ## S U_v); - -#define make_atomic_fas(S) \ -extern int ## S my_atomic_fas ## S(Uv_ ## S U_a, U_ ## S U_v); - -#define make_atomic_cas(S) \ -extern int my_atomic_cas ## S(Uv_ ## S U_a, Uv_ ## S U_cmp, U_ ## S U_set); - -#define make_atomic_load(S) \ -extern int ## S my_atomic_load ## S(Uv_ ## S U_a); - -#define make_atomic_store(S) \ -extern void my_atomic_store ## S(Uv_ ## S U_a, U_ ## S U_v); - -#endif /* HAVE_INLINE */ - #ifdef MY_ATOMIC_HAS_8_16 make_atomic_cas(8) make_atomic_cas(16) diff --git a/include/my_attribute.h b/include/my_attribute.h index 8309d85f20a..d35b3013bdd 100644 --- a/include/my_attribute.h +++ b/include/my_attribute.h @@ -21,6 +21,12 @@ #ifndef _my_attribute_h #define _my_attribute_h +#if defined(__GNUC__) +# ifndef GCC_VERSION +# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +# endif +#endif + /* Disable __attribute__() on gcc < 2.7, g++ < 3.4, and non-gcc compilers. Some forms of __attribute__ are actually supported in earlier versions of diff --git a/include/my_bit.h b/include/my_bit.h index 5cbf4f8b83e..b396b84b0d8 100644 --- a/include/my_bit.h +++ b/include/my_bit.h @@ -6,7 +6,6 @@ */ C_MODE_START -#ifdef HAVE_INLINE extern const char _my_bits_nbits[256]; extern const uchar _my_bits_reverse_table[256]; @@ -16,14 +15,14 @@ extern const uchar _my_bits_reverse_table[256]; This can be used to divide a number with value by doing a shift instead */ -STATIC_INLINE uint my_bit_log2(ulong value) +static inline uint my_bit_log2(ulong value) { uint bit; for (bit=0 ; value > 1 ; value>>=1, bit++) ; return bit; } -STATIC_INLINE uint my_count_bits(ulonglong v) +static inline uint my_count_bits(ulonglong v) { #if SIZEOF_LONG_LONG > 4 /* The following code is a bit faster on 16 bit machines than if we would @@ -45,7 +44,7 @@ STATIC_INLINE uint my_count_bits(ulonglong v) #endif } -STATIC_INLINE uint my_count_bits_ushort(ushort v) +static inline uint my_count_bits_ushort(ushort v) { return _my_bits_nbits[v]; } @@ -70,7 +69,7 @@ STATIC_INLINE uint my_count_bits_ushort(ushort v) Comments shows how this works with 01100000000000000000000000001011 */ -STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v) +static inline uint32 my_round_up_to_next_power(uint32 v) { v--; /* 01100000000000000000000000001010 */ v|= v >> 1; /* 01110000000000000000000000001111 */ @@ -81,7 +80,7 @@ STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v) return v+1; /* 10000000000000000000000000000000 */ } -STATIC_INLINE uint32 my_clear_highest_bit(uint32 v) +static inline uint32 my_clear_highest_bit(uint32 v) { uint32 w=v >> 1; w|= w >> 1; @@ -92,7 +91,7 @@ STATIC_INLINE uint32 my_clear_highest_bit(uint32 v) return v & w; } -STATIC_INLINE uint32 my_reverse_bits(uint32 key) +static inline uint32 my_reverse_bits(uint32 key) { return (_my_bits_reverse_table[ key & 255] << 24) | @@ -101,14 +100,6 @@ STATIC_INLINE uint32 my_reverse_bits(uint32 key) _my_bits_reverse_table[(key>>24) ]; } -#else /* HAVE_INLINE */ -extern uint my_bit_log2(ulong value); -extern uint32 my_round_up_to_next_power(uint32 v); -uint32 my_clear_highest_bit(uint32 v); -uint32 my_reverse_bits(uint32 key); -extern uint my_count_bits(ulonglong v); -extern uint my_count_bits_ushort(ushort v); -#endif /* HAVE_INLINE */ C_MODE_END #endif /* MY_BIT_INCLUDED */ diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 0caf2da12d0..548eec14d6e 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -69,28 +69,6 @@ extern void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2); extern uint bitmap_lock_set_next(MY_BITMAP *map); extern void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit); -#ifdef NOT_USED -extern uint bitmap_lock_bits_set(const MY_BITMAP *map); -extern my_bool bitmap_lock_is_set_all(const MY_BITMAP *map); -extern uint bitmap_lock_get_first(const MY_BITMAP *map); -extern uint bitmap_lock_get_first_set(const MY_BITMAP *map); -extern my_bool bitmap_lock_is_subset(const MY_BITMAP *map1, - const MY_BITMAP *map2); -extern my_bool bitmap_lock_is_prefix(const MY_BITMAP *map, uint prefix_size); -extern my_bool bitmap_lock_is_set(const MY_BITMAP *map, uint bitmap_bit); -extern my_bool bitmap_lock_is_clear_all(const MY_BITMAP *map); -extern my_bool bitmap_lock_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2); -extern void bitmap_lock_set_all(MY_BITMAP *map); -extern void bitmap_lock_clear_all(MY_BITMAP *map); -extern void bitmap_lock_set_bit(MY_BITMAP *map, uint bitmap_bit); -extern void bitmap_lock_flip_bit(MY_BITMAP *map, uint bitmap_bit); -extern void bitmap_lock_set_prefix(MY_BITMAP *map, uint prefix_size); -extern void bitmap_lock_intersect(MY_BITMAP *map, const MY_BITMAP *map2); -extern void bitmap_lock_subtract(MY_BITMAP *map, const MY_BITMAP *map2); -extern void bitmap_lock_union(MY_BITMAP *map, const MY_BITMAP *map2); -extern void bitmap_lock_xor(MY_BITMAP *map, const MY_BITMAP *map2); -extern void bitmap_lock_invert(MY_BITMAP *map); -#endif /* Fast, not thread safe, bitmap functions */ #define bitmap_buffer_size(bits) (((bits)+31)/32)*4 #define no_bytes_in_map(map) (((map)->n_bits + 7)/8) diff --git a/include/my_global.h b/include/my_global.h index b0db017c565..1c615cc5ca2 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -86,24 +86,12 @@ #define IF_WIN(A,B) B #endif -#ifndef DBUG_OFF -#define IF_DBUG(A,B) A -#else -#define IF_DBUG(A,B) B -#endif - #ifdef HAVE_purify #define IF_PURIFY(A,B) A #else #define IF_PURIFY(A,B) B #endif -#ifdef DISABLE_GRANT_OPTIONS -#define IF_DISABLE_GRANT_OPTIONS(A,B) A -#else -#define IF_DISABLE_GRANT_OPTIONS(A,B) B -#endif - #ifndef EMBEDDED_LIBRARY #ifdef WITH_NDB_BINLOG #define HAVE_NDB_BINLOG 1 @@ -210,110 +198,6 @@ #define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0) - -/* - The macros below are useful in optimising places where it has been - discovered that cache misses stall the process and where a prefetch - of the cache line can improve matters. This is available in GCC 3.1.1 - and later versions. - PREFETCH_READ says that addr is going to be used for reading and that - it is to be kept in caches if possible for a while - PREFETCH_WRITE also says that the item to be cached is likely to be - updated. - The *LOCALITY scripts are also available for experimentation purposes - mostly and should only be used if they are verified to improve matters. - For more input see GCC manual (available in GCC 3.1.1 and later) -*/ - -#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10) -#define PREFETCH_READ(addr) __builtin_prefetch(addr, 0, 3) -#define PREFETCH_WRITE(addr) \ - __builtin_prefetch(addr, 1, 3) -#define PREFETCH_READ_LOCALITY(addr, locality) \ - __builtin_prefetch(addr, 0, locality) -#define PREFETCH_WRITE_LOCALITY(addr, locality) \ - __builtin_prefetch(addr, 1, locality) -#else -#define PREFETCH_READ(addr) -#define PREFETCH_READ_LOCALITY(addr, locality) -#define PREFETCH_WRITE(addr) -#define PREFETCH_WRITE_LOCALITY(addr, locality) -#endif - -/* - The following macro is used to ensure that code often used in most - SQL statements and definitely for parts of the SQL processing are - kept in a code segment by itself. This has the advantage that the - risk of common code being overlapping in caches of the CPU is less. - This can be a cause of big performance problems. - Routines should be put in this category with care and when they are - put there one should also strive to make as much of the error handling - as possible (or uncommon code of the routine) to execute in a - separate method to avoid moving to much code to this code segment. - - It is very easy to use, simply add HOT_METHOD at the end of the - function declaration. - For more input see GCC manual (available in GCC 2.95 and later) -*/ - -#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94) -#define HOT_METHOD \ - __attribute__ ((section ("hot_code_section"))) -#else -#define HOT_METHOD -#endif - -/* - The following macro is used to ensure that popular global variables - are located next to each other to avoid that they contend for the - same cache lines. - - It is very easy to use, simply add HOT_DATA at the end of the declaration - of the variable, the variable must be initialised because of the way - that linker works so a declaration using HOT_DATA should look like: - uint global_hot_data HOT_DATA = 0; - For more input see GCC manual (available in GCC 2.95 and later) -*/ - -#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94) -#define HOT_DATA \ - __attribute__ ((section ("hot_data_section"))) -#else -#define HOT_DATA -#endif - -/* - now let's figure out if inline functions are supported - autoconf defines 'inline' to be empty, if not -*/ -#define inline_test_1(X) X ## 1 -#define inline_test_2(X) inline_test_1(X) -#if inline_test_2(inline) != 1 -#define HAVE_INLINE -#else -#warning No "inline" support in C, all "static inline" functions will be instantiated in every .o file!!! -#endif -#undef inline_test_2 -#undef inline_test_1 -/* helper macro for "instantiating" inline functions */ -#define STATIC_INLINE static inline - -/* - The following macros are used to control inlining a bit more than - usual. These macros are used to ensure that inlining always or - never occurs (independent of compilation mode). - For more input see GCC manual (available in GCC 3.1.1 and later) -*/ - -#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10) -#define ALWAYS_INLINE __attribute__ ((always_inline)) -#define NEVER_INLINE __attribute__ ((noinline)) -#else -#define ALWAYS_INLINE -#define NEVER_INLINE -#endif - - /* Fix problem with S_ISLNK() on Linux */ #if defined(TARGET_OS_LINUX) || defined(__GLIBC__) #undef _GNU_SOURCE @@ -423,10 +307,6 @@ C_MODE_END #undef HAVE_PREAD #undef HAVE_PWRITE #endif -#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus) -#undef inline -#define inline -#endif #ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */ #undef HAVE_GETHOSTBYNAME_R @@ -441,18 +321,6 @@ C_MODE_END #error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile" #endif - -/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */ -#if SIZEOF_LONG == 4 && defined(__LONG_MAX__) && (__GNUC__ == 2 && __GNUC_MINOR__ == 8) -#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */ -#define __LONG_MAX__ 2147483647 -#endif - -/* egcs 1.1.2 has a problem with memcpy on Alpha */ -#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -#define BAD_MEMCPY -#endif - #if defined(_lint) && !defined(lint) #define lint #endif @@ -557,16 +425,6 @@ C_MODE_END extern "C" int madvise(void *addr, size_t len, int behav); #endif -/* We can not live without the following defines */ - -#define USE_MYFUNC 1 /* Must use syscall indirection */ -#define MASTER 1 /* Compile without unireg */ -#define ENGLISH 1 /* Messages in English */ -#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */ -#define USE_REGEX 1 /* We want the use the regex library */ -/* Do not define for ultra sparcs */ -#define USE_BMOVE512 1 /* Use this unless system bmove is faster */ - #define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ #define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ @@ -608,12 +466,6 @@ extern "C" int madvise(void *addr, size_t len, int behav); #define UNINIT_VAR(x) x= x #endif -/* Define some useful general macros */ -#if !defined(max) -#define max(a, b) ((a) > (b) ? (a) : (b)) -#define min(a, b) ((a) < (b) ? (a) : (b)) -#endif - #if !defined(HAVE_UINT) #undef HAVE_UINT #define HAVE_UINT @@ -621,8 +473,6 @@ typedef unsigned int uint; typedef unsigned short ushort; #endif -#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) -#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0) #define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; } #define test(a) ((a) ? 1 : 0) #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) @@ -636,18 +486,6 @@ typedef unsigned short ushort; #define FALSE (0) /* Logical false */ #endif -#if defined(__GNUC__) -#define function_volatile volatile -#define my_reinterpret_cast(A) reinterpret_cast<A> -#define my_const_cast(A) const_cast<A> -# ifndef GCC_VERSION -# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -# endif -#elif !defined(my_reinterpret_cast) -#define my_reinterpret_cast(A) (A) -#define my_const_cast(A) (A) -#endif - #include <my_compiler.h> /* @@ -674,9 +512,6 @@ C_MODE_END # endif #endif -#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ -#define ASCII_BITS_USED 8 /* Bit char used */ - /* Some types that is different between systems */ typedef int File; /* File descriptor */ @@ -753,14 +588,7 @@ typedef SOCKET_SIZE_TYPE size_socket; #endif /* __WIN__ */ -/* #define USE_RECORD_LOCK */ - - /* Unsigned types supported by the compiler */ -#define UNSINT8 /* unsigned int8 (char) */ -#define UNSINT16 /* unsigned int16 */ -#define UNSINT32 /* unsigned int32 */ - - /* General constants */ +/* General constants */ #define FN_LEN 256 /* Max file name len */ #define FN_HEADLEN 253 /* Max length of filepart of file name */ #define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */ @@ -821,10 +649,6 @@ typedef SOCKET_SIZE_TYPE size_socket; #define OS_FILE_LIMIT UINT_MAX #endif -/* #define EXT_IN_LIBNAME */ -/* #define FN_NO_CASE_SENSE */ -/* #define FN_UPPER_CASE TRUE */ - /* Io buffer size; Must be a power of 2 and a multiple of 512. May be smaller what the disk page size. This influences the speed of the @@ -849,7 +673,6 @@ typedef SOCKET_SIZE_TYPE size_socket; /* Some things that this system doesn't have */ -#define NO_HASH /* Not needed anymore */ #ifdef _WIN32 #define NO_DIR_LIBRARY /* Not standard dir-library */ #endif @@ -896,7 +719,6 @@ inline unsigned long long my_double2ulonglong(double d) #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif #define ulong_to_double(X) ((double) (ulong) (X)) -#define SET_STACK_SIZE(X) /* Not needed on real machines */ #ifndef STACK_DIRECTION #error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS" @@ -915,7 +737,6 @@ inline unsigned long long my_double2ulonglong(double d) /* Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined. - Also on Windows we define these constants by hand in config-win.h. */ #if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN) @@ -1013,9 +834,6 @@ typedef long long my_ptrdiff_t; #define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1)) #define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double)) /* Size to make adressable obj. */ -#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t))) - /* Offset of field f in structure t */ -#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f) #define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) @@ -1126,22 +944,6 @@ typedef long long intptr; #define MY_ERRPTR ((void*)(intptr)1) -#ifdef USE_RAID -/* - The following is done with a if to not get problems with pre-processors - with late define evaluation -*/ -#if SIZEOF_OFF_T == 4 -#define SYSTEM_SIZEOF_OFF_T 4 -#else -#define SYSTEM_SIZEOF_OFF_T 8 -#endif -#undef SIZEOF_OFF_T -#define SIZEOF_OFF_T 8 -#else -#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T -#endif /* USE_RAID */ - #if defined(_WIN32) typedef unsigned long long my_off_t; typedef unsigned long long os_off_t; @@ -1182,14 +984,10 @@ typedef ulong nesting_map; /* Used for flags of nesting constructs */ #define SOCKET_EMFILE EMFILE #endif -typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */ -typedef short int15; /* Most effective integer 0 <= x <= 32767 */ typedef int myf; /* Type of MyFlags in my_funcs */ typedef char my_bool; /* Small bool */ - /* Macros for converting *constants* to the right type */ -#define INT8(v) (int8) (v) -#define INT16(v) (int16) (v) -#define INT32(v) (int32) (v) + +/* Macros for converting *constants* to the right type */ #define MYF(v) (myf) (v) #ifndef LL @@ -1233,23 +1031,9 @@ typedef char my_bool; /* Small bool */ #include <my_dbug.h> -/* - Sometimes we want to make sure that the variable is not put into - a register in debugging mode so we can see its value in the core -*/ - -#ifndef DBUG_OFF -#define dbug_volatile volatile -#else -#define dbug_volatile -#endif - /* Some helper macros */ #define YESNO(X) ((X) ? "yes" : "no") -/* Defines for time function */ -#define SCALE_SEC 100 -#define SCALE_USEC 10000 #define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */ #define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */ @@ -1447,8 +1231,8 @@ do { doubleget_union _tmp; \ ((uchar*) &def_temp)[7]=(M)[0];\ (V) = def_temp; } while(0) #else -#define float4get(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float)) -#define float4store(V,M) memcpy_fixed((uchar*) V,(uchar*) (&M),sizeof(float)) +#define float4get(V,M) memcpy(&V, (M), sizeof(float)) +#define float4store(V,M) memcpy(V, (&M), sizeof(float)) #if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) #define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\ @@ -1518,12 +1302,12 @@ do { doubleget_union _tmp; \ *(((char*)T)+1)=(((A) >> 16));\ *(((char*)T)+0)=(((A) >> 24)); } while(0) -#define floatget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float)) -#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*)(&V),sizeof(float)) -#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double)) -#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double)) -#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong)) -#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong)) +#define floatget(V,M) memcpy(&V, (M), sizeof(float)) +#define floatstore(T,V) memcpy((T), (void*) (&V), sizeof(float)) +#define doubleget(V,M) memcpy(&V, (M), sizeof(double)) +#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double)) +#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong)) +#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong)) #else @@ -1534,15 +1318,15 @@ do { doubleget_union _tmp; \ #define shortstore(T,V) int2store(T,V) #define longstore(T,V) int4store(T,V) #ifndef floatstore -#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) (&V),sizeof(float)) -#define floatget(V,M) memcpy_fixed((uchar*) &V, (uchar*) (M), sizeof(float)) +#define floatstore(T,V) memcpy((T), (void *) (&V), sizeof(float)) +#define floatget(V,M) memcpy(&V, (M), sizeof(float)) #endif #ifndef doubleget -#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double)) -#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double)) +#define doubleget(V,M) memcpy(&V, (M), sizeof(double)) +#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double)) #endif /* doubleget */ -#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong)) -#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong)) +#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong)) +#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong)) #endif /* WORDS_BIGENDIAN */ @@ -1580,11 +1364,6 @@ do { doubleget_union _tmp; \ #endif #endif -/* FreeBSD 2.2.2 does not define RTLD_NOW) */ -#ifndef RTLD_NOW -#define RTLD_NOW 1 -#endif - #ifndef HAVE_DLERROR #define dlerror() "" #endif @@ -1700,8 +1479,6 @@ static inline double rint(double x) #undef HAVE_SMEM /* No shared memory */ #undef HAVE_NDBCLUSTER_DB /* No NDB cluster */ -#define DONT_USE_RAID - #endif /* EMBEDDED_LIBRARY */ #endif /* my_global_h */ diff --git a/include/my_net.h b/include/my_net.h index 1b8425984ae..5762f5da06e 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -14,9 +14,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* - thread safe version of some common functions: - my_inet_ntoa - This file is also used to make handling of sockets and ioctl() portable accross systems. @@ -76,10 +73,6 @@ C_MODE_START #define in_addr_t uint32 #endif -/* Thread safe or portable version of some functions */ - -void my_inet_ntoa(struct in_addr in, char *buf); - /* Handling of gethostbyname_r() */ diff --git a/include/my_nosys.h b/include/my_nosys.h index ecb60333830..96ba6d4c464 100644 --- a/include/my_nosys.h +++ b/include/my_nosys.h @@ -30,7 +30,7 @@ extern "C" { #include <malloc.h> #endif -#undef my_read /* Can be predefined in raid.h */ +#undef my_read #undef my_write #undef my_seek #define my_read(a,b,c,d) my_quick_read(a,b,c,d) diff --git a/include/my_sys.h b/include/my_sys.h index c5702ec7395..95689535be5 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -78,7 +78,7 @@ extern int my_errno; /* Last error in mysys */ #define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ #define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ #define MY_SYNC_DIR 8192 /* my_create/delete/rename: sync directory */ -#define MY_RAID 64 /* Support for RAID */ +#define MY_UNUSED 64 /* Unused (was support for RAID) */ #define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ #define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ @@ -101,10 +101,6 @@ extern int my_errno; /* Last error in mysys */ #define MY_GIVE_INFO 2 /* Give time info about process*/ #define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ -#define MY_REMOVE_NONE 0 /* Params for modify_defaults_file */ -#define MY_REMOVE_OPTION 1 -#define MY_REMOVE_SECTION 2 - #define ME_HIGHBYTE 8 /* Shift for colours */ #define ME_NOCUR 1 /* Don't use curses message */ #define ME_OLDWIN 2 /* Use old window */ @@ -266,13 +262,6 @@ extern const char *my_defaults_file; extern my_bool timed_mutexes; -typedef struct wild_file_pack /* Struct to hold info when selecting files */ -{ - uint wilds; /* How many wildcards */ - uint not_pos; /* Start of not-theese-files */ - char * *wild; /* Pointer to wildcards */ -} WF_PACK; - enum loglevel { ERROR_LEVEL, WARNING_LEVEL, @@ -568,7 +557,6 @@ typedef int (*Process_option_func)(void *ctx, const char *group_name, /* Prototypes for mysys and my_func functions */ extern int my_copy(const char *from,const char *to,myf MyFlags); -extern int my_append(const char *from,const char *to,myf MyFlags); extern int my_delete(const char *name,myf MyFlags); extern int my_getwd(char * buf,size_t size,myf MyFlags); extern int my_setwd(const char *dir,myf MyFlags); @@ -584,7 +572,6 @@ extern File my_register_filename(File fd, const char *FileName, extern File my_create(const char *FileName,int CreateFlags, int AccessFlags, myf MyFlags); extern int my_close(File Filedes,myf MyFlags); -extern File my_dup(File file, myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags); extern int my_readlink(char *to, const char *filename, myf MyFlags); extern int my_is_symlink(const char *filename); @@ -713,9 +700,6 @@ extern char * my_load_path(char * to, const char *path, const char *own_path_prefix); extern int wild_compare(const char *str,const char *wildstr, pbool str_is_pattern); -extern WF_PACK *wf_comp(char * str); -extern int wf_test(struct wild_file_pack *wf_pack,const char *name); -extern void wf_end(struct wild_file_pack *buffer); extern my_bool array_append_string_unique(const char *str, const char **array, size_t size); extern void get_date(char * to,int timeflag,time_t use_time); @@ -729,8 +713,6 @@ extern int end_record_cache(RECORD_CACHE *info); extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos, const uchar *record,size_t length); extern int flush_write_cache(RECORD_CACHE *info); -extern long my_clock(void); -extern sig_handler sigtstp_handler(int signal_number); extern void handle_recived_signals(void); extern sig_handler my_set_alarm_variable(int signo); @@ -852,9 +834,6 @@ extern int my_load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv, const char ***); extern int load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv); -extern int modify_defaults_file(const char *file_location, const char *option, - const char *option_value, - const char *section_name, int remove_option); extern int my_search_option_files(const char *conf_file, int *argc, char ***argv, uint *args_used, Process_option_func func, void *func_ctx, diff --git a/include/my_trie.h b/include/my_trie.h deleted file mode 100644 index 72dd485af04..00000000000 --- a/include/my_trie.h +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright (C) 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 */ - -#ifndef _trie_h -#define _trie_h -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct st_trie_node -{ - uint16 leaf; /* Depth from root node if match, 0 else */ - uchar c; /* Label on this edge */ - struct st_trie_node *next; /* Next label */ - struct st_trie_node *links; /* Array of edges leaving this node */ - struct st_trie_node *fail; /* AC failure function */ -} TRIE_NODE; - -typedef struct st_trie -{ - TRIE_NODE root; - MEM_ROOT mem_root; - CHARSET_INFO *charset; - uint32 nnodes; - uint32 nwords; -} TRIE; - -typedef struct st_ac_trie_state -{ - TRIE *trie; - TRIE_NODE *node; -} AC_TRIE_STATE; - -extern TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset); -extern void trie_free (TRIE *trie); -extern my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen); -extern my_bool ac_trie_prepare (TRIE *trie); -extern void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state); - - -/* `trie_goto' is internal function and shouldn't be used. */ - -static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, uchar c) -{ - TRIE_NODE *next; - DBUG_ENTER("trie_goto"); - for (next= node->links; next; next= next->next) - if (next->c == c) - DBUG_RETURN(next); - if (root == node) - DBUG_RETURN(root); - DBUG_RETURN(NULL); -} - - -/* - SYNOPSIS - int ac_trie_next (AC_TRIE_STATE *state, uchar *c); - state - valid pointer to `AC_TRIE_STATE' - c - character to lookup - - DESCRIPTION - Implementation of search using Aho-Corasick automaton. - Performs char-by-char search. - - RETURN VALUE - `ac_trie_next' returns length of matched word or 0. -*/ - -static inline int ac_trie_next (AC_TRIE_STATE *state, uchar *c) -{ - TRIE_NODE *root, *node; - DBUG_ENTER("ac_trie_next"); - DBUG_ASSERT(state && c); - root= &state->trie->root; - node= state->node; - while (! (state->node= trie_goto(root, node, *c))) - node= node->fail; - DBUG_RETURN(state->node->leaf); -} - - -/* - SYNOPSIS - my_bool trie_search (TRIE *trie, const uchar *key, uint keylen); - trie - valid pointer to `TRIE' - key - valid pointer to key to insert - keylen - non-0 key length - - DESCRIPTION - Performs key lookup in trie. - - RETURN VALUE - `trie_search' returns `true' if key is in `trie'. Otherwise, - `false' is returned. - - NOTES - Consecutive search here is "best by test". arrays are very short, so - binary search or hashing would add too much complexity that would - overweight speed gain. Especially because compiler can optimize simple - consecutive loop better (tested) -*/ - -static inline my_bool trie_search (TRIE *trie, const uchar *key, uint keylen) -{ - TRIE_NODE *node; - uint k; - DBUG_ENTER("trie_search"); - DBUG_ASSERT(trie && key && keylen); - node= &trie->root; - - for (k= 0; k < keylen; k++) - { - uchar p; - if (! (node= node->links)) - DBUG_RETURN(FALSE); - p= key[k]; - while (p != node->c) - if (! (node= node->next)) - DBUG_RETURN(FALSE); - } - - DBUG_RETURN(node->leaf > 0); -} - -#ifdef __cplusplus -} -#endif -#endif diff --git a/include/my_vle.h b/include/my_vle.h deleted file mode 100644 index c09f82229c4..00000000000 --- a/include/my_vle.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 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 */ - -#ifndef VLE_H -#define VLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "my_global.h" - -/* - The size (in bytes) required to store the object ITEM, which can be - either an expression or a type (since sizeof() is used on the item). -*/ -#define my_vle_sizeof(ITEM) (((sizeof(ITEM) * CHAR_BIT) + 6) / 7) - -uchar *my_vle_encode(uchar *vle, size_t max, ulong value); -uchar const *my_vle_decode(ulong *value_ptr, uchar const *vle); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/myisam.h b/include/myisam.h index 7547f6b475e..3efc65a900a 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -252,7 +252,7 @@ extern ulong myisam_block_size; extern uint myisam_concurrent_insert; extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user; extern my_off_t myisam_max_temp_length; -extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size; +extern ulong myisam_data_pointer_size; /* usually used to check if a symlink points into the mysql data home */ /* which is normally forbidden */ @@ -481,8 +481,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, const char * name, int rep_quick); int change_to_newfile(const char * filename, const char * old_ext, - const char * new_ext, uint raid_chunks, - myf myflags); + const char * new_ext, myf myflags); int lock_file(MI_CHECK *param, File file, my_off_t start, int lock_type, const char *filetype, const char *filename); void lock_memory(MI_CHECK *param); diff --git a/include/mysql_embed.h b/include/mysql_embed.h index b26b723381d..ae70b9723f8 100644 --- a/include/mysql_embed.h +++ b/include/mysql_embed.h @@ -28,7 +28,5 @@ #undef HAVE_SMEM /* No shared memory */ #undef HAVE_NDBCLUSTER_DB /* No NDB cluster */ -#define DONT_USE_RAID - #endif /* EMBEDDED_LIBRARY */ #endif /* MYSQL_EMBED_INCLUDED */ diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am index 8aa1648c834..07f66c28ddb 100644 --- a/libmysql/Makefile.am +++ b/libmysql/Makefile.am @@ -21,8 +21,8 @@ # This file is public domain and comes with NO WARRANTY of any kind target = libmysqlclient.la -target_defs = -DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID \ - -DDISABLE_MYSQL_THREAD_H @LIB_EXTRA_CCFLAGS@ +target_defs = -DMYSQL_CLIENT_NO_THREADS -DDISABLE_MYSQL_THREAD_H \ + @LIB_EXTRA_CCFLAGS@ LIBS = @CLIENT_LIBS@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ @@ -33,7 +33,7 @@ include $(srcdir)/Makefile.shared libmysqlclient_la_SOURCES = $(target_sources) libmysqlclient_la_LIBADD = $(target_libadd) $(yassl_las) libmysqlclient_la_LDFLAGS = $(target_ldflags) -EXTRA_DIST = Makefile.shared libmysql.def dll.c CMakeLists.txt +EXTRA_DIST = Makefile.shared libmysql.def CMakeLists.txt noinst_HEADERS = client_settings.h link_sources: @@ -82,7 +82,7 @@ link_sources: # keep only the stubs for debug.c # # A list of needed headers collected from the deps information 000213 -nh = my_global.h config-win32.h dbug.h errmsg.h \ +nh = my_global.h dbug.h errmsg.h \ m_ctype.h m_string.h password.h \ my_alarm.h my_config.h my_dir.h my_list.h my_net.h my_sys.h \ mysql.h mysql_com.h mysql_version.h mysqld_error.h \ diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 53264f2e559..887af62229a 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -37,7 +37,7 @@ target_sources = libmysql.c password.c \ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ strmake.lo strend.lo \ strnlen.lo strfill.lo is_prefix.lo \ - int2str.lo str2int.lo strinstr.lo strcont.lo \ + int2str.lo str2int.lo strcont.lo \ strcend.lo ctype-latin1.lo \ bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \ strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \ @@ -61,9 +61,8 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo \ mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \ my_symlink.lo my_fstream.lo mf_arr_appstr.lo \ mf_loadpath.lo my_pthread.lo my_thr_init.lo \ - thr_mutex.lo mulalloc.lo string.lo \ - default.lo default_modify.lo \ - my_compress.lo array.lo my_once.lo list.lo my_net.lo \ + thr_mutex.lo mulalloc.lo string.lo default.lo \ + my_compress.lo array.lo my_once.lo list.lo \ charset.lo charset-def.lo hash.lo mf_iocache.lo \ mf_iocache2.lo my_seek.lo my_sleep.lo \ my_pread.lo mf_cache.lo md5.lo sha1.lo \ diff --git a/libmysql/dll.c b/libmysql/dll.c deleted file mode 100644 index b5fcba13f91..00000000000 --- a/libmysql/dll.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (C) 2000-2004 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. - - There are special exceptions to the terms and conditions of the GPL as it - is applied to this software. View the full text of the exception in file - EXCEPTIONS-CLIENT in the directory of this software distribution. - - 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 initialization of the dll library -*/ - -#include <my_global.h> -#include <my_sys.h> -#include <my_pthread.h> - -static my_bool libmysql_inited=0; - -void libmysql_init(void) -{ - if (libmysql_inited) - return; - libmysql_inited=1; - my_init(); - { - DBUG_ENTER("libmysql_init"); -#ifdef LOG_ALL - DBUG_PUSH("d:t:S:O,c::\\tmp\\libmysql.log"); -#else - if (getenv("LIBMYSQL_LOG") != NULL) - DBUG_PUSH(getenv("LIBMYSQL_LOG")); -#endif - DBUG_VOID_RETURN; - } -} - -#ifdef __WIN__ - -static int inited=0,threads=0; -HINSTANCE s_hModule; /* Saved module handle */ -DWORD main_thread; - -BOOL APIENTRY LibMain(HANDLE hInst,DWORD ul_reason_being_called, - LPVOID lpReserved) -{ - switch (ul_reason_being_called) { - case DLL_PROCESS_ATTACH: /* case of libentry call in win 3.x */ - if (!inited++) - { - s_hModule=hInst; - libmysql_init(); - main_thread=GetCurrentThreadId(); - } - break; - case DLL_THREAD_ATTACH: - threads++; - my_thread_init(); - break; - case DLL_PROCESS_DETACH: /* case of wep call in win 3.x */ - if (!--inited) /* Safety */ - { - /* my_thread_init() */ /* This may give extra safety */ - my_end(0); - } - break; - case DLL_THREAD_DETACH: - /* Main thread will free by my_end() */ - threads--; - if (main_thread != GetCurrentThreadId()) - my_thread_end(); - break; - default: - break; - } /* switch */ - - return TRUE; - - UNREFERENCED_PARAMETER(lpReserved); -} /* LibMain */ - - -static BOOL do_libmain; -int __stdcall DllMain(HANDLE hInst,DWORD ul_reason_being_called,LPVOID lpReserved) -{ - /* - Unless environment variable LIBMYSQL_DLLINIT is set, do nothing. - The environment variable is checked once, during the first call to DllMain() - (in DLL_PROCESS_ATTACH hook). - */ - if (ul_reason_being_called == DLL_PROCESS_ATTACH) - do_libmain = (getenv("LIBMYSQL_DLLINIT") != NULL); - if (do_libmain) - return LibMain(hInst,ul_reason_being_called,lpReserved); - return TRUE; -} - diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c index d0ed44bd7aa..febbded6af2 100644 --- a/libmysql/errmsg.c +++ b/libmysql/errmsg.c @@ -24,139 +24,6 @@ #include <my_sys.h> #include "errmsg.h" -#ifdef GERMAN -const char *client_errors[]= -{ - "Unbekannter MySQL Fehler", - "Kann UNIX-Socket nicht anlegen (%d)", - "Keine Verbindung zu lokalem MySQL Server, socket: '%-.100s' (%d)", - "Keine Verbindung zu MySQL Server auf %-.100s (%d)", - "Kann TCP/IP-Socket nicht anlegen (%d)", - "Unbekannter MySQL Server Host (%-.100s) (%d)", - "MySQL Server nicht vorhanden", - "Protokolle ungleich; Server Version = %d, Client Version = %d", - "MySQL client ran out of memory", - "Wrong host info", - "Localhost via UNIX socket", - "%-.100s via TCP/IP", - "Error in server handshake", - "Lost connection to MySQL server during query", - "Commands out of sync; you can't run this command now", - "Verbindung ueber Named Pipe: %-.32s", - "Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)", - "Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)", - "Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)", - "Can't initialize character set %-.32s (path: %-.100s)", - "Got packet bigger than 'max_allowed_packet' bytes", - "Embedded server", - "Error on SHOW SLAVE STATUS:", - "Error on SHOW SLAVE HOSTS:", - "Error connecting to slave:", - "Error connecting to master:", - "SSL connection error", - "Malformed packet", - "This client library is licensed only for use with MySQL servers having '%s' license", - "Invalid use of null pointer", - "Statement not prepared", - "No data supplied for parameters in prepared statement", - "Data truncated", - "No parameters exist in the statement", - "Invalid parameter number", - "Can't send long data for non-string/non-binary data types (parameter: %d)", - "Using unsupported buffer type: %d (parameter: %d)", - "Shared memory: %-.100s", - "Can't open shared memory; client could not create request event (%lu)", - "Can't open shared memory; no answer event received from server (%lu)", - "Can't open shared memory; server could not allocate file mapping (%lu)", - "Can't open shared memory; server could not get pointer to file mapping (%lu)", - "Can't open shared memory; client could not allocate file mapping (%lu)", - "Can't open shared memory; client could not get pointer to file mapping (%lu)", - "Can't open shared memory; client could not create %s event (%lu)", - "Can't open shared memory; no answer from server (%lu)", - "Can't open shared memory; cannot send request event to server (%lu)", - "Wrong or unknown protocol", - "Invalid connection handle", - "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)", - "Row retrieval was canceled by mysql_stmt_close() call", - "Attempt to read column without prior row fetch", - "Prepared statement contains no metadata", - "Attempt to read a row while there is no result set associated with the statement", - "This feature is not implemented yet", - "Lost connection to MySQL server at '%s', system error: %d", - "Statement closed indirectly because of a preceeding %s() call", - "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again", - "This handle is already connected. Use a separate handle for each connection." - "" -}; - -/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */ - -#elif defined PORTUGUESE -const char *client_errors[]= -{ - "Erro desconhecido do MySQL", - "Não pode criar 'UNIX socket' (%d)", - "Não pode se conectar ao servidor MySQL local através do 'socket' '%-.100s' (%d)", - "Não pode se conectar ao servidor MySQL em '%-.100s' (%d)", - "Não pode criar 'socket TCP/IP' (%d)", - "'Host' servidor MySQL '%-.100s' (%d) desconhecido", - "Servidor MySQL desapareceu", - "Incompatibilidade de protocolos; versão do servidor = %d, versão do cliente = %d", - "Cliente do MySQL com falta de memória", - "Informação inválida de 'host'", - "Localhost via 'UNIX socket'", - "%-.100s via 'TCP/IP'", - "Erro na negociação de acesso ao servidor", - "Conexão perdida com servidor MySQL durante 'query'", - "Comandos fora de sincronismo; você não pode executar este comando agora", - "Named pipe: %-.32s", - "Não pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", - "Não pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", - "Não pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", - "Não pode inicializar conjunto de caracteres %-.32s (caminho %-.100s)", - "Obteve pacote maior do que 'max_allowed_packet' bytes", - "Embedded server" - "Error on SHOW SLAVE STATUS:", - "Error on SHOW SLAVE HOSTS:", - "Error connecting to slave:", - "Error connecting to master:", - "SSL connection error", - "Malformed packet", - "This client library is licensed only for use with MySQL servers having '%s' license", - "Invalid use of null pointer", - "Statement not prepared", - "No data supplied for parameters in prepared statement", - "Data truncated", - "No parameters exist in the statement", - "Invalid parameter number", - "Can't send long data for non-string/non-binary data types (parameter: %d)", - "Using unsupported buffer type: %d (parameter: %d)", - "Shared memory: %-.100s", - "Can't open shared memory; client could not create request event (%lu)", - "Can't open shared memory; no answer event received from server (%lu)", - "Can't open shared memory; server could not allocate file mapping (%lu)", - "Can't open shared memory; server could not get pointer to file mapping (%lu)", - "Can't open shared memory; client could not allocate file mapping (%lu)", - "Can't open shared memory; client could not get pointer to file mapping (%lu)", - "Can't open shared memory; client could not create %s event (%lu)", - "Can't open shared memory; no answer from server (%lu)", - "Can't open shared memory; cannot send request event to server (%lu)", - "Wrong or unknown protocol", - "Invalid connection handle", - "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)", - "Row retrieval was canceled by mysql_stmt_close() call", - "Attempt to read column without prior row fetch", - "Prepared statement contains no metadata", - "Attempt to read a row while there is no result set associated with the statement", - "This feature is not implemented yet", - "Lost connection to MySQL server at '%s', system error: %d", - "Statement closed indirectly because of a preceeding %s() call", - "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again", - "This handle is already connected. Use a separate handle for each connection." - "" -}; - -#else /* ENGLISH */ const char *client_errors[]= { "Unknown MySQL error", @@ -220,7 +87,6 @@ const char *client_errors[]= "This handle is already connected. Use a separate handle for each connection." "" }; -#endif const char** get_client_errmsgs() { diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 02ed93fa501..550b1b7b107 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -214,13 +214,6 @@ void STDCALL mysql_server_end() } mysql_client_init= org_my_init_done= 0; -#ifdef EMBEDDED_SERVER - if (stderror_file) - { - fclose(stderror_file); - stderror_file= 0; - } -#endif } static MYSQL_PARAMETERS mysql_internal_parameters= diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am index dab45d93673..30aa2467dab 100644 --- a/libmysql_r/Makefile.am +++ b/libmysql_r/Makefile.am @@ -21,8 +21,7 @@ # This file is public domain and comes with NO WARRANTY of any kind target = libmysqlclient_r.la -target_defs = -DDISABLE_MYSQL_PRLOCK_H -DDONT_USE_RAID \ - -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@ +target_defs = -DDISABLE_MYSQL_PRLOCK_H -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@ LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 6f553ef9c11..a7efcb024ec 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -67,7 +67,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/sql_truncate.cc ../sql/sql_lex.cc ../sql/keycaches.cc ../sql/sql_list.cc ../sql/sql_load.cc ../sql/sql_locale.cc - ../sql/sql_binlog.cc ../sql/sql_manager.cc ../sql/sql_map.cc + ../sql/sql_binlog.cc ../sql/sql_manager.cc ../sql/sql_parse.cc ../sql/sql_partition.cc ../sql/sql_plugin.cc ../sql/debug_sync.cc ../sql/sql_prepare.cc ../sql/sql_rename.cc ../sql/sql_repl.cc diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 9d8c5edaa12..1ffa349bcfe 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -66,7 +66,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ sql_profile.cc sql_truncate.cc datadict.cc \ sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \ sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \ - sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc \ + sql_lex.cc sql_list.cc sql_manager.cc \ scheduler.cc sql_connect.cc sql_parse.cc \ sql_prepare.cc sql_derived.cc sql_rename.cc \ sql_select.cc sql_do.cc sql_show.cc set_var.cc sys_vars.cc \ diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 47167f0bf96..800044242ac 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -14,6 +14,7 @@ main.information_schema # Bug#47449 2009-09-19 alik main.inform main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_multi_bug38691 times out sporadically on Solaris 10 main.log_tables # Bug#47924 2009-10-08 alik main.log_tables times out sporadically +main.lowercase_table2 @darwin # Bug#55509 2010-07-26 alik main.lowercase_table2 fails on Mac OSX (again) main.mysqlbinlog_row @solaris # Bug#52202 2010-03-22 alik mysqlbinlog_row* fail in daily-trunk on Sol10 x86_64 debug_max main.mysqlbinlog_row_innodb @solaris # Bug#52202 2010-03-22 alik mysqlbinlog_row* fail in daily-trunk on Sol10 x86_64 debug_max main.mysqlbinlog_row_myisam @solaris # Bug#52202 2010-03-22 alik mysqlbinlog_row* fail in daily-trunk on Sol10 x86_64 debug_max @@ -25,7 +26,6 @@ main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris parts.partition_alter4_innodb # Bug#45299 2010-06-28 alik Test "partition_alter4_innodb" is taking too long, timeout -perfschema.pfs_upgrade # Bug#53102 2010-06-15 alik perfschema.pfs_upgrade fails on sol10 sparc64 max in parallel mode rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index 685e1e5ba4b..028c8b32f87 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -12775,3 +12775,29 @@ a 1 2 DROP TABLE t1; +# +# Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a int) ENGINE=ARCHIVE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (1); +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +FLUSH TABLES; +INSERT INTO t1 VALUES (2); +SELECT * FROM t1 ORDER BY a; +a +1 +2 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result index 7cc76611fb8..e3a3e0e9740 100644 --- a/mysql-test/r/heap_hash.result +++ b/mysql-test/r/heap_hash.result @@ -382,3 +382,14 @@ INSERT INTO t1 VALUES('A ', 'A '); ERROR 23000: Duplicate entry 'A -A ' for key 'key1' DROP TABLE t1; End of 5.0 tests +# +# Bug #55472: Assertion failed in heap_rfirst function of hp_rfirst.c +# on DELETE statement +# +CREATE TABLE t1 (col_int_nokey INT, +col_int_key INT, +INDEX(col_int_key) USING HASH) ENGINE = HEAP; +INSERT INTO t1 (col_int_nokey, col_int_key) VALUES (3, 0), (4, 0), (3, 1); +DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2; +DROP TABLE t1; +End of 5.5 tests diff --git a/mysql-test/r/raid.result b/mysql-test/r/raid.result deleted file mode 100644 index 459da1cdf49..00000000000 --- a/mysql-test/r/raid.result +++ /dev/null @@ -1,208 +0,0 @@ -DROP TABLE IF EXISTS t1,t2; -DROP DATABASE IF EXISTS test_$1; -create database test_$1; -create table test_$1.r1 (i int) raid_type=1; -create table test_$1.r2 (i int) raid_type=1 raid_chunks=32; -drop database test_$1; -create database test_$1; -create table test_$1.r2 (i int) raid_type=1 raid_chunks=257; -show create table test_$1.r2; -Table Create Table -r2 CREATE TABLE `r2` ( - `i` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 RAID_TYPE=striped RAID_CHUNKS=255 RAID_CHUNKSIZE=256 -drop database test_$1; -CREATE TABLE t1 ( -id int unsigned not null auto_increment primary key, -c char(255) not null -) RAID_TYPE=STRIPED RAID_CHUNKS=2 RAID_CHUNKSIZE=123; -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -select count(*) from t1; -count(*) -450 -ALTER TABLE t1 ADD COLUMN x INT UNSIGNED NOT NULL; -ALTER TABLE t1 ADD KEY c (c); -ALTER TABLE t1 DROP KEY c; -ALTER TABLE t1 DROP COLUMN x; -ALTER TABLE t1 RENAME t2; -select count(*) from t2; -count(*) -450 -DROP TABLE t2; -/* variable rows */ -CREATE TABLE t1 ( -id int unsigned not null auto_increment primary key, -c varchar(255) not null -) RAID_TYPE=STRIPED RAID_CHUNKS=5 RAID_CHUNKSIZE=121; -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -INSERT INTO t1 VALUES -(NULL,'1'),(NULL,'a'),(NULL,'a'),(NULL,'a'),(NULL,'p'),(NULL,'a'), -(NULL,'2'),(NULL,'b'),(NULL,'a'),(NULL,'a'),(NULL,'q'),(NULL,'a'), -(NULL,'3'),(NULL,'c'),(NULL,'a'),(NULL,'a'),(NULL,'r'),(NULL,'a'), -(NULL,'4'),(NULL,'d'),(NULL,'a'),(NULL,'a'),(NULL,'s'),(NULL,'a'), -(NULL,'5'),(NULL,'e'),(NULL,'a'),(NULL,'a'),(NULL,'t'),(NULL,'a'), -(NULL,'6'),(NULL,'f'),(NULL,'a'),(NULL,'a'),(NULL,'u'),(NULL,'a'), -(NULL,'7'),(NULL,'g'),(NULL,'a'),(NULL,'a'),(NULL,'v'),(NULL,'a'), -(NULL,'8'),(NULL,'h'),(NULL,'a'),(NULL,'a'),(NULL,'w'),(NULL,'a'), -(NULL,'9'),(NULL,'i'),(NULL,'a'),(NULL,'a'),(NULL,'x'),(NULL,'a'), -(NULL,'0'),(NULL,'j'),(NULL,'a'),(NULL,'a'),(NULL,'y'),(NULL,'a'), -(NULL,'1'),(NULL,'k'),(NULL,'a'),(NULL,'a'),(NULL,'z'),(NULL,'a'), -(NULL,'2'),(NULL,'l'),(NULL,'a'),(NULL,'a'),(NULL,'/'),(NULL,'a'), -(NULL,'3'),(NULL,'m'),(NULL,'a'),(NULL,'a'),(NULL,'*'),(NULL,'a'), -(NULL,'4'),(NULL,'n'),(NULL,'a'),(NULL,'a'),(NULL,'+'),(NULL,'a'), -(NULL,'5'),(NULL,'o'),(NULL,'a'),(NULL,'a'),(NULL,'?'),(NULL,'a'); -select count(*) from t1; -count(*) -450 -ALTER TABLE t1 ADD COLUMN x INT UNSIGNED NOT NULL; -ALTER TABLE t1 ADD KEY c (c); -ALTER TABLE t1 DROP KEY c; -ALTER TABLE t1 DROP COLUMN x; -ALTER TABLE t1 RENAME t2; -ALTER TABLE t2 CHANGE COLUMN c c VARCHAR(251) NOT NULL; -select count(*) from t2; -count(*) -450 -DROP TABLE t2; diff --git a/mysql-test/suite/perfschema/include/upgrade_check.inc b/mysql-test/suite/perfschema/include/upgrade_check.inc new file mode 100644 index 00000000000..935a71ab065 --- /dev/null +++ b/mysql-test/suite/perfschema/include/upgrade_check.inc @@ -0,0 +1,29 @@ +# Copyright (C) 2010 Oracle and/or its affiliates. All rights reserved. +# +# 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 + +# Routine to be called by pfs_upgrade.test +# $out_file and $err_file must be set within pfs_upgrade.test. +# + +--error 1 +--exec $MYSQL_UPGRADE --skip-verbose > $out_file 2> $err_file + +# Verify that mysql_upgrade complained about the performance_schema +--cat_file $err_file +--error 0,1 +--remove_file $out_file +--error 0,1 +--remove_file $err_file + diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result index f2fe8c727b2..a0aeac5a916 100644 --- a/mysql-test/suite/perfschema/r/query_cache.result +++ b/mysql-test/suite/perfschema/r/query_cache.result @@ -65,3 +65,4 @@ Variable_name Value Qcache_hits 1 SET GLOBAL query_cache_size= default; drop table t1; +flush status; diff --git a/mysql-test/suite/perfschema/r/selects.result b/mysql-test/suite/perfschema/r/selects.result index b5bef207303..9b91c6f0fc8 100644 --- a/mysql-test/suite/perfschema/r/selects.result +++ b/mysql-test/suite/perfschema/r/selects.result @@ -55,14 +55,21 @@ THREAD_ID EVENT_ID [THREAD_ID] [EVENT_ID] [THREAD_ID] [EVENT_ID] [THREAD_ID] [EVENT_ID] +DROP TABLE IF EXISTS t_event; +DROP EVENT IF EXISTS t_ps_event; +CREATE TABLE t_event AS +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE 1 = 2; CREATE EVENT t_ps_event ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND -DO SELECT DISTINCT EVENT_ID +DO INSERT INTO t_event +SELECT DISTINCT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) ORDER BY EVENT_ID LIMIT 1; ALTER TABLE t1 ADD COLUMN c INT; +DROP TRIGGER IF EXISTS t_ps_trigger; CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN SET NEW.c = (SELECT MAX(EVENT_ID) @@ -76,6 +83,7 @@ id c 12 [EVENT_ID] 13 [EVENT_ID] DROP TRIGGER t_ps_trigger; +DROP PROCEDURE IF EXISTS t_ps_proc; CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT) BEGIN SELECT id FROM performance_schema.PROCESSLIST @@ -83,6 +91,7 @@ WHERE THREAD_ID = tid INTO pid; END; | CALL t_ps_proc(0, @p_id); +DROP FUNCTION IF EXISTS t_ps_proc; CREATE FUNCTION t_ps_func(tid INT) RETURNS int BEGIN return (SELECT id FROM performance_schema.PROCESSLIST @@ -92,6 +101,10 @@ END; SELECT t_ps_func(0) = @p_id; t_ps_func(0) = @p_id 1 +SELECT * FROM t_event; +EVENT_ID +[EVENT_ID] DROP PROCEDURE t_ps_proc; DROP FUNCTION t_ps_func; DROP TABLE t1; +DROP TABLE t_event; diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result index ac340f8eb67..70205c7f104 100644 --- a/mysql-test/suite/perfschema/r/server_init.result +++ b/mysql-test/suite/perfschema/r/server_init.result @@ -56,10 +56,6 @@ where name like "wait/synch/mutex/sql/LOCK_thread_count"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/LOCK_mapped_file"; -count(name) -1 -select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_status"; count(name) 1 diff --git a/mysql-test/suite/perfschema/t/bad_option_1.test b/mysql-test/suite/perfschema/t/bad_option_1.test index 9962f327093..ee4f0d0d160 100644 --- a/mysql-test/suite/perfschema/t/bad_option_1.test +++ b/mysql-test/suite/perfschema/t/bad_option_1.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA # Check error handling for invalid server start options @@ -19,8 +19,11 @@ --source include/not_embedded.inc --source include/have_perfschema.inc +let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_1.txt; +--error 0,1 +--remove_file $outfile --error 7 ---exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-enabled=maybe > $MYSQLTEST_VARDIR/tmp/bad_option_1.txt 2>&1 +--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-enabled=maybe > $outfile 2>&1 perl; use strict; @@ -42,4 +45,5 @@ perl; } close FILE; EOF +--remove_file $outfile diff --git a/mysql-test/suite/perfschema/t/bad_option_2.test b/mysql-test/suite/perfschema/t/bad_option_2.test index a8d15764864..b8f45be3cdf 100644 --- a/mysql-test/suite/perfschema/t/bad_option_2.test +++ b/mysql-test/suite/perfschema/t/bad_option_2.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA # Check error handling for ambiguous server start options @@ -19,8 +19,11 @@ --source include/not_embedded.inc --source include/have_perfschema.inc +let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_2.txt; +--error 0,1 +--remove_file $outfile --error 3 ---exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-max_=12 > $MYSQLTEST_VARDIR/tmp/bad_option_2.txt 2>&1 +--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-max_=12 > $outfile 2>&1 perl; use strict; @@ -41,4 +44,5 @@ perl; } close FILE; EOF +--remove_file $outfile diff --git a/mysql-test/suite/perfschema/t/global_read_lock.test b/mysql-test/suite/perfschema/t/global_read_lock.test index 16971023cbb..b953ea32ce0 100644 --- a/mysql-test/suite/perfschema/t/global_read_lock.test +++ b/mysql-test/suite/perfschema/t/global_read_lock.test @@ -81,6 +81,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; unlock tables; disconnect con1; +--source include/wait_until_disconnected.inc --echo connection default; connection default; diff --git a/mysql-test/suite/perfschema/t/pfs_upgrade.test b/mysql-test/suite/perfschema/t/pfs_upgrade.test index 4902dc73e8a..b8d25d4a66e 100644 --- a/mysql-test/suite/perfschema/t/pfs_upgrade.test +++ b/mysql-test/suite/perfschema/t/pfs_upgrade.test @@ -22,6 +22,15 @@ --source include/have_perfschema.inc --source include/have_lowercase0.inc +# Some initial settings + Preemptive cleanup +let $MYSQLD_DATADIR= `SELECT @@datadir`; +let $err_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err; +let $out_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out; +--error 0,1 +--remove_file $out_file +--error 0,1 +--remove_file $err_file + --disable_warnings drop table if exists test.user_table; drop procedure if exists test.user_proc; @@ -29,22 +38,20 @@ drop function if exists test.user_func; drop event if exists test.user_event; --enable_warnings + --echo "Testing mysql_upgrade with TABLE performance_schema.user_table" create table test.user_table(a int); -let $MYSQLD_DATADIR= `SELECT @@datadir`; +--error 0,1 +--remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm --copy_file $MYSQLD_DATADIR/test/user_table.frm $MYSQLD_DATADIR/performance_schema/user_table.frm # Make sure the table is visible use performance_schema; show tables like "user_table"; ---error 1 ---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err - -# Verify that mysql_upgrade complained about the performance_schema ---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err +--source suite/perfschema/include/upgrade_check.inc # Make sure the table is still visible show tables like "user_table"; @@ -54,22 +61,20 @@ use test; --remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm drop table test.user_table; + --echo "Testing mysql_upgrade with VIEW performance_schema.user_view" create view test.user_view as select "Not supposed to be here"; -let $MYSQLD_DATADIR= `SELECT @@datadir`; +--error 0,1 +--remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm --copy_file $MYSQLD_DATADIR/test/user_view.frm $MYSQLD_DATADIR/performance_schema/user_view.frm # Make sure the view is visible use performance_schema; show tables like "user_view"; ---error 1 ---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err - -# Verify that mysql_upgrade complained about the performance_schema ---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err +--source suite/perfschema/include/upgrade_check.inc # Make sure the view is still visible show tables like "user_view"; @@ -79,6 +84,7 @@ use test; --remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm drop view test.user_view; + --echo "Testing mysql_upgrade with PROCEDURE performance_schema.user_proc" create procedure test.user_proc() @@ -86,17 +92,14 @@ create procedure test.user_proc() update mysql.proc set db='performance_schema' where name='user_proc'; ---error 1 ---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err - -# Verify that mysql_upgrade complained about the performance_schema ---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err +--source suite/perfschema/include/upgrade_check.inc select name from mysql.proc where db='performance_schema'; update mysql.proc set db='test' where name='user_proc'; drop procedure test.user_proc; + --echo "Testing mysql_upgrade with FUNCTION performance_schema.user_func" create function test.user_func() returns integer @@ -104,17 +107,14 @@ create function test.user_func() returns integer update mysql.proc set db='performance_schema' where name='user_func'; ---error 1 ---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err - -# Verify that mysql_upgrade complained about the performance_schema ---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err +--source suite/perfschema/include/upgrade_check.inc select name from mysql.proc where db='performance_schema'; update mysql.proc set db='test' where name='user_func'; drop function test.user_func; + --echo "Testing mysql_upgrade with EVENT performance_schema.user_event" create event test.user_event on schedule every 1 day do @@ -122,17 +122,10 @@ create event test.user_event on schedule every 1 day do update mysql.event set db='performance_schema' where name='user_event'; ---error 1 ---exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err - -# Verify that mysql_upgrade complained about the performance_schema ---cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err +--source suite/perfschema/include/upgrade_check.inc select name from mysql.event where db='performance_schema'; update mysql.event set db='test' where name='user_event'; drop event test.user_event; ---remove_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out ---remove_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err - diff --git a/mysql-test/suite/perfschema/t/privilege.test b/mysql-test/suite/perfschema/t/privilege.test index d2f3c2a9e6b..2d682de2870 100644 --- a/mysql-test/suite/perfschema/t/privilege.test +++ b/mysql-test/suite/perfschema/t/privilege.test @@ -350,9 +350,9 @@ TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; --echo # Clean up - ---connection default --disconnect pfs_user_4 +--source include/wait_until_disconnected.inc +--connection default REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4; DROP USER pfs_user_4; flush privileges; diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test index 95f78d290ee..a48704dc9d6 100644 --- a/mysql-test/suite/perfschema/t/query_cache.test +++ b/mysql-test/suite/perfschema/t/query_cache.test @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (C) 2009 Sun Microsystems, Inc # # 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 @@ -10,8 +10,8 @@ # 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, -# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Tests for PERFORMANCE_SCHEMA @@ -33,7 +33,6 @@ SET GLOBAL query_cache_size=1355776; flush query cache; reset query cache; -# Reset Qcache_* to a known state flush status; select * from t1; @@ -67,4 +66,5 @@ show status like "Qcache_hits"; SET GLOBAL query_cache_size= default; drop table t1; +flush status; diff --git a/mysql-test/suite/perfschema/t/read_only.test b/mysql-test/suite/perfschema/t/read_only.test index 62631fa048f..73150207f66 100644 --- a/mysql-test/suite/perfschema/t/read_only.test +++ b/mysql-test/suite/perfschema/t/read_only.test @@ -85,6 +85,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; --enable_result_log disconnect con1; +--source include/wait_until_disconnected.inc --echo connection default; connection default; diff --git a/mysql-test/suite/perfschema/t/selects-master.opt b/mysql-test/suite/perfschema/t/selects-master.opt new file mode 100644 index 00000000000..f93413a61e5 --- /dev/null +++ b/mysql-test/suite/perfschema/t/selects-master.opt @@ -0,0 +1 @@ +--event-scheduler diff --git a/mysql-test/suite/perfschema/t/selects.test b/mysql-test/suite/perfschema/t/selects.test index d5268e8465c..a0c000b80c1 100644 --- a/mysql-test/suite/perfschema/t/selects.test +++ b/mysql-test/suite/perfschema/t/selects.test @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2009 Sun Microsystems, Inc +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA --source include/not_embedded.inc --source include/have_perfschema.inc @@ -85,20 +85,32 @@ LIMIT 5; # EVENT +# Check that the event_scheduler is really running +--source include/running_event_scheduler.inc + +--disable_warnings +DROP TABLE IF EXISTS t_event; +DROP EVENT IF EXISTS t_ps_event; +--enable_warnings +CREATE TABLE t_event AS +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE 1 = 2; CREATE EVENT t_ps_event ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND -DO SELECT DISTINCT EVENT_ID +DO INSERT INTO t_event + SELECT DISTINCT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) ORDER BY EVENT_ID LIMIT 1; ---sleep 2 - # TRIGGER ALTER TABLE t1 ADD COLUMN c INT; +--disable_warnings +DROP TRIGGER IF EXISTS t_ps_trigger; +--enable_warnings delimiter |; CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 @@ -119,6 +131,9 @@ DROP TRIGGER t_ps_trigger; # PROCEDURE +--disable_warnings +DROP PROCEDURE IF EXISTS t_ps_proc; +--enable_warnings delimiter |; CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT) @@ -135,6 +150,9 @@ CALL t_ps_proc(0, @p_id); # FUNCTION +--disable_warnings +DROP FUNCTION IF EXISTS t_ps_proc; +--enable_warnings delimiter |; CREATE FUNCTION t_ps_func(tid INT) RETURNS int @@ -149,8 +167,17 @@ delimiter ;| SELECT t_ps_func(0) = @p_id; -DROP PROCEDURE t_ps_proc; -DROP FUNCTION t_ps_func; +# We might reach this point too early which means the event scheduler has not +# execute our "t_ps_event". Therefore we poll till the record was inserted +# and run our test statement afterwards. +let $wait_timeout= 20; +let $wait_condition= SELECT COUNT(*) = 1 FROM t_event; +--source include/wait_condition.inc +--replace_column 1 [EVENT_ID] +SELECT * FROM t_event; # Clean up +DROP PROCEDURE t_ps_proc; +DROP FUNCTION t_ps_func; DROP TABLE t1; +DROP TABLE t_event; diff --git a/mysql-test/suite/perfschema/t/server_init.test b/mysql-test/suite/perfschema/t/server_init.test index cd9357cce67..b0bbe7b1bae 100644 --- a/mysql-test/suite/perfschema/t/server_init.test +++ b/mysql-test/suite/perfschema/t/server_init.test @@ -81,9 +81,6 @@ select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_thread_count"; select count(name) from MUTEX_INSTANCES - where name like "wait/synch/mutex/sql/LOCK_mapped_file"; - -select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_status"; select count(name) from MUTEX_INSTANCES diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index a3665e5f455..c3a080612a9 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1701,3 +1701,24 @@ SELECT * FROM t1; REPAIR TABLE t1 EXTENDED; SELECT * FROM t1; DROP TABLE t1; + + +--echo # +--echo # Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a int) ENGINE=ARCHIVE; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (1); +OPTIMIZE TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/t1.frm; +FLUSH TABLES; +INSERT INTO t1 VALUES (2); +SELECT * FROM t1 ORDER BY a; +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test index 1e3491f89a9..748347021fc 100644 --- a/mysql-test/t/heap_hash.test +++ b/mysql-test/t/heap_hash.test @@ -284,3 +284,20 @@ INSERT INTO t1 VALUES('A ', 'A '); DROP TABLE t1; --echo End of 5.0 tests + +--echo # +--echo # Bug #55472: Assertion failed in heap_rfirst function of hp_rfirst.c +--echo # on DELETE statement +--echo # + +CREATE TABLE t1 (col_int_nokey INT, + col_int_key INT, + INDEX(col_int_key) USING HASH) ENGINE = HEAP; +INSERT INTO t1 (col_int_nokey, col_int_key) VALUES (3, 0), (4, 0), (3, 1); + +DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2; + +DROP TABLE t1; + +--echo End of 5.5 tests + diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index fa003c2fe69..3821701ad19 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -173,7 +173,7 @@ type_long_blob longblob, index(type_short) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1; -# Not tested above: RAID_# UNION INSERT_METHOD DATA DIRECTORY INDEX DIRECTORY +# Not tested above: UNION INSERT_METHOD DATA DIRECTORY INDEX DIRECTORY show create table t1; insert into t1 (type_timestamp) values ("2003-02-07 10:00:01"); select * from t1; diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 83615c82e2a..ae41151a981 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -17,23 +17,23 @@ INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys) -SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c default_modify.c - errors.c hash.c list.c md5.c mf_brkhant.c mf_cache.c mf_dirname.c mf_fn_ext.c +SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c + errors.c hash.c list.c md5.c mf_cache.c mf_dirname.c mf_fn_ext.c mf_format.c mf_getdate.c mf_iocache.c mf_iocache2.c mf_keycache.c mf_keycaches.c mf_loadpath.c mf_pack.c mf_path.c mf_qsort.c mf_qsort2.c mf_radix.c mf_same.c mf_sort.c mf_soundex.c mf_arr_appstr.c mf_tempdir.c - mf_tempfile.c mf_unixpath.c mf_wcomp.c mf_wfile.c mulalloc.c my_access.c - my_aes.c my_alarm.c my_alloc.c my_append.c my_bit.c my_bitmap.c my_chsize.c - my_clock.c my_compress.c my_copy.c my_crc32.c my_create.c my_delete.c + mf_tempfile.c mf_unixpath.c mf_wcomp.c mulalloc.c my_access.c + my_aes.c my_alloc.c my_bit.c my_bitmap.c my_chsize.c + my_compress.c my_copy.c my_create.c my_delete.c my_div.c my_error.c my_file.c my_fopen.c my_fstream.c my_gethostbyname.c my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c - my_lib.c my_lock.c my_lockmem.c my_malloc.c my_mess.c - my_mkdir.c my_mmap.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c + my_lib.c my_lock.c my_malloc.c my_mess.c + my_mkdir.c my_mmap.c my_once.c my_open.c my_pread.c my_pthread.c my_quick.c my_read.c my_redel.c my_rename.c my_seek.c my_sleep.c my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c my_write.c ptr_cmp.c queues.c stacktrace.c rijndael.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c - thr_rwlock.c tree.c typelib.c my_vle.c base64.c my_memmem.c my_getpagesize.c + thr_rwlock.c tree.c typelib.c base64.c my_memmem.c my_getpagesize.c lf_alloc-pin.c lf_dynarray.c lf_hash.c my_atomic.c my_getncpus.c my_rdtsc.c) @@ -42,6 +42,10 @@ IF (WIN32) SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c) ENDIF() +IF(HAVE_ALARM) + SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_alarm.c) +ENDIF() + IF(NOT HAVE_CXX_NEW) # gcc as C++ compiler does not have new/delete SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_new.cc) @@ -58,10 +62,15 @@ IF(HAVE_LARGE_PAGES) SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_largepage.c) ENDIF() +IF(HAVE_MLOCK) + SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_lockmem.c) +ENDIF() + IF(UNIX) # some workarounds SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_port.c) ENDIF() + ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES}) TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY} ${LIBNSL} ${LIBM} ${LIBRT}) diff --git a/mysys/Makefile.am b/mysys/Makefile.am index a9e3f16c548..357fa321da6 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -24,31 +24,29 @@ LDADD = libmysys.a $(top_builddir)/strings/libmystrings.a $(top_builddir)/dbug 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 \ 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_open.c my_create.c my_seek.c my_read.c \ my_pread.c my_write.c my_getpagesize.c \ mf_keycaches.c my_crc32.c \ mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \ mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \ my_malloc.c my_once.c mulalloc.c \ - my_alloc.c my_new.cc my_vle.c my_atomic.c lf_hash.c \ + my_alloc.c my_new.cc my_atomic.c lf_hash.c \ lf_dynarray.c lf_alloc-pin.c \ my_fopen.c my_fstream.c my_getsystime.c \ my_error.c errors.c my_div.c my_mess.c \ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ my_symlink.c my_symlink2.c \ mf_pack.c mf_unixpath.c mf_arr_appstr.c \ - mf_wcomp.c mf_wfile.c my_gethwaddr.c \ + mf_wcomp.c my_gethwaddr.c \ mf_qsort.c mf_qsort2.c mf_sort.c \ ptr_cmp.c mf_radix.c queues.c 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 \ + tree.c list.c hash.c array.c string.c typelib.c \ + my_copy.c my_lib.c \ my_delete.c my_rename.c my_redel.c \ - my_chsize.c my_clock.c \ - my_quick.c my_lockmem.c my_static.c \ + my_chsize.c my_quick.c my_lockmem.c my_static.c \ my_sync.c my_getopt.c my_mkdir.c \ - default_modify.c default.c \ - my_compress.c checksum.c \ - my_net.c my_port.c my_sleep.c \ + default.c my_compress.c checksum.c \ + my_port.c my_sleep.c \ charset.c charset-def.c my_bitmap.c my_bit.c md5.c \ my_gethostbyname.c rijndael.c my_aes.c sha1.c \ my_handler.c my_largepage.c \ diff --git a/mysys/checksum.c b/mysys/checksum.c index 1c7c9358d53..a96ea31ea0e 100644 --- a/mysys/checksum.c +++ b/mysys/checksum.c @@ -30,13 +30,6 @@ ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length) { -#ifdef NOT_USED - const uchar *end=pos+length; - for ( ; pos != end ; pos++) - crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8)); - return crc; -#else return (ha_checksum)crc32((uint)crc, pos, (uint)length); -#endif } diff --git a/mysys/default.c b/mysys/default.c index 8002a1a0307..0e0883e1fcf 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -575,7 +575,7 @@ int my_load_defaults(const char *conf_file, const char **groups, void free_defaults(char **argv) { MEM_ROOT ptr; - memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr)); + memcpy(&ptr, ((char *) argv) - sizeof(ptr), sizeof(ptr)); free_root(&ptr,MYF(0)); } diff --git a/mysys/default_modify.c b/mysys/default_modify.c deleted file mode 100644 index edf4907cd4b..00000000000 --- a/mysys/default_modify.c +++ /dev/null @@ -1,252 +0,0 @@ -/* Copyright (C) 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 */ - -#include "my_global.h" -#include "mysys_priv.h" -#include "m_string.h" -#include <my_dir.h> - -#define BUFF_SIZE 1024 -#define RESERVE 1024 /* Extend buffer with this extent */ - -#ifdef _WIN32 -#define NEWLINE "\r\n" -#define NEWLINE_LEN 2 -#else -#define NEWLINE "\n" -#define NEWLINE_LEN 1 -#endif - -static char *add_option(char *dst, const char *option_value, - const char *option, int remove_option); - - -/* - Add/remove option to the option file section. - - SYNOPSYS - modify_defaults_file() - file_location The location of configuration file to edit - option The name of the option to look for (can be NULL) - option value The value of the option we would like to set (can be NULL) - section_name The name of the section (must be NOT NULL) - remove_option This defines what we want to remove: - - MY_REMOVE_NONE -- nothing to remove; - - MY_REMOVE_OPTION -- remove the specified option; - - MY_REMOVE_SECTION -- remove the specified section; - IMPLEMENTATION - We open the option file first, then read the file line-by-line, - looking for the section we need. At the same time we put these lines - into a buffer. Then we look for the option within this section and - change/remove it. In the end we get a buffer with modified version of the - file. Then we write it to the file, truncate it if needed and close it. - Note that there is a small time gap, when the file is incomplete, - and this theoretically might introduce a problem. - - RETURN - 0 - ok - 1 - some error has occured. Probably due to the lack of resourses - 2 - cannot open the file -*/ - -int modify_defaults_file(const char *file_location, const char *option, - const char *option_value, - const char *section_name, int remove_option) -{ - FILE *cnf_file; - MY_STAT file_stat; - char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer; - size_t opt_len= 0, optval_len= 0, sect_len, new_opt_len, reserve_extended; - uint nr_newlines= 0, buffer_size; - my_bool in_section= FALSE, opt_applied= 0; - int reserve_occupied= 0; - DBUG_ENTER("modify_defaults_file"); - - if (!(cnf_file= my_fopen(file_location, O_RDWR | O_BINARY, MYF(0)))) - DBUG_RETURN(2); - - /* my_fstat doesn't use the flag parameter */ - if (my_fstat(my_fileno(cnf_file), &file_stat, MYF(0))) - goto malloc_err; - - if (option && option_value) - { - opt_len= strlen(option); - optval_len= strlen(option_value); - } - - new_opt_len= opt_len + 1 + optval_len + NEWLINE_LEN; - - /* calculate the size of the buffer we need */ - reserve_extended= (opt_len + - 1 + /* For '=' char */ - optval_len + /* Option value len */ - NEWLINE_LEN + /* Space for newline */ - RESERVE); /* Some additional space */ - - buffer_size= (file_stat.st_size + - 1); /* The ending zero */ - - /* - Reserve space to read the contents of the file and some more - for the option we want to add. - */ - if (!(file_buffer= (char*) my_malloc(buffer_size + reserve_extended, - MYF(MY_WME)))) - goto malloc_err; - - sect_len= strlen(section_name); - - for (dst_ptr= file_buffer; fgets(linebuff, BUFF_SIZE, cnf_file); ) - { - /* Skip over whitespaces */ - for (src_ptr= linebuff; my_isspace(&my_charset_latin1, *src_ptr); - src_ptr++) - {} - - if (!*src_ptr) /* Empty line */ - { - nr_newlines++; - continue; - } - - /* correct the option (if requested) */ - if (option && in_section && !strncmp(src_ptr, option, opt_len) && - (*(src_ptr + opt_len) == '=' || - my_isspace(&my_charset_latin1, *(src_ptr + opt_len)) || - *(src_ptr + opt_len) == '\0')) - { - char *old_src_ptr= src_ptr; - src_ptr= strend(src_ptr+ opt_len); /* Find the end of the line */ - - /* could be negative */ - reserve_occupied+= (int) new_opt_len - (int) (src_ptr - old_src_ptr); - if (reserve_occupied >= (int) reserve_extended) - { - reserve_extended= (uint) reserve_occupied + RESERVE; - if (!(file_buffer= (char*) my_realloc(file_buffer, buffer_size + - reserve_extended, - MYF(MY_WME|MY_FREE_ON_ERROR)))) - goto malloc_err; - } - opt_applied= 1; - dst_ptr= add_option(dst_ptr, option_value, option, remove_option); - } - else - { - /* - If we are going to the new group and have an option to apply, do - it now. If we are removing a single option or the whole section - this will only trigger opt_applied flag. - */ - - if (in_section && !opt_applied && *src_ptr == '[') - { - dst_ptr= add_option(dst_ptr, option_value, option, remove_option); - opt_applied= 1; /* set the flag to do write() later */ - reserve_occupied= new_opt_len+ opt_len + 1 + NEWLINE_LEN; - } - - for (; nr_newlines; nr_newlines--) - dst_ptr= strmov(dst_ptr, NEWLINE); - - /* Skip the section if MY_REMOVE_SECTION was given */ - if (!in_section || remove_option != MY_REMOVE_SECTION) - dst_ptr= strmov(dst_ptr, linebuff); - } - /* Look for a section */ - if (*src_ptr == '[') - { - /* Copy the line to the buffer */ - if (!strncmp(++src_ptr, section_name, sect_len)) - { - src_ptr+= sect_len; - /* Skip over whitespaces. They are allowed after section name */ - for (; my_isspace(&my_charset_latin1, *src_ptr); src_ptr++) - {} - - if (*src_ptr != ']') - { - in_section= FALSE; - continue; /* Missing closing parenthesis. Assume this was no group */ - } - - if (remove_option == MY_REMOVE_SECTION) - dst_ptr= dst_ptr - strlen(linebuff); - - in_section= TRUE; - } - else - in_section= FALSE; /* mark that this section is of no interest to us */ - } - } - - /* - File ended. Apply an option or set opt_applied flag (in case of - MY_REMOVE_SECTION) so that the changes are saved. Do not do anything - if we are removing non-existent option. - */ - - if (!opt_applied && in_section && (remove_option != MY_REMOVE_OPTION)) - { - /* New option still remains to apply at the end */ - if (!remove_option && *(dst_ptr - 1) != '\n') - dst_ptr= strmov(dst_ptr, NEWLINE); - dst_ptr= add_option(dst_ptr, option_value, option, remove_option); - opt_applied= 1; - } - for (; nr_newlines; nr_newlines--) - dst_ptr= strmov(dst_ptr, NEWLINE); - - if (opt_applied) - { - /* Don't write the file if there are no changes to be made */ - if (my_chsize(my_fileno(cnf_file), (my_off_t) (dst_ptr - file_buffer), 0, - MYF(MY_WME)) || - my_fseek(cnf_file, 0, MY_SEEK_SET, MYF(0)) || - my_fwrite(cnf_file, (uchar*) file_buffer, (size_t) (dst_ptr - file_buffer), - MYF(MY_NABP))) - goto err; - } - if (my_fclose(cnf_file, MYF(MY_WME))) - DBUG_RETURN(1); - - my_free(file_buffer); - DBUG_RETURN(0); - -err: - my_free(file_buffer); -malloc_err: - my_fclose(cnf_file, MYF(0)); - DBUG_RETURN(1); /* out of resources */ -} - - -static char *add_option(char *dst, const char *option_value, - const char *option, int remove_option) -{ - if (!remove_option) - { - dst= strmov(dst, option); - if (*option_value) - { - *dst++= '='; - dst= strmov(dst, option_value); - } - /* add a newline */ - dst= strmov(dst, NEWLINE); - } - return dst; -} diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c index c264d3ac4c5..4ed01ac8083 100644 --- a/mysys/lf_alloc-pin.c +++ b/mysys/lf_alloc-pin.c @@ -448,8 +448,6 @@ void lf_alloc_init(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset) allocator->top= 0; allocator->mallocs= 0; allocator->element_size= size; - allocator->constructor= 0; - allocator->destructor= 0; DBUG_ASSERT(size >= sizeof(void*) + free_ptr_offset); } @@ -470,8 +468,6 @@ void lf_alloc_destroy(LF_ALLOCATOR *allocator) while (node) { uchar *tmp= anext_node(node); - if (allocator->destructor) - allocator->destructor(node); my_free(node); node= tmp; } @@ -500,8 +496,6 @@ void *_lf_alloc_new(LF_PINS *pins) if (!node) { node= (void *)my_malloc(allocator->element_size, MYF(MY_WME)); - if (allocator->constructor) - allocator->constructor(node); #ifdef MY_LF_EXTRA_DEBUG if (likely(node != 0)) my_atomic_add32(&allocator->mallocs, 1); diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c index 9c51ff1766e..e7bf82fc6ca 100644 --- a/mysys/lf_hash.c +++ b/mysys/lf_hash.c @@ -41,8 +41,6 @@ typedef struct { */ } LF_SLIST; -const int LF_HASH_OVERHEAD= sizeof(LF_SLIST); - /* a structure to pass the context (pointers two the three successive elements in a list) from lfind to linsert/ldelete diff --git a/mysys/make-conf.c b/mysys/make-conf.c deleted file mode 100644 index 0dacde4dee0..00000000000 --- a/mysys/make-conf.c +++ /dev/null @@ -1,71 +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 */ - -/* make-conf.c - * make a charset .conf file out of a ctype-charset.c file. - */ - -#ifndef CHARSET -#error You must define the charset, e.g.: -DCHARSET=latin1 -#endif - -/* some pre-processor tricks to get us going */ -#define _STRINGIZE_HELPER(x) #x -#define STRINGIZE(x) _STRINGIZE_HELPER(x) - -#define _JOIN_WORDS_HELPER(a, b) a ## b -#define JOIN_WORDS(a, b) _JOIN_WORDS_HELPER(a, b) - -#define CH_SRC ctype- ## CHARSET ## .c -#define CH_INCLUDE STRINGIZE(CH_SRC) - -/* aaaah, that's better */ -#include <my_my_global.h> -#include CH_INCLUDE - -#include <stdio.h> -#include <stdlib.h> - -#define ROW_LEN 16 - -void print_array(const char *name, const uchar *array, uint size); - -int main(void) -{ - printf("# Configuration file for the " - STRINGIZE(CHARSET) - " character set.\n"); - - print_array("ctype", JOIN_WORDS(ctype_, CHARSET), 257); - print_array("to_lower", JOIN_WORDS(to_lower_, CHARSET), 256); - print_array("to_upper", JOIN_WORDS(to_upper_, CHARSET), 256); - print_array("sort_order", JOIN_WORDS(sort_order_, CHARSET), 256); - - exit(EXIT_SUCCESS); -} - -void print_array(const char *name, const uchar *array, uint size) -{ - uint i; - - printf("\n# The %s array must have %d elements.\n", name, size); - - for (i = 0; i < size; ++i) { - printf(" %02X", array[i]); - - if ((i+1) % ROW_LEN == size % ROW_LEN) - printf("\n"); - } -} diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index daacc08044b..c4bba9c4e72 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -47,7 +47,6 @@ TODO: write buffer to the read buffer before we start to reuse it. */ -#define MAP_TO_USE_RAID #include "mysys_priv.h" #include <m_string.h> #ifdef HAVE_AIOWAIT diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 5e34bff2b51..7a40ea8a86f 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -17,7 +17,6 @@ More functions to be used with IO_CACHE files */ -#define MAP_TO_USE_RAID #include "mysys_priv.h" #include <m_string.h> #include <stdarg.h> @@ -71,6 +70,16 @@ my_b_copy_to_file(IO_CACHE *cache, FILE *file) my_off_t my_b_append_tell(IO_CACHE* info) { /* + Sometimes we want to make sure that the variable is not put into + a register in debugging mode so we can see its value in the core + */ +#ifndef DBUG_OFF +# define dbug_volatile volatile +#else +# define dbug_volatile +#endif + + /* Prevent optimizer from putting res in a register when debugging we need this to be able to see the value of res when the assert fails */ diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index c42c3d469e6..fc62d3d8a8e 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -2683,10 +2683,7 @@ uchar *key_cache_read(KEY_CACHE *keycache, #endif /* Copy data from the cache buffer */ - if (!(read_length & 511)) - bmove512(buff, block->buffer+offset, read_length); - else - memcpy(buff, block->buffer+offset, (size_t) read_length); + memcpy(buff, block->buffer+offset, (size_t) read_length); #if !defined(SERIALIZED_READ_FROM_CACHE) keycache_pthread_mutex_lock(&keycache->cache_lock); @@ -2920,10 +2917,7 @@ int key_cache_insert(KEY_CACHE *keycache, #endif /* Copy data from buff */ - if (!(read_length & 511)) - bmove512(block->buffer+offset, buff, read_length); - else - memcpy(block->buffer+offset, buff, (size_t) read_length); + memcpy(block->buffer+offset, buff, (size_t) read_length); #if !defined(SERIALIZED_READ_FROM_CACHE) keycache_pthread_mutex_lock(&keycache->cache_lock); @@ -3246,10 +3240,7 @@ int key_cache_write(KEY_CACHE *keycache, #if !defined(SERIALIZED_READ_FROM_CACHE) keycache_pthread_mutex_unlock(&keycache->cache_lock); #endif - if (!(read_length & 511)) - bmove512(block->buffer+offset, buff, read_length); - else - memcpy(block->buffer+offset, buff, (size_t) read_length); + memcpy(block->buffer+offset, buff, (size_t) read_length); #if !defined(SERIALIZED_READ_FROM_CACHE) keycache_pthread_mutex_lock(&keycache->cache_lock); diff --git a/mysys/mf_wfile.c b/mysys/mf_wfile.c deleted file mode 100644 index 95c4c006b2c..00000000000 --- a/mysys/mf_wfile.c +++ /dev/null @@ -1,123 +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 */ - -/* Functions for finding files with wildcards */ - -/* - The following file-name-test is supported: - - "name [[,] name...] ; Matches any of used filenames. - Each name can have "*" and/or "?" - wild-cards. - - [wildspec [,]] !wildspec2 ; File that matches wildspec and not - wildspec2. -*/ - -#include "mysys_priv.h" -#include <m_string.h> - - /* Store wildcard-string in a easyer format */ - -WF_PACK *wf_comp(char * str) -{ - uint ant; - int not_pos; - register char * pos; - char * buffer; - WF_PACK *ret; - DBUG_ENTER("wf_comp"); - - not_pos= -1; /* Skip space and '!' in front */ - while (*str == ' ') - str++; - if (*str == '!') - { - not_pos=0; - while (*++str == ' ') {}; - } - if (*str == 0) /* Empty == everything */ - DBUG_RETURN((WF_PACK *) NULL); - - ant=1; /* Count filespecs */ - for (pos=str ; *pos ; pos++) - ant+= test(*pos == ' ' || *pos == ','); - - if ((ret= (WF_PACK*) my_malloc((uint) ant*(sizeof(char **)+2)+ - sizeof(WF_PACK)+ (uint) strlen(str)+1, - MYF(MY_WME))) - == 0) - DBUG_RETURN((WF_PACK *) NULL); - ret->wild= (char **) (ret+1); - buffer= (char *) (ret->wild+ant); - - ant=0; - for (pos=str ; *pos ; str= pos) - { - ret->wild[ant++]=buffer; - while (*pos != ' ' && *pos != ',' && *pos != '!' && *pos) - *buffer++ = *pos++; - - *buffer++ = '\0'; - while (*pos == ' ' || *pos == ',' || *pos == '!' ) - if (*pos++ == '!' && not_pos <0) - not_pos=(int) ant; - } - - ret->wilds=ant; - if (not_pos <0) - ret->not_pos=ant; - else - ret->not_pos=(uint) not_pos; - - DBUG_PRINT("exit",("antal: %d not_pos: %d",ret->wilds,ret->not_pos)); - DBUG_RETURN(ret); -} /* wf_comp */ - - - /* Test if a given filename is matched */ - -int wf_test(register WF_PACK *wf_pack, register const char *name) -{ - reg2 uint i; - reg3 uint not_pos; - DBUG_ENTER("wf_test"); - - if (! wf_pack || wf_pack->wilds == 0) - DBUG_RETURN(0); /* Everything goes */ - - not_pos=wf_pack->not_pos; - for (i=0 ; i < not_pos; i++) - if (wild_compare(name,wf_pack->wild[i],0) == 0) - goto found; - if (i) - DBUG_RETURN(1); /* No-match */ - -found: -/* Test that it isn't in not-list */ - - for (i=not_pos ; i < wf_pack->wilds; i++) - if (wild_compare(name,wf_pack->wild[i],0) == 0) - DBUG_RETURN(1); - DBUG_RETURN(0); -} /* wf_test */ - - - /* We need this because program don't know with malloc we used */ - -void wf_end(WF_PACK *buffer) -{ - DBUG_ENTER("wf_end"); - my_free(buffer); - DBUG_VOID_RETURN; -} /* wf_end */ diff --git a/mysys/my_append.c b/mysys/my_append.c deleted file mode 100644 index 1ef3905b6f5..00000000000 --- a/mysys/my_append.c +++ /dev/null @@ -1,64 +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 "mysys_priv.h" -#include <sys/stat.h> -#include <m_string.h> -#if defined(HAVE_UTIME_H) -#include <utime.h> -#elif defined(HAVE_SYS_UTIME_H) -#include <sys/utime.h> -#elif !defined(HPUX10) -struct utimbuf { - time_t actime; - time_t modtime; -}; -#endif - -/* - Append a file to another - - NOTES - Don't set MY_FNABP or MY_NABP bits on when calling this function -*/ - -int my_append(const char *from, const char *to, myf MyFlags) -{ - size_t Count; - File from_file,to_file; - uchar buff[IO_SIZE]; - DBUG_ENTER("my_append"); - DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags)); - - from_file= to_file= -1; - - if ((from_file=my_open(from,O_RDONLY,MyFlags)) >= 0) - { - if ((to_file=my_open(to,O_APPEND | O_WRONLY,MyFlags)) >= 0) - { - while ((Count=my_read(from_file,buff,IO_SIZE,MyFlags)) != 0) - if (Count == (uint) -1 || - my_write(to_file,buff,Count,MYF(MyFlags | MY_NABP))) - goto err; - if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags)) - DBUG_RETURN(-1); /* Error on close */ - DBUG_RETURN(0); - } - } -err: - if (from_file >= 0) (void) my_close(from_file,MyFlags); - if (to_file >= 0) (void) my_close(to_file,MyFlags); - DBUG_RETURN(-1); -} diff --git a/mysys/my_atomic.c b/mysys/my_atomic.c index 6bc76f0de3c..7cbe15cfb74 100644 --- a/mysys/my_atomic.c +++ b/mysys/my_atomic.c @@ -16,13 +16,6 @@ #include <my_global.h> #include <my_sys.h> -#ifndef HAVE_INLINE -/* the following will cause all inline functions to be instantiated */ -#define HAVE_INLINE -#undef STATIC_INLINE -#define STATIC_INLINE extern -#endif - #include <my_atomic.h> /* diff --git a/mysys/my_bit.c b/mysys/my_bit.c index 2881eb1ebd2..f072f243765 100644 --- a/mysys/my_bit.c +++ b/mysys/my_bit.c @@ -15,13 +15,6 @@ #include <my_global.h> -#ifndef HAVE_INLINE -/* the following will cause all inline functions to be instantiated */ -#define HAVE_INLINE -#undef STATIC_INLINE -#define STATIC_INLINE extern -#endif - #include <my_bit.h> const char _my_bits_nbits[256] = { diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index 3de05fa8664..3401c7301e9 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -566,192 +566,6 @@ void bitmap_lock_clear_bit(MY_BITMAP *map, uint 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) diff --git a/mysys/my_clock.c b/mysys/my_clock.c deleted file mode 100644 index da04feb462f..00000000000 --- a/mysys/my_clock.c +++ /dev/null @@ -1,32 +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" - -#if !defined(_MSC_VER) && !defined(__BORLANDC__) -#include "mysys_priv.h" -#include <sys/times.h> -#endif - -long my_clock(void) -{ -#if !defined(__WIN__) - struct tms tmsbuf; - (void) times(&tmsbuf); - return (tmsbuf.tms_utime + tmsbuf.tms_stime); -#else - return clock(); -#endif -} diff --git a/mysys/my_dup.c b/mysys/my_dup.c deleted file mode 100644 index 5fdd6e9f364..00000000000 --- a/mysys/my_dup.c +++ /dev/null @@ -1,41 +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 "mysys_priv.h" -#include "mysys_err.h" -#include <my_dir.h> -#include <errno.h> -#if defined(__WIN__) -#include <share.h> -#endif - - /* Open a file */ - -File my_dup(File file, myf MyFlags) -{ - File fd; - const char *filename; - DBUG_ENTER("my_dup"); - DBUG_PRINT("my",("file: %d MyFlags: %d", file, MyFlags)); -#ifdef _WIN32 - fd= my_win_dup(file); -#else - fd= dup(file); -#endif - filename= (((uint) file < my_file_limit) ? - my_file_info[(int) file].name : "Unknown"); - DBUG_RETURN(my_register_filename(fd, filename, FILE_BY_DUP, - EE_FILENOTFOUND, MyFlags)); -} /* my_open */ diff --git a/mysys/my_handler.c b/mysys/my_handler.c index 48d100f2d3f..bd1e313d066 100644 --- a/mysys/my_handler.c +++ b/mysys/my_handler.c @@ -23,6 +23,8 @@ #include "my_handler_errors.h" +#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) + int ha_compare_text(CHARSET_INFO *charset_info, uchar *a, uint a_length, uchar *b, uint b_length, my_bool part_key, my_bool skip_end_space) diff --git a/mysys/my_init.c b/mysys/my_init.c index dbf1bfe761c..d2371278b0c 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -33,6 +33,9 @@ static my_bool win32_init_tcp_ip(); #define my_win_init() #endif +#define SCALE_SEC 100 +#define SCALE_USEC 10000 + my_bool my_init_done= 0; /** True if @c my_basic_init() has been called. */ my_bool my_basic_init_done= 0; @@ -138,9 +141,6 @@ my_bool my_init(void) #ifdef THREAD if (my_thread_global_init()) return 1; -#if !defined(__WIN__) - sigfillset(&my_signals); /* signals blocked by mf_brkhant */ -#endif #endif /* THREAD */ { DBUG_ENTER("my_init"); diff --git a/mysys/my_net.c b/mysys/my_net.c deleted file mode 100644 index e584e541175..00000000000 --- a/mysys/my_net.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc - - 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 */ - -/* thread safe version of some common functions */ - -#include "mysys_priv.h" -#include <m_string.h> - -/* for thread safe my_inet_ntoa */ -#if !defined(__WIN__) -#include <netdb.h> -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#ifdef HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif -#ifdef HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif -#endif /* !defined(__WIN__) */ - -void my_inet_ntoa(struct in_addr in, char *buf) -{ - char *ptr; - mysql_mutex_lock(&THR_LOCK_net); - ptr=inet_ntoa(in); - strmov(buf,ptr); - mysql_mutex_unlock(&THR_LOCK_net); -} diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 270d13928e3..dee34d10b38 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -138,7 +138,7 @@ void sigwait_setup(sigset_t *set) sact.sa_flags = 0; sact.sa_handler = px_handle_sig; - memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */ + memcpy(&sact.sa_mask, set, sizeof(*set)); /* handler isn't thread_safe */ sigemptyset(&unblock_mask); pthread_sigmask(SIG_UNBLOCK,(sigset_t*) 0,&rev_sigwait_set); @@ -164,7 +164,7 @@ void sigwait_setup(sigset_t *set) } } } - memcpy_fixed(&sigwait_set,set,sizeof(*set)); + memcpy(&sigwait_set, set, sizeof(*set)); pthread_sigmask(SIG_BLOCK,(sigset_t*) set,(sigset_t*) 0); pthread_sigmask(SIG_UNBLOCK,&unblock_mask,(sigset_t*) 0); } @@ -252,7 +252,7 @@ void *sigwait_thread(void *set_arg) struct sigaction sact; sact.sa_flags = 0; sact.sa_handler = sigwait_handle_sig; - memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */ + memcpy(&sact.sa_mask, set, sizeof(*set)); /* handler isn't thread_safe */ sigemptyset(&pending_set); for (i = 1; i <= sizeof(pending_set)*8; i++) diff --git a/mysys/my_static.c b/mysys/my_static.c index 2869b43543a..d7354555f3d 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -43,9 +43,6 @@ struct st_my_file_info *my_file_info= my_file_info_default; int my_dont_interrupt=0; volatile int _my_signals=0; struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}}; -#ifdef THREAD -sigset_t my_signals; /* signals blocked by mf_brkhant */ -#endif /* from mf_reccache.c */ ulong my_default_record_cache_size=RECORD_CACHE_SIZE; diff --git a/mysys/my_static.h b/mysys/my_static.h index 2c9cef0f101..7fde15ff133 100644 --- a/mysys/my_static.h +++ b/mysys/my_static.h @@ -25,9 +25,6 @@ C_MODE_START #include <signal.h> #define MAX_SIGNALS 10 /* Max signals under a dont-allow */ -#define MIN_KEYBLOCK (min(IO_SIZE,1024)) -#define MAX_KEYBLOCK 8192 /* Max keyblocklength == 8*IO_SIZE */ -#define MAX_BLOCK_TYPES MAX_KEYBLOCK/MIN_KEYBLOCK struct st_remember { int number; @@ -48,9 +45,6 @@ extern struct st_my_file_info my_file_info_default[MY_NFILE]; extern ulonglong query_performance_frequency, query_performance_offset; -#if defined(THREAD) && !defined(__WIN__) -extern sigset_t my_signals; /* signals blocked by mf_brkhant */ -#endif C_MODE_END #endif /* MYSYS_MY_STATIC_INCLUDED */ diff --git a/mysys/my_vle.c b/mysys/my_vle.c deleted file mode 100644 index 09f297eb553..00000000000 --- a/mysys/my_vle.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 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 */ - -/* - Variable length encoding. - - A method to store an arbitrary-size non-negative integer. We let the - most significant bit of the number indicate that the next byte - should be contatenated to form the real number. -*/ - -#include "my_vle.h" - -/* - Function to encode an unsigned long as VLE. The bytes for the VLE - will be written to the location pointed to by 'out'. The maximum - number of bytes written will be 'max'. - - PARAMETERS - - out Pointer to beginning of where to store VLE bytes. - max Maximum number of bytes to write. - n Number to encode. - - RETURN VALUE - On success, one past the end of the array containing the VLE - bytes. On failure, the 'out' pointer is returned. -*/ - -uchar* -my_vle_encode(uchar* out, size_t max, ulong n) -{ - uchar buf[my_vle_sizeof(n)]; - uchar *ptr= buf; - size_t len; - - do - { - *ptr++= (uchar) (n & 0x7F); - n>>= 7; - } - while (n > 0); - - len= ptr - buf; - - if (len <= max) - { - /* - The bytes are stored in reverse order in 'buf'. Let's write them - in correct order to the output buffer and set the MSB at the - same time. - */ - while (ptr-- > buf) - { - uchar v= *ptr; - if (ptr > buf) - v|= 0x80; - *out++= v; - } - } - - return out; -} - -/* - Function to decode a VLE representation of an integral value. - - - PARAMETERS - - result_ptr Pointer to an unsigned long where the value will be written. - vle Pointer to the VLE bytes. - - RETURN VALUE - - One-past the end of the VLE bytes. The routine will never read - more than sizeof(*result_ptr) + 1 bytes. -*/ - -uchar const* -my_vle_decode(ulong *result_ptr, uchar const *vle) -{ - ulong result= 0; - size_t cnt= 1; - - do - { - result<<= 7; - result|= (*vle & 0x7F); - } - while ((*vle++ & 0x80) && ++cnt <= sizeof(*result_ptr) + 1); - - if (cnt <= sizeof(*result_ptr) + 1) - *result_ptr= result; - - return vle; -} diff --git a/mysys/rijndael.c b/mysys/rijndael.c index 2b12753c4e5..2d622efad82 100644 --- a/mysys/rijndael.c +++ b/mysys/rijndael.c @@ -32,22 +32,6 @@ #define FULL_UNROLL */ - -#ifdef NOT_USED -Te0[x] = S [x].[02, 01, 01, 03]; -Te1[x] = S [x].[03, 02, 01, 01]; -Te2[x] = S [x].[01, 03, 02, 01]; -Te3[x] = S [x].[01, 01, 03, 02]; -Te4[x] = S [x].[01, 01, 01, 01]; - -Td0[x] = Si[x].[0e, 09, 0d, 0b]; -Td1[x] = Si[x].[0b, 0e, 09, 0d]; -Td2[x] = Si[x].[0d, 0b, 0e, 09]; -Td3[x] = Si[x].[09, 0d, 0b, 0e]; -Td4[x] = Si[x].[01, 01, 01, 01]; -#endif - - static const uint32 Te0[256]= { 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, diff --git a/mysys/test_charset.c b/mysys/test_charset.c index 5b399071d11..39df1b02d7b 100644 --- a/mysys/test_charset.c +++ b/mysys/test_charset.c @@ -77,15 +77,5 @@ int main(int argc, char **argv) { _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); - - 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); -#endif - return 0; } diff --git a/mysys/test_fn.c b/mysys/test_fn.c deleted file mode 100644 index 249cc878390..00000000000 --- a/mysys/test_fn.c +++ /dev/null @@ -1,69 +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 "mysys_priv.h" - -const char *test_names[]= -{ - "/usr/my/include/srclib/myfunc/dbug/test", - "test", - "dbug/test", - "/usr/my/srclib/myfunc/dbug/test", - "/usr/monty/oldcopy/jazz/setupp.frm", - "~/monty.tst", - "~/dbug/monty.tst", - "./hejsan", - "./dbug/test", - "../dbug/test", - "../myfunc/test", - "../../monty/rutedit", - "/usr/monty//usr/monty/rutedit", - "/usr/./monty/rutedit", - "/usr/my/../monty/rutedit", - "/usr/my/~/rutedit", - "~/../my", - "~/../my/srclib/myfunc/test", - "~/../my/srclib/myfunc/./dbug/test", - "/../usr/my/srclib/dbug", - "c/../my", - "/c/../my", - NullS, -}; - -int main(int argc __attribute__((unused)), char **argv) -{ - const char **pos; - char buff[FN_REFLEN],buff2[FN_REFLEN]; - DBUG_ENTER ("main"); - DBUG_PROCESS (argv[0]); - MY_INIT(argv[0]); - - if (argv[1] && argv[1][1] == '#') - DBUG_PUSH(argv[1]+2); - - for (pos=test_names; *pos ; pos++) - { - printf("org : '%s'\n",*pos); - printf("pack: '%s'\n",fn_format(buff,*pos,"","",8)); - printf("unpack: '%s'\n",fn_format(buff2,*pos,"","",4)); - unpack_filename(buff,buff); - if (strcmp(buff,buff2) != 0) - { - printf("error on cmp: '%s' != '%s'\n",buff,buff2); - } - puts(""); - } - DBUG_RETURN(0); -} diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 9ca18eeaf1b..54eef693558 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -903,11 +903,6 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) sigaddset(&set,THR_SERVER_ALARM); sigdelset(&set, thr_client_alarm); (void) pthread_sigmask(SIG_SETMASK,&set,NULL); -#ifdef NOT_USED - sigemptyset(&set); - sigaddset(&set, thr_client_alarm); - pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0); -#endif pthread_attr_init(&thr_attr); pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); diff --git a/mysys/trie.c b/mysys/trie.c deleted file mode 100644 index b2e93fcceac..00000000000 --- a/mysys/trie.c +++ /dev/null @@ -1,236 +0,0 @@ -/* Copyright (C) 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 */ - -/* - Implementation of trie and Aho-Corasick automaton. - Supports only charsets that can be compared byte-wise. - - TODO: - Add character frequencies. Can increase lookup speed - up to 30%. - Implement character-wise comparision. -*/ - - -#include "mysys_priv.h" -#include <m_string.h> -#include <my_trie.h> -#include <my_base.h> - - -/* - SYNOPSIS - TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset); - - DESCRIPTION - Allocates or initializes a `TRIE' object. If `trie' is a `NULL' - pointer, the function allocates, initializes, and returns a new - object. Otherwise, the object is initialized and the address of - the object is returned. If `trie_init()' allocates a new object, - it will be freed when `trie_free()' is called. - - RETURN VALUE - An initialized `TRIE*' object. `NULL' if there was insufficient - memory to allocate a new object. -*/ - -TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset) -{ - MEM_ROOT mem_root; - DBUG_ENTER("trie_init"); - DBUG_ASSERT(charset); - init_alloc_root(&mem_root, - (sizeof(TRIE_NODE) * 128) + ALLOC_ROOT_MIN_BLOCK_SIZE, - sizeof(TRIE_NODE) * 128); - if (! trie) - { - if (! (trie= (TRIE *)alloc_root(&mem_root, sizeof(TRIE)))) - { - free_root(&mem_root, MYF(0)); - DBUG_RETURN(NULL); - } - } - - memcpy(&trie->mem_root, &mem_root, sizeof(MEM_ROOT)); - trie->root.leaf= 0; - trie->root.c= 0; - trie->root.next= NULL; - trie->root.links= NULL; - trie->root.fail= NULL; - trie->charset= charset; - trie->nnodes= 0; - trie->nwords= 0; - DBUG_RETURN(trie); -} - - -/* - SYNOPSIS - void trie_free (TRIE *trie); - trie - valid pointer to `TRIE' - - DESCRIPTION - Frees the memory allocated for a `trie'. - - RETURN VALUE - None. -*/ - -void trie_free (TRIE *trie) -{ - MEM_ROOT mem_root; - DBUG_ENTER("trie_free"); - DBUG_ASSERT(trie); - memcpy(&mem_root, &trie->mem_root, sizeof(MEM_ROOT)); - free_root(&mem_root, MYF(0)); - DBUG_VOID_RETURN; -} - - -/* - SYNOPSIS - my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen); - trie - valid pointer to `TRIE' - key - valid pointer to key to insert - keylen - non-0 key length - - DESCRIPTION - Inserts new key into trie. - - RETURN VALUE - Upon successful completion, `trie_insert' returns `FALSE'. Otherwise - `TRUE' is returned. - - NOTES - If this function fails you must assume `trie' is broken. - However it can be freed with trie_free(). -*/ - -my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen) -{ - TRIE_NODE *node; - TRIE_NODE *next; - uchar p; - uint k; - DBUG_ENTER("trie_insert"); - DBUG_ASSERT(trie && key && keylen); - node= &trie->root; - trie->root.fail= NULL; - for (k= 0; k < keylen; k++) - { - p= key[k]; - for (next= node->links; next; next= next->next) - if (next->c == p) - break; - - if (! next) - { - TRIE_NODE *tmp= (TRIE_NODE *)alloc_root(&trie->mem_root, - sizeof(TRIE_NODE)); - if (! tmp) - DBUG_RETURN(TRUE); - tmp->leaf= 0; - tmp->c= p; - tmp->links= tmp->fail= tmp->next= NULL; - trie->nnodes++; - if (! node->links) - { - node->links= tmp; - } - else - { - for (next= node->links; next->next; next= next->next) /* no-op */; - next->next= tmp; - } - node= tmp; - } - else - { - node= next; - } - } - node->leaf= keylen; - trie->nwords++; - DBUG_RETURN(FALSE); -} - - -/* - SYNOPSIS - my_bool trie_prepare (TRIE *trie); - trie - valid pointer to `TRIE' - - DESCRIPTION - Constructs Aho-Corasick automaton. - - RETURN VALUE - Upon successful completion, `trie_prepare' returns `FALSE'. Otherwise - `TRUE' is returned. -*/ - -my_bool ac_trie_prepare (TRIE *trie) -{ - TRIE_NODE **tmp_nodes; - TRIE_NODE *node; - uint32 fnode= 0; - uint32 lnode= 0; - DBUG_ENTER("trie_prepare"); - DBUG_ASSERT(trie); - - tmp_nodes= (TRIE_NODE **)my_malloc(trie->nnodes * sizeof(TRIE_NODE *), MYF(0)); - if (! tmp_nodes) - DBUG_RETURN(TRUE); - - trie->root.fail= &trie->root; - for (node= trie->root.links; node; node= node->next) - { - node->fail= &trie->root; - tmp_nodes[lnode++]= node; - } - - while (fnode < lnode) - { - TRIE_NODE *current= (TRIE_NODE *)tmp_nodes[fnode++]; - for (node= current->links; node; node= node->next) - { - TRIE_NODE *fail= current->fail; - tmp_nodes[lnode++]= node; - while (! (node->fail= trie_goto(&trie->root, fail, node->c))) - fail= fail->fail; - } - } - my_free(tmp_nodes); - DBUG_RETURN(FALSE); -} - - -/* - SYNOPSIS - void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state); - trie - valid pointer to `TRIE' - state - value pointer to `AC_TRIE_STATE' - - DESCRIPTION - Initializes `AC_TRIE_STATE' object. -*/ - -void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state) -{ - DBUG_ENTER("ac_trie_init"); - DBUG_ASSERT(trie && state); - state->trie= trie; - state->node= &trie->root; - DBUG_VOID_RETURN; -} diff --git a/packaging/Makefile.am b/packaging/Makefile.am new file mode 100644 index 00000000000..3e6a79367b6 --- /dev/null +++ b/packaging/Makefile.am @@ -0,0 +1,14 @@ +EXTRA_DIST = \ + WiX/AdminBackground.jpg \ + WiX/AdminHeader.jpg \ + WiX/CMakeLists.txt \ + WiX/extra.wxs.in \ + WiX/CPackWixConfig.cmake \ + WiX/create_msi.cmake.in \ + WiX/custom_ui.wxs \ + WiX/MySQLServer.ico \ + WiX/mysql_server.wxs.in \ + WiX/ca/CMakeLists.txt \ + WiX/ca/CustomAction.cpp \ + WiX/ca/CustomAction.def \ + WiX/ca/CustomAction.rc diff --git a/packaging/WiX/CMakeLists.txt b/packaging/WiX/CMakeLists.txt index 8a6a4ae4c41..052887f10a1 100644 --- a/packaging/WiX/CMakeLists.txt +++ b/packaging/WiX/CMakeLists.txt @@ -41,11 +41,13 @@ FOREACH(dir mysql performance_schema) FILE(GLOB files ${CMAKE_BINARY_DIR}/sql/data/${dir}/*) SET(filelist) FOREACH(f ${files}) + IF(NOT f MATCHES ".rule") FILE(TO_NATIVE_PATH "${f}" file_native_path) GET_FILENAME_COMPONENT(file_name "${f}" NAME) SET(filelist "${filelist} <File Id='${file_name}' Source='${file_native_path}'/>") + ENDIF() ENDFOREACH() STRING(TOUPPER ${dir} DIR_UPPER) SET(DATADIR_${DIR_UPPER}_FILES "${filelist}") @@ -56,15 +58,34 @@ FIND_PROGRAM(HEAT_EXECUTABLE heat ${WIX_DIR}) FIND_PROGRAM(CANDLE_EXECUTABLE candle ${WIX_DIR}) FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR}) +# WiX wants the license text as rtf; if there is no rtf license, +# we create a fake one from the plain text COPYING file. +IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf") + SET(COPYING_RTF "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf") +ELSE() + FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING" CONTENTS) + STRING(REGEX REPLACE "\n" "\\\\par\n" CONTENTS "${CONTENTS}") + STRING(REGEX REPLACE "\t" "\\\\tab" CONTENTS "${CONTENTS}") + FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\\viewkind4\\uc1\\pard\\lang1031\\f0\\fs15") + FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "${CONTENTS}") + FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "\n}\n") + SET(COPYING_RTF "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf") +ENDIF() +GET_TARGET_PROPERTY(WIXCA_LOCATION wixca LOCATION) +SET(CPACK_WIX_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake) +SET(CPACK_WIX_INCLUDE "${CMAKE_CURRENT_BINARY_DIR}/extra.wxs;${CMAKE_CURRENT_SOURCE_DIR}/custom_ui.wxs") + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake @ONLY) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(WixWin64 " Win64='yes'") ELSE() SET(WixWin64) ENDIF() + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/extra.wxs.in ${CMAKE_CURRENT_BINARY_DIR}/extra.wxs) @@ -72,28 +93,11 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio") SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}") ENDIF() -# WiX wants the license text as rtf; if there is no rtf license, -# we create a fake one from the plain text COPYING file. -IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf") - MESSAGE("copying COPYING.rtf") - FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf" CONTENTS) - FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "${CONTENTS}") -ELSE() - MESSAGE("creating COPYING.rtf") - FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING" CONTENTS) - STRING(REGEX REPLACE "\n" "\\\\par\n" CONTENTS "${CONTENTS}") - STRING(REGEX REPLACE "\t" "\\\\tab" CONTENTS "${CONTENTS}") - FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\\viewkind4\\uc1\\pard\\lang1031\\f0\\fs15") - FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "${CONTENTS}") - FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "\n}\n") -ENDIF() ADD_CUSTOM_TARGET( MSI COMMAND set VS_UNICODE_OUTPUT= COMMAND ${CMAKE_COMMAND} - -DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake - -DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake ) @@ -103,10 +107,8 @@ ADD_CUSTOM_TARGET( MSI_ESSENTIALS COMMAND set VS_UNICODE_OUTPUT= COMMAND ${CMAKE_COMMAND} -DESSENTIALS=1 - -DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake - -DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake ) -ADD_DEPENDENCIES(MSI wixca) +ADD_DEPENDENCIES(MSI_ESSENTIALS wixca) diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake index 0413b699fc5..f49406b5787 100644 --- a/packaging/WiX/CPackWixConfig.cmake +++ b/packaging/WiX/CPackWixConfig.cmake @@ -1,6 +1,5 @@ IF(ESSENTIALS)
- MESSAGE("Essentials!")
SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles")
SET(CPACK_WIX_UI "WixUI_InstallDir")
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
@@ -60,6 +59,7 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install MySQL Server") SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
+ SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
#Feature "Devel"
diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in index d6725e9ae6c..adc3cf4c4dd 100644 --- a/packaging/WiX/create_msi.cmake.in +++ b/packaging/WiX/create_msi.cmake.in @@ -10,6 +10,10 @@ SET(MINOR_VERSION "@MINOR_VERSION@") SET(PATCH "@PATCH@")
SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
SET(MANUFACTURER "@MANUFACTURER@")
+SET(WIXCA_LOCATION "@WIXCA_LOCATION@")
+SET(COPYING_RTF "@COPYING_RTF@")
+SET(CPACK_WIX_CONFIG "@CPACK_WIX_CONFIG@")
+SET(CPACK_WIX_INCLUDE "@CPACK_WIX_INCLUDE@")
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(Win64 " Win64='yes'")
@@ -30,7 +34,7 @@ IF(CPACK_WIX_CONFIG) ENDIF()
IF(NOT CPACK_WIX_UI)
- SET(CPACK_WIX_UI "WixUI_Mondo")
+ SET(CPACK_WIX_UI "WixUI_Mondo_Custom")
ENDIF()
SET(WIX_FEATURES)
@@ -144,15 +148,16 @@ FOREACH(f ${WIX_FEATURES}) ENDFOREACH()
+IF(CMAKE_INSTALL_CONFIG_NAME)
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "${CMAKE_INSTALL_CONFIG_NAME}"
+ WIXCA_LOCATION "${WIXCA_LOCATION}")
+ SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}")
+ENDIF()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
-IF(CMAKE_INSTALL_CONFIG_NAME)
- SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}")
-ENDIF()
-
FOREACH(comp ${CPACK_COMPONENTS_ALL})
SET(ENV{DESTDIR} testinstall/${comp})
SET(DIRS ${DIRS} testinstall/${comp})
@@ -262,9 +267,12 @@ FOREACH(d ${DIRS}) SET(COMP_NAME ${d_name})
TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs "${abs}/dirs")
FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>")
- FILE(READ ${d_name}.wxs WIX_TMP)
- SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}")
- FILE(REMOVE ${d_name}.wxs)
+ IF(EXISTS ${d_name}.wxs)
+ FILE(READ ${d_name}.wxs WIX_TMP)
+ SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}")
+ FILE(REMOVE ${d_name}.wxs)
+ ENDIF()
+
FILE(READ ${d_name}_component_group.wxs WIX_TMP)
SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}")
diff --git a/packaging/WiX/custom_ui.wxs b/packaging/WiX/custom_ui.wxs new file mode 100644 index 00000000000..90db5c416fe --- /dev/null +++ b/packaging/WiX/custom_ui.wxs @@ -0,0 +1,81 @@ +<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+ <WixVariable Id="WixUICostingPopupOptOut" Value="1" Overridable="yes" />
+ <UI Id="WixUI_Mondo_Custom">
+ <Dialog Id="UpgradeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Text="Upgrade">
+ <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
+ <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish>
+ <Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
+ <Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
+ <Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
+ <Condition Action="default">WixUI_InstallMode = "Remove"</Condition>
+ </Control>
+ <Control Id="InstallTitle" Type="Text" X="15" Y="15" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallTitle)">
+ <Condition Action="show">NOT Installed</Condition>
+ </Control>
+ <Control Id="InstallText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="yes" Text="!(loc.VerifyReadyDlgInstallText)">
+ <Condition Action="show">NOT Installed</Condition>
+ </Control>
+ <Control Id="UpgradeText" Type="Text" X="25" Y="70" Width="320" Height="80" Hidden="no" NoPrefix="yes"
+ Text="Click Upgrade to upgrade your installation from version [OLDERVERSION] to version [ProductVersion]. Click Cancel to exit the upgrade."/>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.VerifyReadyDlgBannerBitmap)" />
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ </Dialog>
+
+ <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
+ <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
+ <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
+
+ <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
+ <Property Id="WixUI_Mode" Value="Mondo" />
+
+ <DialogRef Id="ErrorDlg" />
+ <DialogRef Id="FatalError" />
+ <DialogRef Id="FilesInUse" />
+ <DialogRef Id="MsiRMFilesInUse" />
+ <DialogRef Id="PrepareDlg" />
+ <DialogRef Id="ProgressDlg" />
+ <DialogRef Id="ResumeDlg" />
+ <DialogRef Id="UserExit" />
+
+ <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
+
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg" Order="1">NOT OLDERVERSIONBEINGUPGRADED</Publish>
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="UpgradeDlg" Order="2">OLDERVERSIONBEINGUPGRADED</Publish>
+
+ <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+ <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">LicenseAccepted = "1"</Publish>
+
+ <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
+ <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+
+ <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
+
+ <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
+
+ <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
+
+ <Publish Dialog="UpgradeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+ </UI>
+
+ <UIRef Id="WixUI_Common" />
+</Include>
diff --git a/packaging/WiX/extra.wxs.in b/packaging/WiX/extra.wxs.in index b6c42136129..fe2e73c3340 100644 --- a/packaging/WiX/extra.wxs.in +++ b/packaging/WiX/extra.wxs.in @@ -48,7 +48,11 @@ </Directory>
</DirectoryRef>
- <Feature Id="UserEditableDatafiles" Level='1' Display='hidden' ConfigurableDirectory="DATADIR">
+ <Feature Id='UserEditableDataFiles'
+ Title='Server data files'
+ Description='Server data files'
+ ConfigurableDirectory='DATADIR'
+ Level='1'>
<ComponentRef Id="component.datadir"/>
<ComponentRef Id="component.datadir.mysql"/>
<ComponentRef Id="component.datadir.performance_schema"/>
diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in index 8b20644e58d..59cc817a302 100644 --- a/packaging/WiX/mysql_server.wxs.in +++ b/packaging/WiX/mysql_server.wxs.in @@ -26,7 +26,9 @@ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
IncludeMinimum="yes"
Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
- Property="OLDERVERSIONBEINGUPGRADED" />
+ Property="OLDERVERSIONBEINGUPGRADED"
+ MigrateFeatures="yes"
+ />
<UpgradeVersion
Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
OnlyDetect="yes"
@@ -39,6 +41,53 @@ <RemoveExistingProducts After="InstallInitialize"/>
</InstallExecuteSequence>
+ <!-- Save/restore install location -->
+ <CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
+ <InstallExecuteSequence>
+ <Custom Action="SaveTargetDir" After="InstallValidate">
+ NOT
+ Installed
+ </Custom>
+ </InstallExecuteSequence>
+ <InstallUISequence>
+ <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
+ <AppSearch After="FindRelatedProducts"/>
+ </InstallUISequence>
+
+ <!-- Find previous installation -->
+ <Property Id="INSTALLDIR">
+ <RegistrySearch Id="FindInstallLocation"
+ Root="HKLM"
+ Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
+ Name="InstallLocation"
+ Type="raw" />
+ </Property>
+ <Property Id="OLDERVERSION">
+ <RegistrySearch Id="FindOlderVersion"
+ Root="HKLM"
+ Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
+ Name="DisplayVersion"
+ Type="raw" />
+ </Property>
+ <Property Id="DATADIR">
+ <RegistrySearch Id="FindDataDir"
+ Root="HKLM"
+ Key="SOFTWARE\MySQL AB\[ProductName]"
+ Name="DataLocation"
+ Type="raw" />
+ </Property>
+ <Property Id="INSTALLDIR2">
+ <RegistrySearch Id="FindInstallLocation2"
+ Root="HKLM"
+ Key="SOFTWARE\MySQL AB\[ProductName]"
+ Name="Location"
+ Type="raw" />
+ </Property>
+ <CustomAction Id="SetInstallDir2" Property="INSTALLDIR" Value="[INSTALLDIR2]" />
+ <InstallUISequence>
+ <Custom Action="SetInstallDir2" After="AppSearch">INSTALLDIR2</Custom>
+ </InstallUISequence>
+
<!-- UI -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
@@ -60,10 +109,10 @@ <!-- License -->
<WixVariable
Id="WixUILicenseRtf"
- Value="@CMAKE_CURRENT_BINARY_DIR@/COPYING.rtf"/>
+ Value="@COPYING_RTF@"/>
<!-- How to remove the service on uninstall -->
- <Binary Id='wixca.dll' SourceFile='@CMAKE_CURRENT_BINARY_DIR@/ca/RelWithDebInfo/wixca.dll' />
+ <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
<CustomAction Id="UnregisterProperty" Property="UnregisterService" Value="[INSTALLDIR]" Return="check" />
<CustomAction Id="UnregisterPropertySilent" Property="UnregisterServiceSilently" Value="[INSTALLDIR]" Return="check" />
<CustomAction Id="UnregisterService"
@@ -81,8 +130,8 @@ <InstallExecuteSequence>
<Custom Action="UnregisterProperty" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE</Custom>
<Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE</Custom>
- <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And UILevel>2</Custom>
- <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And UILevel<=2</Custom>
+ <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And UILevel>4</Custom>
+ <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And UILevel<=4</Custom>
</InstallExecuteSequence>
<!-- Installation root-->
diff --git a/regex/regcomp.c b/regex/regcomp.c index 81c435ed552..b41a1ae6da9 100644 --- a/regex/regcomp.c +++ b/regex/regcomp.c @@ -285,18 +285,6 @@ register struct parse *p; EMIT(ORPAREN, subno); if(MUSTEAT(')', REG_EPAREN)) {} break; -#ifndef POSIX_MISTAKE - case ')': /* happens only if no current unmatched ( */ - /* - * You may ask, why the ifndef? Because I didn't notice - * this until slightly too late for 1003.2, and none of the - * other 1003.2 regular-expression reviewers noticed it at - * all. So an unmatched ) is legal POSIX, at least until - * we can get it fixed. - */ - SETERROR(REG_EPAREN); - break; -#endif case '^': EMIT(OBOL, 0); p->g->iflags |= USEBOL; @@ -1228,66 +1216,6 @@ register char *cp; } #endif -#ifdef NOT_USED -/* - - mcsub - subtract a collating element from a cset - == static void mcsub(register cset *cs, register char *cp); - */ -static void -mcsub(cs, cp) -register cset *cs; -register char *cp; -{ - register char *fp = mcfind(cs, cp); - register size_t len = strlen(fp); - - assert(fp != NULL); - (void) memmove(fp, fp + len + 1, - cs->smultis - (fp + len + 1 - cs->multis)); - cs->smultis -= len; - - if (cs->smultis == 0) { - free(cs->multis); - cs->multis = NULL; - return; - } - - cs->multis = realloc(cs->multis, cs->smultis); - assert(cs->multis != NULL); -} - -/* - - mcin - is a collating element in a cset? - == static int mcin(register cset *cs, register char *cp); - */ -static int -mcin(cs, cp) -register cset *cs; -register char *cp; -{ - return(mcfind(cs, cp) != NULL); -} - -/* - - mcfind - find a collating element in a cset - == static char *mcfind(register cset *cs, register char *cp); - */ -static char * -mcfind(cs, cp) -register cset *cs; -register char *cp; -{ - register char *p; - - if (cs->multis == NULL) - return(NULL); - for (p = cs->multis; *p != '\0'; p += strlen(p) + 1) - if (strcmp(cp, p) == 0) - return(p); - return(NULL); -} -#endif - /* - mcinvert - invert the list of collating elements in a cset == static void mcinvert(register struct parse *p, register cset *cs); diff --git a/regex/regcomp.ih b/regex/regcomp.ih index 5deba89217a..cb93286e32f 100644 --- a/regex/regcomp.ih +++ b/regex/regcomp.ih @@ -30,11 +30,6 @@ static int nch(register struct parse *p, register cset *cs); #ifdef USE_ORIG_REGEX_CODE static void mcadd(register struct parse *p, register cset *cs, register char *cp); #endif -#ifdef NOT_USED -static void mcsub(register cset *cs, register char *cp); -static int mcin(register cset *cs, register char *cp); -static char *mcfind(register cset *cs, register char *cp); -#endif static void mcinvert(register struct parse *p, register cset *cs); static void mccase(register struct parse *p, register cset *cs); static int isinsets(register struct re_guts *g, int c); diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist index 9af722f7afc..4fb57b06d71 100755 --- a/scripts/make_win_bin_dist +++ b/scripts/make_win_bin_dist @@ -264,7 +264,6 @@ cp include/mysql.h \ include/sql_state.h \ include/mysqld_ername.h \ include/mysql_version.h \ - include/config-win.h \ libmysql/libmysql.def \ $DESTDIR/include/ diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 7107a68ee84..e8a594c4d8b 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -43,7 +43,7 @@ SET (SQL_SOURCE discover.cc ../libmysql/errmsg.c field.cc field_conv.cc filesort.cc gstream.cc sha2.cc ha_partition.cc - handler.cc hash_filo.cc hash_filo.h sql_plugin_services.h + handler.cc hash_filo.h sql_plugin_services.h hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc item_create.cc item_func.cc item_geofunc.cc item_row.cc item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc @@ -60,7 +60,7 @@ SET (SQL_SOURCE sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc - sql_list.cc sql_load.cc sql_manager.cc sql_map.cc sql_parse.cc + sql_list.cc sql_load.cc sql_manager.cc sql_parse.cc sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc debug_sync.cc debug_sync.h sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc @@ -185,22 +185,15 @@ RUN_BISON( # Gen_lex_hash ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc) -TARGET_LINK_LIBRARIES(gen_lex_hash mysys) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h - COMMAND gen_lex_hash ARGS > lex_hash.h.tmp && - ${CMAKE_COMMAND} -E copy_if_different lex_hash.h.tmp lex_hash.h - COMMAND ${CMAKE_COMMAND} -E remove -f lex_hash.h.tmp - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_lex_hash.cc) + COMMAND gen_lex_hash > lex_hash.h +) MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc) SET_TARGET_PROPERTIES(mysql_tzinfo_to_sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL") -TARGET_LINK_LIBRARIES(mysql_tzinfo_to_sql ${MYSQLD_STATIC_PLUGIN_LIBS} - mysys dbug strings vio regex - ${LIBWRAP} ${LIBCRYPT} ${LIBDL} - ${SSL_LIBRARIES}) +TARGET_LINK_LIBRARIES(mysql_tzinfo_to_sql mysys) ADD_CUSTOM_TARGET( GenServerSource diff --git a/sql/Makefile.am b/sql/Makefile.am index 4b1ecbbc8da..7fed55f3cd6 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -90,7 +90,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ item_create.h item_subselect.h item_row.h \ sql_priv.h item_geofunc.h sql_bitmap.h \ procedure.h sql_class.h sql_lex.h sql_list.h \ - sql_map.h sql_string.h unireg.h \ + sql_string.h unireg.h \ sql_error.h field.h handler.h mysqld_suffix.h \ sql_profile.h mysqld.h sql_help.h frm_crypt.h \ ha_ndbcluster.h ha_ndbcluster_cond.h \ @@ -135,7 +135,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ item_row.cc item_geofunc.cc item_xmlfunc.cc \ field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \ net_serv.cc protocol.cc sql_state.c \ - lock.cc sql_string.cc sql_manager.cc sql_map.cc \ + lock.cc sql_string.cc sql_manager.cc \ main.cc mysqld.cc password.c hash_filo.cc hostname.cc \ sql_connect.cc scheduler.cc sql_parse.cc \ keycaches.cc set_var.cc sql_yacc.yy sys_vars.cc \ @@ -160,8 +160,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ rpl_reporting.cc \ sql_union.cc sql_derived.cc \ sql_client.cc \ - repl_failsafe.h repl_failsafe.cc \ - sql_olap.cc sql_view.cc \ + repl_failsafe.h repl_failsafe.cc sql_view.cc \ gstream.cc spatial.cc sql_help.cc sql_cursor.cc \ tztime.cc my_decimal.cc\ sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \ diff --git a/sql/field.cc b/sql/field.cc index 56d60ff5b28..75576c59876 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1277,61 +1277,6 @@ int Field::warn_if_overflow(int op_result) } -#ifdef NOT_USED -static bool test_if_real(const char *str,int length, CHARSET_INFO *cs) -{ - cs= system_charset_info; // QQ move test_if_real into CHARSET_INFO struct - - while (length && my_isspace(cs,*str)) - { // Allow start space - length--; str++; - } - if (!length) - return 0; - if (*str == '+' || *str == '-') - { - length--; str++; - if (!length || !(my_isdigit(cs,*str) || *str == '.')) - return 0; - } - while (length && my_isdigit(cs,*str)) - { - length--; str++; - } - if (!length) - return 1; - if (*str == '.') - { - length--; str++; - while (length && my_isdigit(cs,*str)) - { - length--; str++; - } - } - if (!length) - return 1; - if (*str == 'E' || *str == 'e') - { - if (length < 3 || (str[1] != '+' && str[1] != '-') || - !my_isdigit(cs,str[2])) - return 0; - length-=3; - str+=3; - while (length && my_isdigit(cs,*str)) - { - length--; str++; - } - } - for (; length ; length--, str++) - { // Allow end space - if (!my_isspace(cs,*str)) - return 0; - } - return 1; -} -#endif - - /** Interpret field value as an integer but return the result as a string. @@ -4198,7 +4143,7 @@ int Field_float::store(double nr) } else #endif - memcpy_fixed(ptr,(uchar*) &j,sizeof(j)); + memcpy(ptr, &j, sizeof(j)); return error; } @@ -4221,7 +4166,7 @@ double Field_float::val_real(void) } else #endif - memcpy_fixed((uchar*) &j,ptr,sizeof(j)); + memcpy(&j, ptr, sizeof(j)); return ((double) j); } @@ -4235,7 +4180,7 @@ longlong Field_float::val_int(void) } else #endif - memcpy_fixed((uchar*) &j,ptr,sizeof(j)); + memcpy(&j, ptr, sizeof(j)); return (longlong) rint(j); } @@ -4252,7 +4197,7 @@ String *Field_float::val_str(String *val_buffer, } else #endif - memcpy_fixed((uchar*) &nr,ptr,sizeof(nr)); + memcpy(&nr, ptr, sizeof(nr)); uint to_length=max(field_length,70); val_buffer->alloc(to_length); @@ -4290,8 +4235,8 @@ int Field_float::cmp(const uchar *a_ptr, const uchar *b_ptr) else #endif { - memcpy_fixed(&a,a_ptr,sizeof(float)); - memcpy_fixed(&b,b_ptr,sizeof(float)); + memcpy(&a, a_ptr, sizeof(float)); + memcpy(&b, b_ptr, sizeof(float)); } return (a < b) ? -1 : (a > b) ? 1 : 0; } @@ -4308,7 +4253,7 @@ void Field_float::sort_string(uchar *to,uint length __attribute__((unused))) } else #endif - memcpy_fixed(&nr,ptr,sizeof(float)); + memcpy(&nr, ptr, sizeof(float)); uchar *tmp= to; if (nr == (float) 0.0) @@ -4319,7 +4264,7 @@ void Field_float::sort_string(uchar *to,uint length __attribute__((unused))) else { #ifdef WORDS_BIGENDIAN - memcpy_fixed(tmp,&nr,sizeof(nr)); + memcpy(tmp, &nr, sizeof(nr)); #else tmp[0]= ptr[3]; tmp[1]=ptr[2]; tmp[2]= ptr[1]; tmp[3]=ptr[0]; #endif @@ -7497,7 +7442,7 @@ double Field_blob::val_real(void) uint32 length; CHARSET_INFO *cs; - memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); + memcpy(&blob, ptr+packlength, sizeof(char*)); if (!blob) return 0.0; length= get_length(ptr); @@ -7511,7 +7456,7 @@ longlong Field_blob::val_int(void) ASSERT_COLUMN_MARKED_FOR_READ; int not_used; char *blob; - memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); + memcpy(&blob, ptr+packlength, sizeof(char*)); if (!blob) return 0; uint32 length=get_length(ptr); @@ -7523,7 +7468,7 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)), { ASSERT_COLUMN_MARKED_FOR_READ; char *blob; - memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); + memcpy(&blob, ptr+packlength, sizeof(char*)); if (!blob) val_ptr->set("",0,charset()); // A bit safer than ->length(0) else @@ -7537,7 +7482,7 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value) ASSERT_COLUMN_MARKED_FOR_READ; const char *blob; size_t length; - memcpy_fixed(&blob, ptr+packlength, sizeof(const uchar*)); + memcpy(&blob, ptr+packlength, sizeof(const uchar*)); if (!blob) { blob= ""; @@ -7565,8 +7510,8 @@ int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr, uint max_length) { uchar *blob1,*blob2; - memcpy_fixed(&blob1,a_ptr+packlength,sizeof(char*)); - memcpy_fixed(&blob2,b_ptr+packlength,sizeof(char*)); + memcpy(&blob1, a_ptr+packlength, sizeof(char*)); + memcpy(&blob2, b_ptr+packlength, sizeof(char*)); uint a_len= get_length(a_ptr), b_len= get_length(b_ptr); set_if_smaller(a_len, max_length); set_if_smaller(b_len, max_length); @@ -7580,8 +7525,8 @@ int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr, char *a,*b; uint diff; uint32 a_length,b_length; - memcpy_fixed(&a,a_ptr+packlength,sizeof(char*)); - memcpy_fixed(&b,b_ptr+packlength,sizeof(char*)); + memcpy(&a, a_ptr+packlength, sizeof(char*)); + memcpy(&b, b_ptr+packlength, sizeof(char*)); a_length=get_length(a_ptr); if (a_length > max_length) a_length=max_length; @@ -7662,7 +7607,7 @@ int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length) { uchar *blob1; uint blob_length=get_length(ptr); - memcpy_fixed(&blob1,ptr+packlength,sizeof(char*)); + memcpy(&blob1, ptr+packlength, sizeof(char*)); CHARSET_INFO *cs= charset(); uint local_char_length= max_key_length / cs->mbmaxlen; local_char_length= my_charpos(cs, blob1, blob1+blob_length, @@ -7740,7 +7685,7 @@ void Field_blob::sort_string(uchar *to,uint length) break; } } - memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); + memcpy(&blob, ptr+packlength, sizeof(char*)); blob_length=my_strnxfrm(field_charset, to, length, blob, blob_length); @@ -8709,7 +8654,7 @@ String *Field_bit::val_str(String *val_buffer, mi_int8store(buff,bits); val_buffer->alloc(length); - memcpy_fixed((char*) val_buffer->ptr(), buff+8-length, length); + memcpy((char *) val_buffer->ptr(), buff+8-length, length); val_buffer->length(length); val_buffer->set_charset(&my_charset_bin); return val_buffer; diff --git a/sql/field.h b/sql/field.h index 46d8a2aa6d9..7b250c34fe4 100644 --- a/sql/field.h +++ b/sql/field.h @@ -32,7 +32,6 @@ #include "sql_error.h" /* MYSQL_ERROR */ #define DATETIME_DEC 6 -const uint32 max_field_size= (uint32) 4294967295U; class Send_field; class Protocol; @@ -1763,22 +1762,22 @@ public: void put_length(uchar *pos, uint32 length); inline void get_ptr(uchar **str) { - memcpy_fixed((uchar*) str,ptr+packlength,sizeof(uchar*)); + memcpy(str, ptr+packlength, sizeof(uchar*)); } inline void get_ptr(uchar **str, uint row_offset) { - memcpy_fixed((uchar*) str,ptr+packlength+row_offset,sizeof(char*)); + memcpy(str, ptr+packlength+row_offset, sizeof(char*)); } inline void set_ptr(uchar *length, uchar *data) { memcpy(ptr,length,packlength); - memcpy_fixed(ptr+packlength,&data,sizeof(char*)); + memcpy(ptr+packlength, &data,sizeof(char*)); } void set_ptr_offset(my_ptrdiff_t ptr_diff, uint32 length, uchar *data) { uchar *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,uchar*); store_length(ptr_ofs, packlength, length); - memcpy_fixed(ptr_ofs+packlength,&data,sizeof(char*)); + memcpy(ptr_ofs+packlength, &data, sizeof(char*)); } inline void set_ptr(uint32 length, uchar *data) { @@ -1797,7 +1796,7 @@ public: return 1; } tmp=(uchar*) value.ptr(); - memcpy_fixed(ptr+packlength,&tmp,sizeof(char*)); + memcpy(ptr+packlength, &tmp, sizeof(char*)); return 0; } virtual uchar *pack(uchar *to, const uchar *from, diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 299865e6114..ea6ff82e0aa 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -286,7 +286,7 @@ static void do_copy_blob(Copy_field *copy) { ulong length=((Field_blob*) copy->from_field)->get_length(); ((Field_blob*) copy->to_field)->store_length(length); - memcpy_fixed(copy->to_ptr,copy->from_ptr,sizeof(char*)); + memcpy(copy->to_ptr, copy->from_ptr, sizeof(char*)); } static void do_conv_blob(Copy_field *copy) diff --git a/sql/filesort.cc b/sql/filesort.cc index b98a7f780f4..419f18263cc 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1665,7 +1665,7 @@ void change_double_for_sort(double nr,uchar *to) else { #ifdef WORDS_BIGENDIAN - memcpy_fixed(tmp,&nr,sizeof(nr)); + memcpy(tmp, &nr, sizeof(nr)); #else { uchar *ptr= (uchar*) &nr; diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 5a0904f87b9..a9c03f7e2a7 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -77,33 +77,12 @@ So, we can read full search-structure as 32-bit word */ #define NO_YACC_SYMBOLS -#include "my_global.h" -#include "my_sys.h" -#include "m_string.h" -#ifndef __GNU_LIBRARY__ -#define __GNU_LIBRARY__ // Skip warnings in getopt.h -#endif -#include <my_getopt.h> +#include <my_global.h> #include "mysql_version.h" #include "lex.h" - -const char *default_dbug_option="d:t:o,/tmp/gen_lex_hash.trace"; - -struct my_option my_long_options[] = -{ -#ifdef DBUG_OFF - {"debug", '#', "This is a non-debug version. Catch this and exit", - 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#else - {"debug", '#', "Output debug log", (uchar**) &default_dbug_option, - (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#endif - {"help", '?', "Display help and exit", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"version", 'V', "Output version information and exit", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} -}; +#include <stdlib.h> +#include <stdio.h> +#include <string.h> struct hash_lex_struct { @@ -340,57 +319,6 @@ void print_find_structs() } -static void usage(int version) -{ - printf("%s Ver 3.6 Distrib %s, for %s (%s)\n", - my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); - if (version) - return; - puts("Copyright (C) 2001 MySQL AB, by VVA and Monty"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ -and you are welcome to modify and redistribute it under the GPL license\n"); - puts("This program generates a perfect hashing function for the sql_lex.cc"); - printf("Usage: %s [OPTIONS]\n\n", my_progname); - my_print_help(my_long_options); -} - - -extern "C" my_bool -get_one_option(int optid, const struct my_option *opt __attribute__((unused)), - char *argument __attribute__((unused))) -{ - switch(optid) { - case 'V': - usage(1); - exit(0); - case 'I': - case '?': - usage(0); - exit(0); - case '#': - DBUG_PUSH(argument ? argument : default_dbug_option); - break; - } - return 0; -} - - -static int get_options(int argc, char **argv) -{ - int ho_error; - - if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option))) - exit(ho_error); - - if (argc >= 1) - { - usage(0); - exit(1); - } - return(0); -} - - int check_dup_symbols(SYMBOL *s1, SYMBOL *s2) { if (s1->length!=s2->length || strncmp(s1->name,s2->name,s1->length)) @@ -441,11 +369,7 @@ int check_duplicates() int main(int argc,char **argv) { - MY_INIT(argv[0]); - DBUG_PROCESS(argv[0]); - if (get_options(argc,(char **) argv)) - exit(1); /* Broken up to indicate that it's not advice to you, gentle reader. */ printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); @@ -562,7 +486,6 @@ static SYMBOL *get_hash_symbol(const char *s,\n\ }\n\ }\n" ); - my_end(0); exit(0); } diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index bd3cd780bc5..7891f658f45 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -64,10 +64,6 @@ #include "debug_sync.h" static const char *ha_par_ext= ".par"; -#ifdef NOT_USED -static int free_share(PARTITION_SHARE * share); -static PARTITION_SHARE *get_share(const char *table_name, TABLE * table); -#endif /**************************************************************************** MODULE create/delete handler object @@ -1129,13 +1125,6 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, part= i * num_subparts + j; DBUG_PRINT("info", ("Optimize subpartition %u (%s)", part, sub_elem->partition_name)); -#ifdef NOT_USED - if (print_admin_msg(thd, "note", table_share->db.str, table->alias, - opt_op_name[flag], - "Start to operate on subpartition %s", - sub_elem->partition_name)) - DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR); -#endif if ((error= handle_opt_part(thd, check_opt, m_file[part], flag))) { /* print a line which partition the error belongs to */ @@ -1162,13 +1151,6 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, { DBUG_PRINT("info", ("Optimize partition %u (%s)", i, part_elem->partition_name)); -#ifdef NOT_USED - if (print_admin_msg(thd, "note", table_share->db.str, table->alias, - opt_op_name[flag], - "Start to operate on partition %s", - part_elem->partition_name)) - DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR); -#endif if ((error= handle_opt_part(thd, check_opt, m_file[i], flag))) { /* print a line which partition the error belongs to */ diff --git a/sql/ha_partition.h b/sql/ha_partition.h index cdbfb2163c7..cfab2dde394 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -143,9 +143,6 @@ private: Variables for lock structures. */ THR_LOCK_DATA lock; /* MySQL lock */ -#ifdef NOT_USED - PARTITION_SHARE *share; /* Shared lock info */ -#endif /* TRUE <=> this object was created with ha_partition::clone and doesn't diff --git a/sql/handler.cc b/sql/handler.cc index b42840c7b1b..efbc335f9b2 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -190,15 +190,6 @@ plugin_ref ha_lock_engine(THD *thd, const handlerton *hton) } -#ifdef NOT_USED -static handler *create_default(TABLE_SHARE *table, MEM_ROOT *mem_root) -{ - handlerton *hton= ha_default_handlerton(current_thd); - return (hton && hton->create) ? hton->create(hton, table, mem_root) : NULL; -} -#endif - - handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type) { plugin_ref plugin; @@ -239,10 +230,6 @@ handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type, RUN_HOOK(transaction, after_rollback, (thd, FALSE)); switch (database_type) { -#ifndef NO_HASH - case DB_TYPE_HASH: - return ha_resolve_by_legacy_type(thd, DB_TYPE_HASH); -#endif case DB_TYPE_MRG_ISAM: return ha_resolve_by_legacy_type(thd, DB_TYPE_MRG_MYISAM); default: diff --git a/sql/handler.h b/sql/handler.h index 96095798d18..a7951ddf781 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -33,10 +33,6 @@ #include <ft_global.h> #include <keycache.h> -#ifndef NO_HASH -#define NO_HASH /* Not yet implemented */ -#endif - // the following is for checking tables #define HA_ADMIN_ALREADY_DONE 1 diff --git a/sql/hostname.cc b/sql/hostname.cc index d309efc4196..5311d9ada73 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -126,7 +126,7 @@ static void prepare_hostname_cache_key(const char *ip_string, DBUG_ASSERT(ip_string_length < HOST_ENTRY_KEY_SIZE); memset(ip_key, 0, HOST_ENTRY_KEY_SIZE); - memcpy_fixed(ip_key, ip_string, ip_string_length); + memcpy(ip_key, ip_string, ip_string_length); } static inline Host_entry *hostname_cache_search(const char *ip_key) @@ -148,7 +148,7 @@ static bool add_hostname_impl(const char *ip_key, const char *hostname) char *hostname_copy; - memcpy_fixed(&entry->ip_key, ip_key, HOST_ENTRY_KEY_SIZE); + memcpy(&entry->ip_key, ip_key, HOST_ENTRY_KEY_SIZE); if (hostname_size) { diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 2a7c9ac8144..85565b735d4 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -4720,8 +4720,6 @@ void Item_func_like::cleanup() Item_bool_func2::cleanup(); } -#ifdef USE_REGEX - /** @brief Compile regular expression. @@ -4873,9 +4871,6 @@ void Item_func_regex::cleanup() } -#endif /* USE_REGEX */ - - #ifdef LIKE_CMP_TOUPPER #define likeconv(cs,A) (uchar) (cs)->toupper(A) #else diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index b20a6892ce2..f9851011563 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -25,6 +25,7 @@ #include "thr_malloc.h" /* sql_calloc */ #include "item_func.h" /* Item_int_func, Item_bool_func */ +#include "my_regex.h" extern Item_result item_cmp_type(Item_result a,Item_result b); class Item_bool_func2; @@ -268,7 +269,7 @@ protected: my_bool result_for_null_param; public: Item_in_optimizer(Item *a, Item_in_subselect *b): - Item_bool_func(a, my_reinterpret_cast(Item *)(b)), cache(0), + Item_bool_func(a, reinterpret_cast<Item *>(b)), cache(0), save_cache(0), result_for_null_param(UNKNOWN) {} bool fix_fields(THD *, Item **); @@ -1434,9 +1435,6 @@ public: void cleanup(); }; -#ifdef USE_REGEX - -#include "my_regex.h" class Item_func_regex :public Item_bool_func { @@ -1465,23 +1463,6 @@ public: CHARSET_INFO *compare_collation() { return cmp_collation.collation; } }; -#else - -class Item_func_regex :public Item_bool_func -{ -public: - Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b) {} - longlong val_int() { return 0;} - const char *func_name() const { return "regex"; } - - virtual inline void print(String *str, enum_query_type query_type) - { - print_op(str, query_type); - } -}; - -#endif /* USE_REGEX */ - typedef class Item COND; diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index e046087b16a..d734b55a970 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -49,7 +49,7 @@ void Item_geometry_func::fix_length_and_dec() { collation.set(&my_charset_bin); decimals=0; - max_length= max_field_size; + max_length= (uint32) 4294967295U; maybe_null= 1; } diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 34b09ca6fdc..d8d18fd8ef6 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -184,7 +184,7 @@ public: void fix_length_and_dec(); uint cols(); - Item* element_index(uint i) { return my_reinterpret_cast(Item*)(row[i]); } + Item* element_index(uint i) { return reinterpret_cast<Item*>(row[i]); } Item** addr(uint i) { return (Item**)row + i; } bool check_cols(uint c); bool null_inside(); diff --git a/sql/log.h b/sql/log.h index 4a58c3081d8..6e87b6cbade 100644 --- a/sql/log.h +++ b/sql/log.h @@ -637,7 +637,6 @@ enum enum_binlog_format { BINLOG_FORMAT_ROW= 2, ///< row-based BINLOG_FORMAT_UNSPEC=3 ///< thd_binlog_format() returns it when binlog is closed }; -extern TYPELIB binlog_format_typelib; int query_error_code(THD *thd, bool not_killed); uint purge_log_get_error_code(int res); diff --git a/sql/log_event.cc b/sql/log_event.cc index 5236a2794cf..fe8d13fac9c 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3719,6 +3719,7 @@ bool Start_log_event_v3::write(IO_CACHE* file) int Start_log_event_v3::do_apply_event(Relay_log_info const *rli) { DBUG_ENTER("Start_log_event_v3::do_apply_event"); + int error= 0; switch (binlog_version) { case 3: @@ -3731,7 +3732,7 @@ int Start_log_event_v3::do_apply_event(Relay_log_info const *rli) */ if (created) { - close_temporary_tables(thd); + error= close_temporary_tables(thd); cleanup_load_tmpdir(); } else @@ -3759,7 +3760,7 @@ int Start_log_event_v3::do_apply_event(Relay_log_info const *rli) Can distinguish, based on the value of 'created': this event was generated at master startup. */ - close_temporary_tables(thd); + error= close_temporary_tables(thd); } /* Otherwise, can't distinguish a Start_log_event generated at @@ -3771,7 +3772,7 @@ int Start_log_event_v3::do_apply_event(Relay_log_info const *rli) /* this case is impossible */ DBUG_RETURN(1); } - DBUG_RETURN(0); + DBUG_RETURN(error); } #endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1a44115d893..cb579324644 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -294,12 +294,6 @@ arg_cmp_func Arg_comparator::comparator_matrix[5][2] = {&Arg_comparator::compare_row, &Arg_comparator::compare_e_row}, {&Arg_comparator::compare_decimal, &Arg_comparator::compare_e_decimal}}; -const char *log_output_names[] = { "NONE", "FILE", "TABLE", NullS}; -static const unsigned int log_output_names_len[]= { 4, 4, 5, 0 }; -TYPELIB log_output_typelib= {array_elements(log_output_names)-1,"", - log_output_names, - (unsigned int *) log_output_names_len}; - /* static variables */ #ifdef HAVE_PSI_INTERFACE @@ -395,8 +389,8 @@ my_bool opt_skip_slave_start = 0; ///< If set, slave is not autostarted my_bool opt_reckless_slave = 0; my_bool opt_enable_named_pipe= 0; my_bool opt_local_infile, opt_slave_compressed_protocol; -my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; -my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; +my_bool opt_safe_user_create = 0; +my_bool opt_show_slave_auth_info; my_bool opt_log_slave_updates= 0; char *opt_slave_skip_errors; @@ -440,9 +434,6 @@ my_bool sp_automatic_privileges= 1; ulong opt_binlog_rows_event_max_size; const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS}; -TYPELIB binlog_format_typelib= - { array_elements(binlog_format_names) - 1, "", - binlog_format_names, NULL }; #ifdef HAVE_INITGROUPS static bool calling_initgroups= FALSE; /**< Used in SIGSEGV handler. */ #endif @@ -458,7 +449,7 @@ ulong thread_created; ulong back_log, connect_timeout, concurrency, server_id; ulong table_cache_size, table_def_size; ulong what_to_log; -ulong query_buff_size, slow_launch_time, slave_open_temp_tables; +ulong slow_launch_time, slave_open_temp_tables; ulong open_files_limit, max_binlog_size, max_relay_log_size; ulong slave_trans_retries; uint slave_net_timeout; @@ -547,7 +538,6 @@ char mysql_real_data_home[FN_REFLEN], mysql_charsets_dir[FN_REFLEN], *opt_init_file, *opt_tc_log_file; char *lc_messages_dir_ptr, *log_error_file_ptr; -char err_shared_dir[FN_REFLEN]; char mysql_unpacked_real_data_home[FN_REFLEN]; int mysql_unpacked_real_data_home_len; uint mysql_real_data_home_len, mysql_data_home_len= 1; @@ -581,7 +571,6 @@ Le_creator le_creator; MYSQL_FILE *bootstrap_file; int bootstrap_error; -FILE *stderror_file=0; I_List<THD> threads; Rpl_filter* rpl_filter; @@ -613,7 +602,7 @@ pthread_key(MEM_ROOT**,THR_MALLOC); pthread_key(THD*, THR_THD); mysql_mutex_t LOCK_thread_count; mysql_mutex_t LOCK_mysql_create_db, LOCK_open, - LOCK_mapped_file, LOCK_status, LOCK_global_read_lock, + LOCK_status, LOCK_global_read_lock, LOCK_error_log, LOCK_uuid_generator, LOCK_delayed_insert, LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, @@ -1476,9 +1465,7 @@ void clean_up(bool print_message) delete rpl_filter; end_ssl(); vio_end(); -#ifdef USE_REGEX my_regex_end(); -#endif #if defined(ENABLED_DEBUG_SYNC) /* End the debug sync facility. See debug_sync.cc. */ debug_sync_end(); @@ -1543,7 +1530,6 @@ static void clean_up_mutexes() mysql_rwlock_destroy(&LOCK_grant); mysql_mutex_destroy(&LOCK_open); mysql_mutex_destroy(&LOCK_thread_count); - mysql_mutex_destroy(&LOCK_mapped_file); mysql_mutex_destroy(&LOCK_status); mysql_mutex_destroy(&LOCK_delayed_insert); mysql_mutex_destroy(&LOCK_delayed_status); @@ -1944,7 +1930,7 @@ static void network_init(void) (void) setsockopt(unix_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg, sizeof(arg)); umask(0); - if (bind(unix_sock, my_reinterpret_cast(struct sockaddr *) (&UNIXaddr), + if (bind(unix_sock, reinterpret_cast<struct sockaddr *>(&UNIXaddr), sizeof(UNIXaddr)) < 0) { sql_perror("Can't start server : Bind on unix socket"); /* purecov: tested */ @@ -3355,9 +3341,7 @@ static int init_common_variables() if (item_create_init()) return 1; item_init(); -#ifdef USE_REGEX my_regex_init(&my_charset_latin1); -#endif /* Process a comma-separated character set list and choose the first available character set. This is mostly for @@ -3523,7 +3507,6 @@ static int init_thread_environment() mysql_mutex_init(key_LOCK_lock_db, &LOCK_lock_db, MY_MUTEX_INIT_SLOW); mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_LOCK_thread_count, &LOCK_thread_count, MY_MUTEX_INIT_FAST); - mysql_mutex_init(key_LOCK_mapped_file, &LOCK_mapped_file, MY_MUTEX_INIT_SLOW); mysql_mutex_init(key_LOCK_status, &LOCK_status, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_LOCK_delayed_insert, &LOCK_delayed_insert, MY_MUTEX_INIT_FAST); @@ -7702,7 +7685,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids, key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create, key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log, key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables, - key_LOCK_lock_db, key_LOCK_manager, key_LOCK_mapped_file, + key_LOCK_lock_db, key_LOCK_manager, key_LOCK_mysql_create_db, key_LOCK_open, key_LOCK_prepared_stmt_count, key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status, key_LOCK_system_variables_hash, key_LOCK_table_share, key_LOCK_thd_data, @@ -7743,7 +7726,6 @@ static PSI_mutex_info all_server_mutexes[]= { &key_LOCK_global_system_variables, "LOCK_global_system_variables", PSI_FLAG_GLOBAL}, { &key_LOCK_lock_db, "LOCK_lock_db", PSI_FLAG_GLOBAL}, { &key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL}, - { &key_LOCK_mapped_file, "LOCK_mapped_file", PSI_FLAG_GLOBAL}, { &key_LOCK_mysql_create_db, "LOCK_mysql_create_db", PSI_FLAG_GLOBAL}, { &key_LOCK_open, "LOCK_open", PSI_FLAG_GLOBAL}, { &key_LOCK_prepared_stmt_count, "LOCK_prepared_stmt_count", PSI_FLAG_GLOBAL}, diff --git a/sql/mysqld.h b/sql/mysqld.h index e14cd15ceb8..91bdc600cda 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -78,9 +78,6 @@ extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *files_charset_info ; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *national_charset_info; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *table_alias_charset; -extern TYPELIB log_output_typelib; -extern const char *log_output_names[]; - /** Character set of the buildin error messages loaded from errmsg.sys. */ @@ -105,7 +102,7 @@ extern bool volatile abort_loop; extern bool in_bootstrap; extern uint volatile thread_count, global_read_lock; extern uint connection_count; -extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types; +extern my_bool opt_safe_user_create; extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap; extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern uint slave_exec_mode_options; @@ -173,7 +170,6 @@ extern ulong slave_trans_retries; extern uint slave_net_timeout; extern uint max_user_connections; extern ulong what_to_log,flush_time; -extern ulong query_buff_size; extern ulong max_prepared_stmt_count, prepared_stmt_count; extern ulong binlog_cache_size, open_files_limit; extern ulonglong max_binlog_cache_size; @@ -210,9 +206,7 @@ extern MYSQL_FILE *bootstrap_file; extern my_bool old_mode; extern LEX_STRING opt_init_connect, opt_init_slave; extern int bootstrap_error; -extern FILE *stderror_file; extern I_List<THD> threads; -extern char err_shared_dir[]; extern scheduler_functions thread_scheduler; extern TYPELIB thread_handling_typelib; extern my_decimal decimal_zero; @@ -234,7 +228,7 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids, key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create, key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log, key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables, - key_LOCK_lock_db, key_LOCK_logger, key_LOCK_manager, key_LOCK_mapped_file, + key_LOCK_lock_db, key_LOCK_logger, key_LOCK_manager, key_LOCK_mysql_create_db, key_LOCK_open, key_LOCK_prepared_stmt_count, key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status, key_LOCK_table_share, key_LOCK_thd_data, @@ -313,7 +307,6 @@ extern MYSQL_PLUGIN_IMPORT char mysql_real_data_home[]; extern char mysql_unpacked_real_data_home[]; extern MYSQL_PLUGIN_IMPORT struct system_variables global_system_variables; extern char default_logfile_name[FN_REFLEN]; -extern char err_shared_dir[]; #define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list)) @@ -324,7 +317,7 @@ extern MYSQL_PLUGIN_IMPORT key_map key_map_full; /* Should be threaded Server mutex locks and condition variables. */ extern mysql_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_lock_db, - LOCK_mapped_file, LOCK_user_locks, LOCK_status, + LOCK_user_locks, LOCK_status, LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator, LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone, LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock, diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc index 76dc2846ed0..1f1b7f0c20f 100644 --- a/sql/nt_servc.cc +++ b/sql/nt_servc.cc @@ -375,29 +375,6 @@ void NTService::ServiceCtrlHandler(DWORD ctrlCode) dwState=pService->dwState; // get current state switch(ctrlCode) { - -#ifdef NOT_USED /* do we need this ? */ - case SERVICE_CONTROL_PAUSE: - if (pService->bRunning && ! pService->bPause) - { - dwState = SERVICE_PAUSED; - pService->SetStatus(SERVICE_PAUSE_PENDING,NO_ERROR, 0, 1, - pService->nPauseTimeOut); - pService->PauseService(); - } - break; - - case SERVICE_CONTROL_CONTINUE: - if (pService->bRunning && pService->bPause) - { - dwState = SERVICE_RUNNING; - pService->SetStatus(SERVICE_CONTINUE_PENDING,NO_ERROR, 0, 1, - pService->nResumeTimeOut); - pService->ResumeService(); - } - break; -#endif - case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_STOP: dwState = SERVICE_STOP_PENDING; diff --git a/sql/protocol.cc b/sql/protocol.cc index 3f957dcc2de..87a54eaf10d 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -790,31 +790,14 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags) local_packet->realloc(local_packet->length()+10)) goto err; pos= (char*) local_packet->ptr()+local_packet->length(); - -#ifdef TO_BE_DELETED_IN_6 - if (!(thd->client_capabilities & CLIENT_LONG_FLAG)) - { - pos[0]=3; - int3store(pos+1,field.length); - pos[4]=1; - pos[5]=field.type; - pos[6]=2; - pos[7]= (char) field.flags; - pos[8]= (char) field.decimals; - pos+= 9; - } - else -#endif - { - pos[0]=3; - int3store(pos+1,field.length); - pos[4]=1; - pos[5]=field.type; - pos[6]=3; - int2store(pos+7,field.flags); - pos[9]= (char) field.decimals; - pos+= 10; - } + pos[0]=3; + int3store(pos+1,field.length); + pos[4]=1; + pos[5]=field.type; + pos[6]=3; + int2store(pos+7,field.flags); + pos[9]= (char) field.decimals; + pos+= 10; } local_packet->length((uint) (pos - local_packet->ptr())); if (flags & SEND_DEFAULTS) diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 9a1f7fb826b..47eb2f7031d 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -55,9 +55,6 @@ const char* rpl_status_type[]= "AUTH_MASTER","IDLE_SLAVE","ACTIVE_SLAVE","LOST_SOLDIER","TROOP_SOLDIER", "RECOVERY_CAPTAIN","NULL",NullS }; -TYPELIB rpl_status_typelib= {array_elements(rpl_status_type)-1,"", - rpl_status_type, NULL}; - static Slave_log_event* find_slave_event(IO_CACHE* log, const char* log_file_name, @@ -71,42 +68,6 @@ static Slave_log_event* find_slave_event(IO_CACHE* log, functions like register_slave()) are working. */ -#if NOT_USED -static int init_failsafe_rpl_thread(THD* thd) -{ - DBUG_ENTER("init_failsafe_rpl_thread"); - thd->system_thread = SYSTEM_THREAD_DELAYED_INSERT; - /* - thd->bootstrap is to report errors barely to stderr; if this code is - enable again one day, one should check if bootstrap is still needed (maybe - this thread has no other error reporting method). - */ - thd->bootstrap = 1; - thd->security_ctx->skip_grants(); - my_net_init(&thd->net, 0); - thd->net.read_timeout = slave_net_timeout; - thd->max_client_packet_length=thd->net.max_packet; - mysql_mutex_lock(&LOCK_thread_count); - thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; - mysql_mutex_unlock(&LOCK_thread_count); - - if (init_thr_lock() || thd->store_globals()) - { - /* purecov: begin inspected */ - close_connection(thd, ER_OUT_OF_RESOURCES, 1); // is this needed? - statistic_increment(aborted_connects,&LOCK_status); - one_thread_per_connection_end(thd,0); - DBUG_RETURN(-1); - /* purecov: end */ - } - - thd->mem_root->free= thd->mem_root->used= 0; - thd_proc_info(thd, "Thread initialized"); - thd->set_time(); - DBUG_RETURN(0); -} -#endif - void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status) { mysql_mutex_lock(&LOCK_rpl_status); @@ -623,66 +584,6 @@ err: } -#if NOT_USED -int find_recovery_captain(THD* thd, MYSQL* mysql) -{ - return 0; -} -#endif - -#if NOT_USED -pthread_handler_t handle_failsafe_rpl(void *arg) -{ - DBUG_ENTER("handle_failsafe_rpl"); - THD *thd = new THD; - thd->thread_stack = (char*)&thd; - MYSQL* recovery_captain = 0; - const char* msg; - - pthread_detach_this_thread(); - if (init_failsafe_rpl_thread(thd) || !(recovery_captain=mysql_init(0))) - { - sql_print_error("Could not initialize failsafe replication thread"); - goto err; - } - mysql_mutex_lock(&LOCK_rpl_status); - msg= thd->enter_cond(&COND_rpl_status, - &LOCK_rpl_status, "Waiting for request"); - while (!thd->killed && !abort_loop) - { - bool break_req_chain = 0; - mysql_cond_wait(&COND_rpl_status, &LOCK_rpl_status); - thd_proc_info(thd, "Processing request"); - while (!break_req_chain) - { - switch (rpl_status) { - case RPL_LOST_SOLDIER: - if (find_recovery_captain(thd, recovery_captain)) - rpl_status=RPL_TROOP_SOLDIER; - else - rpl_status=RPL_RECOVERY_CAPTAIN; - break_req_chain=1; /* for now until other states are implemented */ - break; - default: - break_req_chain=1; - break; - } - } - } - thd->exit_cond(msg); -err: - if (recovery_captain) - mysql_close(recovery_captain); - delete thd; - - DBUG_LEAVE; // Must match DBUG_ENTER() - my_thread_end(); - pthread_exit(0); - return 0; // Avoid compiler warnings -} -#endif - - /** Execute a SHOW SLAVE HOSTS statement. diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h index 94b151aaee7..c6d00de47cb 100644 --- a/sql/repl_failsafe.h +++ b/sql/repl_failsafe.h @@ -30,7 +30,7 @@ extern RPL_STATUS rpl_status; extern mysql_mutex_t LOCK_rpl_status; extern mysql_cond_t COND_rpl_status; -extern TYPELIB rpl_role_typelib, rpl_status_typelib; +extern TYPELIB rpl_role_typelib; extern const char* rpl_role_type[], *rpl_status_type[]; pthread_handler_t handle_failsafe_rpl(void *arg); diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index ced5c0943dd..8219f70727e 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -238,7 +238,8 @@ unpack_row(Relay_log_info const *rli, conv_field ? conv_field : *field_ptr; DBUG_PRINT("debug", ("Conversion %srequired for field '%s' (#%ld)", conv_field ? "" : "not ", - (*field_ptr)->field_name, field_ptr - begin_ptr)); + (*field_ptr)->field_name, + (long) (field_ptr - begin_ptr))); DBUG_ASSERT(f != NULL); /* diff --git a/sql/set_var.h b/sql/set_var.h index 1b415567659..5f1f889c4ce 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -169,7 +169,6 @@ protected: { return ((uchar*)&global_system_variables) + offset; } }; -#include "log.h" /* binlog_format_typelib */ #include "sql_plugin.h" /* SHOW_HA_ROWS, SHOW_MY_BOOL */ /**************************************************************************** diff --git a/sql/slave.cc b/sql/slave.cc index d41d0479dde..25860138cf2 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -83,7 +83,6 @@ ulonglong relay_log_space_limit = 0; */ int disconnect_slave_event_count = 0, abort_slave_event_count = 0; -int events_till_abort = -1; static pthread_key(Master_info*, RPL_MASTER_INFO); @@ -798,17 +797,6 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start, } -#ifdef NOT_USED_YET -static int end_slave_on_walk(Master_info* mi, uchar* /*unused*/) -{ - DBUG_ENTER("end_slave_on_walk"); - - end_master_info(mi); - DBUG_RETURN(0); -} -#endif - - /* Release slave threads at time of executing shutdown. diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f746edef83f..14cd8dd6354 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1634,7 +1634,7 @@ static inline uint tmpkeyval(THD *thd, TABLE *table) creates one DROP TEMPORARY TABLE binlog event for each pseudo-thread */ -void close_temporary_tables(THD *thd) +bool close_temporary_tables(THD *thd) { DBUG_ENTER("close_temporary_tables"); TABLE *table; @@ -1642,9 +1642,10 @@ void close_temporary_tables(THD *thd) TABLE *prev_table; /* Assume thd->variables.option_bits has OPTION_QUOTE_SHOW_CREATE */ bool was_quote_show= TRUE; + bool error= 0; if (!thd->temporary_tables) - DBUG_VOID_RETURN; + DBUG_RETURN(FALSE); if (!mysql_bin_log.is_open()) { @@ -1655,7 +1656,7 @@ void close_temporary_tables(THD *thd) close_temporary(table, 1, 1); } thd->temporary_tables= 0; - DBUG_VOID_RETURN; + DBUG_RETURN(FALSE); } /* Better add "if exists", in case a RESET MASTER has been done */ @@ -1754,11 +1755,27 @@ void close_temporary_tables(THD *thd) qinfo.db= db.ptr(); qinfo.db_len= db.length(); thd->variables.character_set_client= cs_save; - if (mysql_bin_log.write(&qinfo)) + + thd->stmt_da->can_overwrite_status= TRUE; + if ((error= (mysql_bin_log.write(&qinfo) || error))) { - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, MYF(0), - "Failed to write the DROP statement for temporary tables to binary log"); + /* + If we're here following THD::cleanup, thence the connection + has been closed already. So lets print a message to the + error log instead of pushing yet another error into the + stmt_da. + + Also, we keep the error flag so that we propagate the error + up in the stack. This way, if we're the SQL thread we notice + that close_temporary_tables failed. (Actually, the SQL + thread only calls close_temporary_tables while applying old + Start_log_event_v3 events.) + */ + sql_print_error("Failed to write the DROP statement for " + "temporary tables to binary log"); } + thd->stmt_da->can_overwrite_status= FALSE; + thd->variables.pseudo_thread_id= save_pseudo_thread_id; thd->thread_specific_used= save_thread_specific_used; } @@ -1771,7 +1788,8 @@ void close_temporary_tables(THD *thd) if (!was_quote_show) thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE; /* restore option */ thd->temporary_tables=0; - DBUG_VOID_RETURN; + + DBUG_RETURN(error); } /* diff --git a/sql/sql_base.h b/sql/sql_base.h index 20a068e27d7..eed535f5cdc 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -222,7 +222,7 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables); void free_io_cache(TABLE *entry); void intern_close_table(TABLE *entry); bool close_thread_table(THD *thd, TABLE **table_ptr); -void close_temporary_tables(THD *thd); +bool close_temporary_tables(THD *thd); TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, bool check_alias); int drop_temporary_table(THD *thd, TABLE_LIST *table_list); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index eb4d353db81..1bec02afa96 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -4171,71 +4171,6 @@ THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*, Update_rows_log_event *); #endif -#ifdef NOT_USED -static char const* -field_type_name(enum_field_types type) -{ - switch (type) { - case MYSQL_TYPE_DECIMAL: - return "MYSQL_TYPE_DECIMAL"; - case MYSQL_TYPE_TINY: - return "MYSQL_TYPE_TINY"; - case MYSQL_TYPE_SHORT: - return "MYSQL_TYPE_SHORT"; - case MYSQL_TYPE_LONG: - return "MYSQL_TYPE_LONG"; - case MYSQL_TYPE_FLOAT: - return "MYSQL_TYPE_FLOAT"; - case MYSQL_TYPE_DOUBLE: - return "MYSQL_TYPE_DOUBLE"; - case MYSQL_TYPE_NULL: - return "MYSQL_TYPE_NULL"; - case MYSQL_TYPE_TIMESTAMP: - return "MYSQL_TYPE_TIMESTAMP"; - case MYSQL_TYPE_LONGLONG: - return "MYSQL_TYPE_LONGLONG"; - case MYSQL_TYPE_INT24: - return "MYSQL_TYPE_INT24"; - case MYSQL_TYPE_DATE: - return "MYSQL_TYPE_DATE"; - case MYSQL_TYPE_TIME: - return "MYSQL_TYPE_TIME"; - case MYSQL_TYPE_DATETIME: - return "MYSQL_TYPE_DATETIME"; - case MYSQL_TYPE_YEAR: - return "MYSQL_TYPE_YEAR"; - case MYSQL_TYPE_NEWDATE: - return "MYSQL_TYPE_NEWDATE"; - case MYSQL_TYPE_VARCHAR: - return "MYSQL_TYPE_VARCHAR"; - case MYSQL_TYPE_BIT: - return "MYSQL_TYPE_BIT"; - case MYSQL_TYPE_NEWDECIMAL: - return "MYSQL_TYPE_NEWDECIMAL"; - case MYSQL_TYPE_ENUM: - return "MYSQL_TYPE_ENUM"; - case MYSQL_TYPE_SET: - return "MYSQL_TYPE_SET"; - case MYSQL_TYPE_TINY_BLOB: - return "MYSQL_TYPE_TINY_BLOB"; - case MYSQL_TYPE_MEDIUM_BLOB: - return "MYSQL_TYPE_MEDIUM_BLOB"; - case MYSQL_TYPE_LONG_BLOB: - return "MYSQL_TYPE_LONG_BLOB"; - case MYSQL_TYPE_BLOB: - return "MYSQL_TYPE_BLOB"; - case MYSQL_TYPE_VAR_STRING: - return "MYSQL_TYPE_VAR_STRING"; - case MYSQL_TYPE_STRING: - return "MYSQL_TYPE_STRING"; - case MYSQL_TYPE_GEOMETRY: - return "MYSQL_TYPE_GEOMETRY"; - } - return "Unknown"; -} -#endif - - /* Declare in unnamed namespace. */ CPP_UNNAMED_NS_START diff --git a/sql/sql_error.cc b/sql/sql_error.cc index cc6529f7b10..e5d0f79b2d7 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -588,16 +588,11 @@ void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, DBUG_PRINT("enter", ("code: %d, msg: %s", code, msg)); /* - Calling push_warning/push_warning_printf with a - level of WARN_LEVEL_ERROR *is* a bug. - Either use my_error(), or WARN_LEVEL_WARN. - Please fix the calling code, and do *NOT* - add more work around code in the assert below. + Calling push_warning/push_warning_printf with a level of + WARN_LEVEL_ERROR *is* a bug. Either use my_printf_error(), + my_error(), or WARN_LEVEL_WARN. */ - DBUG_ASSERT( (level != MYSQL_ERROR::WARN_LEVEL_ERROR) - || (code == ER_CANT_CREATE_TABLE) /* See Bug#47233 */ - || (code == ER_ILLEGAL_HA_CREATE_OPTION) /* See Bug#47233 */ - ); + DBUG_ASSERT(level != MYSQL_ERROR::WARN_LEVEL_ERROR); if (level == MYSQL_ERROR::WARN_LEVEL_ERROR) level= MYSQL_ERROR::WARN_LEVEL_WARN; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index aefddc0b6a5..568640b574a 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -41,7 +41,6 @@ sys_var *trg_new_row_fake_var= (sys_var*) 0x01; LEX_STRING constant for null-string to be used in parser and other places. */ const LEX_STRING null_lex_str= {NULL, 0}; -const LEX_STRING empty_lex_str= { (char*) "", 0 }; /** @note The order of the elements of this array must correspond to the order of elements in enum_binlog_stmt_unsafe. diff --git a/sql/sql_lex.h b/sql/sql_lex.h index b8bf3b220c9..784a69cf9c1 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -589,11 +589,11 @@ public: st_select_lex* outer_select(); st_select_lex* first_select() { - return my_reinterpret_cast(st_select_lex*)(slave); + return reinterpret_cast<st_select_lex*>(slave); } st_select_lex_unit* next_unit() { - return my_reinterpret_cast(st_select_lex_unit*)(next); + return reinterpret_cast<st_select_lex_unit*>(next); } st_select_lex* return_after_parsing() { return return_to; } void exclude_level(); @@ -995,8 +995,6 @@ enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE, XA_SUSPEND, XA_FOR_MIGRATE}; extern const LEX_STRING null_lex_str; -extern const LEX_STRING empty_lex_str; - class Sroutine_hash_entry; diff --git a/sql/sql_map.cc b/sql/sql_map.cc deleted file mode 100644 index ca8a88bcbf8..00000000000 --- a/sql/sql_map.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright (C) 2000-2001, 2004-2005 MySQL AB, 2008-2009 Sun Microsystems, Inc - - 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 */ - - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include "sql_priv.h" -#include "unireg.h" // REQUIRED: for other includes -#include "sql_map.h" // mapped_files -#include "sql_class.h" // THD - -#include <sys/stat.h> -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif - -mapped_files::mapped_files(const char * filename,uchar *magic,uint magic_length) -{ -#ifdef HAVE_MMAP - name=my_strdup(filename,MYF(0)); - use_count=1; - error=0; - map=0; - size=0; - if ((file= mysql_file_open(key_file_map, name, O_RDONLY, MYF(MY_WME))) >= 0) - { - struct stat stat_buf; - if (!fstat(file, &stat_buf)) - { - if (!(map=(uchar*) my_mmap(0,(size_t)(size= stat_buf.st_size),PROT_READ, - MAP_SHARED | MAP_NORESERVE,file, - 0L))) - { - error=errno; - my_error(ER_NO_FILE_MAPPING, MYF(0), (char *) name, error); - } - } - if (map && memcmp(map,magic,magic_length)) - { - my_error(ER_WRONG_MAGIC, MYF(0), name); - (void) my_munmap((char*) map,(size_t)size); - map=0; - } - if (!map) - { - (void) mysql_file_close(file, MYF(0)); - file= -1; - } - } -#endif -} - - -mapped_files::~mapped_files() -{ -#ifdef HAVE_MMAP - if (file >= 0) - { - (void) my_munmap((char*) map,(size_t)size); - (void) mysql_file_close(file, MYF(0)); - file= -1; map=0; - } - my_free(name); -#endif -} - - -static I_List<mapped_files> maps_in_use; - -/* -** Check if a file is mapped. If it is, then return pointer to old map, -** else alloc new object -*/ - -mapped_files *map_file(const char * name,uchar *magic,uint magic_length) -{ -#ifdef HAVE_MMAP - mysql_mutex_lock(&LOCK_mapped_file); - I_List_iterator<mapped_files> list(maps_in_use); - mapped_files *map; - char path[FN_REFLEN]; - sprintf(path,"%s/%s/%s.uniq",mysql_data_home,current_thd->db,name); - (void) unpack_filename(path,path); - - while ((map=list++)) - { - if (!strcmp(path,map->name)) - break; - } - if (!map) - { - map=new mapped_files(path,magic,magic_length); - maps_in_use.append(map); - } - else - { - map->use_count++; - if (!map->map) - my_error(ER_NO_FILE_MAPPING, MYF(0), path, map->error); - } - mysql_mutex_unlock(&LOCK_mapped_file); - return map; -#else - return NULL; -#endif -} - -/* -** free the map if there are no more users for it -*/ - -void unmap_file(mapped_files *map) -{ -#ifdef HAVE_MMAP - mysql_mutex_lock(&LOCK_mapped_file); - if (!map->use_count--) - delete map; - mysql_mutex_unlock(&LOCK_mapped_file); -#endif -} - -/***************************************************************************** -** Instansiate templates -*****************************************************************************/ - -#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION -/* Used templates */ -template class I_List<mapped_files>; -template class I_List_iterator<mapped_files>; -#endif diff --git a/sql/sql_map.h b/sql/sql_map.h deleted file mode 100644 index be1c145df3f..00000000000 --- a/sql/sql_map.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef SQL_MAP_INCLUDED -#define SQL_MAP_INCLUDED - -/* Copyright (C) 2000-2001, 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 */ - - -/* interface for memory mapped files */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "my_base.h" /* ha_rows */ -#include "sql_list.h" /* ilink */ - -class mapped_files; -mapped_files *map_file(const char * name,uchar *magic,uint magic_length); -void unmap_file(mapped_files *map); - -class mapped_files :public ilink { - uchar *map; - ha_rows size; - char *name; // name of mapped file - File file; // >= 0 if open - int error; // If not mapped - uint use_count; - -public: - mapped_files(const char * name,uchar *magic,uint magic_length); - ~mapped_files(); - - friend class mapped_file; - friend mapped_files *map_file(const char * name,uchar *magic, - uint magic_length); - friend void unmap_file(mapped_files *map); -}; - - -class mapped_file -{ - mapped_files *file; -public: - mapped_file(const char * name,uchar *magic,uint magic_length) - { - file=map_file(name,magic,magic_length); /* old or new map */ - } - ~mapped_file() - { - unmap_file(file); /* free map */ - } - uchar *map() - { - return file->map; - } -}; - -#endif /* SQL_MAP_INCLUDED */ diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc deleted file mode 100644 index b957d1e9be4..00000000000 --- a/sql/sql_olap.cc +++ /dev/null @@ -1,188 +0,0 @@ -/* 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 */ - - -/* - OLAP implementation by Sinisa Milivojevic <sinisa@mysql.com> - Inspired by code submitted by Srilakshmi <lakshmi@gdit.iiit.net> - - The ROLLUP code in this file has to be complitely rewritten as it's - not good enough to satisfy the goals of MySQL. - - In 4.1 we will replace this with a working, superior implementation - of ROLLUP. -*/ - -#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1 - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include "sql_priv.h" -#include "unireg.h" -#include "sql_select.h" - - -/**************************************************************************** - Functions that recursively actually creates new SELECT's - Returns 0 if OK, 1 if error, -1 if error already printed to client -****************************************************************************/ - - -static int make_new_olap_select(LEX *lex, SELECT_LEX *select_lex, List<Item> new_fields) -{ - THD *thd=current_thd; - Item *item, *new_item; - Item_null *constant= new Item_null("ALL"); - - SELECT_LEX *new_select = (SELECT_LEX *) thd->memdup((char*) select_lex, sizeof(*select_lex)); - if (!new_select) - return 1; - lex->last_selects->next=new_select; - new_select->linkage=OLAP_TYPE; - new_select->olap=NON_EXISTING_ONE; - new_select->group_list.elements=0; - new_select->group_list.first=(uchar *)0; - new_select->group_list.next=(uchar **)&new_select->group_list.first; - List<Item> privlist; - - List_iterator<Item> list_it(select_lex->item_list); - List_iterator<Item> new_it(new_fields); - - while ((item=list_it++)) - { - bool not_found= TRUE; - if (item->type()==Item::FIELD_ITEM) - { - Item_field *iif = (Item_field *)item; - new_it.rewind(); - while ((new_item=new_it++)) - { - if (new_item->type()==Item::FIELD_ITEM && - !strcmp(((Item_field*)new_item)->table_name,iif->table_name) && - !strcmp(((Item_field*)new_item)->field_name,iif->field_name)) - { - not_found= 0; - ((Item_field*)new_item)->db_name=iif->db_name; - Item_field *new_one=new Item_field(&select_lex->context, - iif->db_name, iif->table_name, iif->field_name); - privlist.push_back(new_one); - if (add_to_list(new_select->group_list,new_one,1)) - return 1; - break; - } - } - } - if (not_found) - { - if (item->type() == Item::FIELD_ITEM) - privlist.push_back(constant); - else - privlist.push_back((Item*)thd->memdup((char *)item,item->size_of())); - } - } - new_select->item_list=privlist; - - lex->last_selects = new_select; - return 0; -} - -/**************************************************************************** - Functions that recursively creates combinations of queries for OLAP - Returns 0 if OK, 1 if error, -1 if error already printed to client -****************************************************************************/ - -static int olap_combos(List<Item> old_fields, List<Item> new_fields, Item *item, LEX *lex, - SELECT_LEX *select_lex, int position, int selection, int num_fields, - int num_new_fields) -{ - int sl_return = 0; - if (position == num_new_fields) - { - if (item) - new_fields.push_front(item); - sl_return = make_new_olap_select(lex, select_lex, new_fields); - } - else - { - if (item) - new_fields.push_front(item); - while ((num_fields - num_new_fields >= selection - position) && !sl_return) - { - item = old_fields.pop(); - sl_return = olap_combos(old_fields, new_fields, item, lex, select_lex, position+1, ++selection, num_fields, num_new_fields); - } - } - return sl_return; -} - - -/**************************************************************************** - Top level function for converting OLAP clauses to multiple selects - This is also a place where clauses treatment depends on OLAP type - Returns 0 if OK, 1 if error, -1 if error already printed to client -****************************************************************************/ - -int handle_olaps(LEX *lex, SELECT_LEX *select_lex) -{ - List<Item> item_list_copy, new_item_list; - item_list_copy.empty(); - new_item_list.empty(); - int count=select_lex->group_list.elements; - int sl_return=0; - - - lex->last_selects=select_lex; - - for (ORDER *order= select_lex->group_list.first ; order ; order=order->next) - item_list_copy.push_back(*(order->item)); - - List<Item> all_fields(select_lex->item_list); - - - if (setup_tables(lex->thd, &select_lex->context, &select_lex->top_join_list, - select_lex->table_list.first - &select_lex->leaf_tables, FALSE) || - setup_fields(lex->thd, 0, select_lex->item_list, MARK_COLUMNS_READ, - &all_fields,1) || - setup_fields(lex->thd, 0, item_list_copy, MARK_COLUMNS_READ, - &all_fields, 1)) - return -1; - - if (select_lex->olap == CUBE_TYPE) - { - for ( int i=count-1; i>=0 && !sl_return; i--) - sl_return=olap_combos(item_list_copy, new_item_list, (Item *)0, lex, select_lex, 0, 0, count, i); - } - else if (select_lex->olap == ROLLUP_TYPE) - { - for ( int i=count-1; i>=0 && !sl_return; i--) - { - Item *item; - item_list_copy.pop(); - List_iterator<Item> it(item_list_copy); - new_item_list.empty(); - while ((item = it++)) - new_item_list.push_front(item); - sl_return=make_new_olap_select(lex, select_lex, new_item_list); - } - } - else - sl_return=1; // impossible - return sl_return; -} - -#endif /* DISABLED_UNTIL_REWRITTEN_IN_4_1 */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 28a867cfcd8..ff7080e6c1b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6064,7 +6064,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type, void store_position_for_column(const char *name) { - current_thd->lex->last_field->after=my_const_cast(char*) (name); + current_thd->lex->last_field->after=(char*) (name); } bool @@ -7536,28 +7536,6 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, if (select_lex->item_list.elements) { /* Check permissions for used tables in CREATE TABLE ... SELECT */ - -#ifdef NOT_NECESSARY_TO_CHECK_CREATE_TABLE_EXIST_WHEN_PREPARING_STATEMENT - /* This code throws an ill error for CREATE TABLE t1 SELECT * FROM t1 */ - /* - Only do the check for PS, because we on execute we have to check that - against the opened tables to ensure we don't use a table that is part - of the view (which can only be done after the table has been opened). - */ - if (thd->stmt_arena->is_stmt_prepare_or_first_sp_execute()) - { - /* - For temporary tables we don't have to check if the created table exists - */ - if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) && - find_table_in_global_list(tables, create_table->db, - create_table->table_name)) - { - error= FALSE; - goto err; - } - } -#endif if (tables && check_table_access(thd, SELECT_ACL, tables, FALSE, UINT_MAX, FALSE)) goto err; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 2b6be403fc6..3a0945faa49 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -901,19 +901,6 @@ static void plugin_del(struct st_plugin_int *plugin) DBUG_VOID_RETURN; } -#ifdef NOT_USED - -static void plugin_del(const LEX_STRING *name) -{ - struct st_plugin_int *plugin; - DBUG_ENTER("plugin_del(name)"); - if ((plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN))) - plugin_del(plugin); - DBUG_VOID_RETURN; -} - -#endif - static void reap_plugins(void) { uint count, idx; @@ -1394,51 +1381,6 @@ static bool register_builtin(struct st_mysql_plugin *plugin, DBUG_RETURN(0); } -#ifdef NOT_USED_YET -/* - Register a plugin at run time. (note, this doesn't initialize a plugin) - Will be useful for embedded applications. - - SYNOPSIS - plugin_register_builtin() - thd current thread (used to store scratch data in mem_root) - plugin static plugin to install - - RETURN - false - plugin registered successfully -*/ -bool plugin_register_builtin(THD *thd, struct st_mysql_plugin *plugin) -{ - struct st_plugin_int tmp, *ptr; - bool result= true; - int dummy_argc= 0; - DBUG_ENTER("plugin_register_builtin"); - - bzero(&tmp, sizeof(tmp)); - tmp.plugin= plugin; - tmp.name.str= (char *)plugin->name; - tmp.name.length= strlen(plugin->name); - - mysql_mutex_lock(&LOCK_plugin); - mysql_rwlock_wrlock(&LOCK_system_variables_hash); - - if (test_plugin_options(thd->mem_root, &tmp, &dummy_argc, NULL)) - goto end; - tmp.state= PLUGIN_IS_UNINITIALIZED; - if ((result= register_builtin(plugin, &tmp, &ptr))) - { - mysql_del_sys_var_chain(tmp.system_vars); - restore_pluginvar_names(tmp.system_vars); - } - -end: - mysql_rwlock_unlock(&LOCK_system_variables_hash); - mysql_mutex_unlock(&LOCK_plugin); - - DBUG_RETURN(result);; -} -#endif /* NOT_USED_YET */ - /* called only by plugin_init() diff --git a/sql/sql_priv.h b/sql/sql_priv.h index 604890ffbe5..7067ca084e2 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -59,8 +59,6 @@ (Old), (New)); \ } while(0) -extern char err_shared_dir[]; - /*************************************************************************/ #endif diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 74d05780f81..9c9a436cc24 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12480,11 +12480,6 @@ join_ft_read_first(JOIN_TAB *tab) if (!table->file->inited) table->file->ha_index_init(tab->ref.key, 1); -#if NOT_USED_YET - /* as ft-key doesn't use store_key's, see also FT_SELECT::init() */ - if (cp_buffer_from_ref(tab->join->thd, table, &tab->ref)) - return -1; -#endif table->file->ft_init(); if ((error= table->file->ft_read(table->record[0]))) @@ -12774,22 +12769,6 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), { copy_fields(&join->tmp_table_param); copy_funcs(join->tmp_table_param.items_to_copy); -#ifdef TO_BE_DELETED - if (!table->uniques) // If not unique handling - { - /* Copy null values from group to row */ - ORDER *group; - for (group=table->group ; group ; group=group->next) - { - Item *item= *group->item; - if (item->maybe_null) - { - Field *field=item->get_tmp_table_field(); - field->ptr[-1]= (uchar) (field->is_null() ? 1 : 0); - } - } - } -#endif if (!join->having || join->having->val_int()) { int error; @@ -13265,7 +13244,7 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, DBUG_RETURN(0); } - if (key_part->field != field) + if (key_part->field != field || !field->part_of_sortkey.is_set(idx)) DBUG_RETURN(0); /* set flag to 1 if we can use read-next on key, else to -1 */ @@ -13997,44 +13976,6 @@ err: DBUG_RETURN(-1); } -#ifdef NOT_YET -/** - Add the HAVING criteria to table->select. -*/ - -static bool fix_having(JOIN *join, Item **having) -{ - (*having)->update_used_tables(); // Some tables may have been const - JOIN_TAB *table=&join->join_tab[join->const_tables]; - table_map used_tables= join->const_table_map | table->table->map; - - DBUG_EXECUTE("where",print_where(*having,"having", QT_ORDINARY);); - Item* sort_table_cond=make_cond_for_table(*having,used_tables,used_tables); - if (sort_table_cond) - { - if (!table->select) - if (!(table->select=new SQL_SELECT)) - return 1; - if (!table->select->cond) - table->select->cond=sort_table_cond; - else // This should never happen - if (!(table->select->cond= new Item_cond_and(table->select->cond, - sort_table_cond)) || - table->select->cond->fix_fields(join->thd, &table->select->cond)) - return 1; - table->select_cond=table->select->cond; - table->select_cond->top_level_item(); - DBUG_EXECUTE("where",print_where(table->select_cond, - "select and having", - QT_ORDINARY);); - *having=make_cond_for_table(*having,~ (table_map) 0,~used_tables); - DBUG_EXECUTE("where", - print_where(*having,"having after make_cond", QT_ORDINARY);); - } - return 0; -} -#endif - /***************************************************************************** Remove duplicates from tmp table diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a8ae5832a2a..78508df2c9e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5700,52 +5700,6 @@ static int get_schema_partitions_record(THD *thd, TABLE_LIST *tables, } -#ifdef NOT_USED -static interval_type get_real_interval_type(interval_type i_type) -{ - switch (i_type) { - case INTERVAL_YEAR: - return INTERVAL_YEAR; - - case INTERVAL_QUARTER: - case INTERVAL_YEAR_MONTH: - case INTERVAL_MONTH: - return INTERVAL_MONTH; - - case INTERVAL_WEEK: - case INTERVAL_DAY: - return INTERVAL_DAY; - - case INTERVAL_DAY_HOUR: - case INTERVAL_HOUR: - return INTERVAL_HOUR; - - case INTERVAL_DAY_MINUTE: - case INTERVAL_HOUR_MINUTE: - case INTERVAL_MINUTE: - return INTERVAL_MINUTE; - - case INTERVAL_DAY_SECOND: - case INTERVAL_HOUR_SECOND: - case INTERVAL_MINUTE_SECOND: - case INTERVAL_SECOND: - return INTERVAL_SECOND; - - case INTERVAL_DAY_MICROSECOND: - case INTERVAL_HOUR_MICROSECOND: - case INTERVAL_MINUTE_MICROSECOND: - case INTERVAL_SECOND_MICROSECOND: - case INTERVAL_MICROSECOND: - return INTERVAL_MICROSECOND; - case INTERVAL_LAST: - DBUG_ASSERT(0); - } - DBUG_ASSERT(0); - return INTERVAL_SECOND; -} - -#endif - #ifdef HAVE_EVENT_SCHEDULER /* Loads an event from mysql.event and copies it's data to a row of diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 6e95961ebb0..6e838759e83 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -796,7 +796,11 @@ static Sys_var_lexstring Sys_init_connect( static Sys_var_charptr Sys_init_file( "init_file", "Read SQL commands from this file at startup", READ_ONLY GLOBAL_VAR(opt_init_file), - IF_DISABLE_GRANT_OPTIONS(NO_CMD_LINE, CMD_LINE(REQUIRED_ARG)), +#ifdef DISABLE_GRANT_OPTIONS + NO_CMD_LINE, +#else + CMD_LINE(REQUIRED_ARG), +#endif IN_FS_CHARSET, DEFAULT(0)); static PolyLock_rwlock PLock_sys_init_slave(&LOCK_sys_init_slave); @@ -2866,6 +2870,8 @@ static bool fix_log_output(sys_var *self, THD *thd, enum_var_type type) return false; } +static const char *log_output_names[] = { "NONE", "FILE", "TABLE", NULL}; + static Sys_var_set Sys_log_output( "log_output", "Syntax: log-output=value[,value...], " "where \"value\" could be TABLE, FILE or NONE", diff --git a/sql/table.cc b/sql/table.cc index a58623f0036..c89ce90e719 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -797,7 +797,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, goto err; /* purecov: inspected */ bzero((char*) keyinfo,n_length); share->key_info= keyinfo; - key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo+keys); + key_part= reinterpret_cast<KEY_PART_INFO*>(keyinfo+keys); strpos=disk_buff+6; if (!(rec_per_key= (ulong*) alloc_root(&share->mem_root, @@ -1822,8 +1822,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, if (!(key_info= (KEY*) alloc_root(&outparam->mem_root, n_length))) goto err; outparam->key_info= key_info; - key_part= (my_reinterpret_cast(KEY_PART_INFO*) (key_info+share->keys)); - + key_part= (reinterpret_cast<KEY_PART_INFO*>(key_info+share->keys)); + memcpy(key_info, share->key_info, sizeof(*key_info)*share->keys); memcpy(key_part, share->key_info[0].key_part, (sizeof(*key_part) * share->key_parts)); diff --git a/sql/udf_example.c b/sql/udf_example.c index 284689d329f..5f8e71d25fa 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -133,7 +133,6 @@ typedef long long longlong; #include <string.h> #define strmov(a,b) stpcpy(a,b) #define bzero(a,b) memset(a,0,b) -#define memcpy_fixed(a,b,c) memcpy(a,b,c) #endif #endif #include <mysql.h> @@ -778,7 +777,7 @@ char *lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, } pthread_mutex_unlock(&LOCK_hostname); #endif - memcpy_fixed((char*) &in,(char*) *hostent->h_addr_list, sizeof(in.s_addr)); + memcpy(&in, *hostent->h_addr_list, sizeof(in.s_addr)); *res_length= (ulong) (strmov(result, inet_ntoa(in)) - result); return result; } diff --git a/storage/archive/azio.c b/storage/archive/azio.c index c1dd6e6f38c..1e2753027dc 100644 --- a/storage/archive/azio.c +++ b/storage/archive/azio.c @@ -31,7 +31,7 @@ int az_open(azio_stream *s, const char *path, int Flags, File fd); int do_flush(azio_stream *file, int flush); int get_byte(azio_stream *s); void check_header(azio_stream *s); -void write_header(azio_stream *s); +int write_header(azio_stream *s); int destroy(azio_stream *s); void putLong(File file, uLong x); uLong getLong(azio_stream *s); @@ -155,7 +155,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd) } -void write_header(azio_stream *s) +int write_header(azio_stream *s) { char buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE]; char *ptr= buffer; @@ -191,8 +191,8 @@ void write_header(azio_stream *s) *(ptr + AZ_DIRTY_POS)= (unsigned char)s->dirty; /* Start of Data Block Index Block */ /* Always begin at the begining, and end there as well */ - my_pwrite(s->file, (uchar*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, 0, - MYF(0)); + return my_pwrite(s->file, (uchar*) buffer, AZHEADER_SIZE + AZMETA_BUFFER_SIZE, + 0, MYF(MY_NABP)) ? 1 : 0; } /* =========================================================================== @@ -838,19 +838,19 @@ int azwrite_frm(azio_stream *s, char *blob, unsigned int length) s->frm_length= length; s->start+= length; - my_pwrite(s->file, (uchar*) blob, s->frm_length, s->frm_start_pos, MYF(0)); - - write_header(s); - my_seek(s->file, 0, MY_SEEK_END, MYF(0)); + if (my_pwrite(s->file, (uchar*) blob, s->frm_length, + s->frm_start_pos, MYF(MY_NABP)) || + write_header(s) || + (my_seek(s->file, 0, MY_SEEK_END, MYF(0)) == MY_FILEPOS_ERROR)) + return 1; return 0; } int azread_frm(azio_stream *s, char *blob) { - my_pread(s->file, (uchar*) blob, s->frm_length, s->frm_start_pos, MYF(0)); - - return 0; + return my_pread(s->file, (uchar*) blob, s->frm_length, + s->frm_start_pos, MYF(MY_NABP)) ? 1 : 0; } diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 63848370ff1..ef907b035b5 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -613,6 +613,34 @@ int ha_archive::close(void) } +/** + Copy a frm blob between streams. + + @param src The source stream. + @param dst The destination stream. + + @return Zero on success, non-zero otherwise. +*/ + +int ha_archive::frm_copy(azio_stream *src, azio_stream *dst) +{ + int rc= 0; + char *frm_ptr; + + if (!(frm_ptr= (char *) my_malloc(src->frm_length, MYF(0)))) + return HA_ERR_OUT_OF_MEM; + + /* Write file offset is set to the end of the file. */ + if (azread_frm(src, frm_ptr) || + azwrite_frm(dst, frm_ptr, src->frm_length)) + rc= my_errno ? my_errno : HA_ERR_INTERNAL_ERROR; + + my_free(frm_ptr); + + return rc; +} + + /* We create our data file here. The format is pretty simple. You can read about the format of the data file above. @@ -1345,10 +1373,10 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt) */ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) { - DBUG_ENTER("ha_archive::optimize"); int rc= 0; azio_stream writer; char writer_filename[FN_REFLEN]; + DBUG_ENTER("ha_archive::optimize"); init_archive_reader(); @@ -1366,6 +1394,13 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) if (!(azopen(&writer, writer_filename, O_CREAT|O_RDWR|O_BINARY))) DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + /* + Transfer the embedded FRM so that the file can be discoverable. + Write file offset is set to the end of the file. + */ + if ((rc= frm_copy(&archive, &writer))) + goto error; + /* An extended rebuild is a lot more effort. We open up each row and re-record it. Any dead rows are removed (aka rows that may have been partially recorded). diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index 94842203f16..b258b403c3c 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -75,6 +75,7 @@ class ha_archive: public handler archive_record_buffer *create_record_buffer(unsigned int length); void destroy_record_buffer(archive_record_buffer *r); + int frm_copy(azio_stream *src, azio_stream *dst); public: ha_archive(handlerton *hton, TABLE_SHARE *table_arg); diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 30c4c4d58ca..216097f0fdc 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -807,15 +807,15 @@ int ha_tina::find_current_row(uchar *buf) Field_blob *blob= *(Field_blob**) field; uchar *src, *tgt; uint length, packlength; - + packlength= blob->pack_length_no_ptr(); length= blob->get_length(blob->ptr); - memcpy_fixed(&src, blob->ptr + packlength, sizeof(char*)); + memcpy(&src, blob->ptr + packlength, sizeof(char*)); if (src) { tgt= (uchar*) alloc_root(&blobroot, length); bmove(tgt, src, length); - memcpy_fixed(blob->ptr + packlength, &tgt, sizeof(char*)); + memcpy(blob->ptr + packlength, &tgt, sizeof(char*)); } } } diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index d17b56bd4b1..b1ae276dce8 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -2752,9 +2752,9 @@ void ha_federated::position(const uchar *record __attribute__ ((unused))) position_called= TRUE; /* Store result set address. */ - memcpy_fixed(ref, &stored_result, sizeof(MYSQL_RES *)); + memcpy(ref, &stored_result, sizeof(MYSQL_RES *)); /* Store data cursor position. */ - memcpy_fixed(ref + sizeof(MYSQL_RES *), ¤t_position, + memcpy(ref + sizeof(MYSQL_RES *), ¤t_position, sizeof(MYSQL_ROW_OFFSET)); DBUG_VOID_RETURN; } @@ -2780,11 +2780,11 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos) ha_statistic_increment(&SSV::ha_read_rnd_count); /* Get stored result set. */ - memcpy_fixed(&result, pos, sizeof(MYSQL_RES *)); + memcpy(&result, pos, sizeof(MYSQL_RES *)); DBUG_ASSERT(result); /* Set data cursor position. */ - memcpy_fixed(&result->data_cursor, pos + sizeof(MYSQL_RES *), - sizeof(MYSQL_ROW_OFFSET)); + memcpy(&result->data_cursor, pos + sizeof(MYSQL_RES *), + sizeof(MYSQL_ROW_OFFSET)); /* Read a row. */ ret_val= read_next(buf, result); MYSQL_READ_ROW_DONE(ret_val); diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 350958f8230..481257def1d 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -390,7 +390,7 @@ int ha_heap::rnd_pos(uchar * buf, uchar *pos) MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str, FALSE); ha_statistic_increment(&SSV::ha_read_rnd_count); - memcpy_fixed((char*) &heap_position, pos, sizeof(HEAP_PTR)); + memcpy(&heap_position, pos, sizeof(HEAP_PTR)); error=heap_rrnd(file, buf, heap_position); table->status=error ? STATUS_NOT_FOUND: 0; MYSQL_READ_ROW_DONE(error); @@ -654,7 +654,7 @@ heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table, parts * sizeof(HA_KEYSEG), MYF(MY_WME)))) return my_errno; - seg= my_reinterpret_cast(HA_KEYSEG*) (keydef + keys); + seg= reinterpret_cast<HA_KEYSEG*>(keydef + keys); for (key= 0; key < keys; key++) { KEY *pos= table_arg->key_info+key; diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c index 1571fc98402..3ee903be7ed 100644 --- a/storage/heap/hp_test2.c +++ b/storage/heap/hp_test2.c @@ -179,11 +179,6 @@ int main(int argc, char *argv[]) printf("can't find key1: \"%s\"\n",(char*) key); goto err; } -#ifdef NOT_USED - if (file->current_ptr == hp_find_block(&file->s->block,0) || - file->current_ptr == hp_find_block(&file->s->block,1)) - continue; /* Don't remove 2 first records */ -#endif if (heap_delete(file,record)) { printf("error: %d; can't delete record: \"%s\"\n", my_errno,(char*) record); diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 33c1e092a00..b54b4c6ce49 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -92,6 +92,8 @@ static double *nwghts=_nwghts+5; /* nwghts[i] = -0.5*1.5**i */ #define FTB_FLAG_NO 4 #define FTB_FLAG_WONLY 8 +#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) + typedef struct st_ftb_expr FTB_EXPR; struct st_ftb_expr { diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index 7d9b13b7714..937bb6ffe19 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -197,7 +197,8 @@ static int walk_and_push(FT_SUPERDOC *from, static int FT_DOC_cmp(void *unused __attribute__((unused)), FT_DOC *a, FT_DOC *b) { - return sgn(b->weight - a->weight); + double c= b->weight - a->weight; + return ((c < 0) ? -1 : (c > 0) ? 1 : 0); } diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c index 8f5779b04ee..663d7869f71 100644 --- a/storage/myisam/ft_parser.c +++ b/storage/myisam/ft_parser.c @@ -39,7 +39,7 @@ static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat) { word->weight=LWS_IN_USE; docstat->sum+=word->weight; - memcpy_fixed((docstat->list)++,word,sizeof(FT_WORD)); + memcpy((docstat->list)++, word, sizeof(FT_WORD)); return 0; } diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c index d1548e32870..a2ddb49ecf0 100644 --- a/storage/myisam/ft_update.c +++ b/storage/myisam/ft_update.c @@ -83,8 +83,7 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi) if (ftsi->seg->flag & HA_BLOB_PART) { ftsi->len=_mi_calc_blob_length(ftsi->seg->bit_start,ftsi->pos); - memcpy_fixed((char*) &ftsi->pos, ftsi->pos+ftsi->seg->bit_start, - sizeof(char*)); + memcpy(&ftsi->pos, ftsi->pos+ftsi->seg->bit_start, sizeof(char*)); DBUG_RETURN(1); } ftsi->len=ftsi->seg->length; diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 13427130069..6bf01cd63c7 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -52,11 +52,6 @@ #endif #include "rt_index.h" -#ifndef USE_RAID -#define my_raid_create(K, A, B, C, D, E, F, G) mysql_file_create(K, A, B, C, G) -#define my_raid_delete(K, A, B, C) mysql_file_delete(K, A, B) -#endif - /* Functions defined in this file */ static int check_k_link(MI_CHECK *param, MI_INFO *info,uint nr); @@ -1577,15 +1572,12 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, if (!rep_quick) { /* Get real path for data file */ - if ((new_file= my_raid_create(mi_key_file_datatmp, - fn_format(param->temp_filename, - share->data_file_name, "", - DATA_TMP_EXT, 2+4), - 0, param->tmpfile_createflag, - share->base.raid_type, - share->base.raid_chunks, - share->base.raid_chunksize, - MYF(0))) < 0) + if ((new_file= mysql_file_create(mi_key_file_datatmp, + fn_format(param->temp_filename, + share->data_file_name, "", + DATA_TMP_EXT, 2+4), + 0, param->tmpfile_createflag, + MYF(0))) < 0) { mi_check_print_error(param,"Can't create new tempfile: '%s'", param->temp_filename); @@ -1751,8 +1743,7 @@ err: (size_t) info->s->mmaped_length); info->s->file_map= NULL; } - if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, - DATA_TMP_EXT, share->base.raid_chunks, + if (change_to_newfile(share->data_file_name, MI_NAME_DEXT, DATA_TMP_EXT, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || mi_open_datafile(info,share,name,-1)) @@ -1767,9 +1758,8 @@ err: if (new_file >= 0) { (void) mysql_file_close(new_file, MYF(0)); - (void) my_raid_delete(mi_key_file_datatmp, - param->temp_filename, info->s->base.raid_chunks, - MYF(MY_WME)); + (void) mysql_file_delete(mi_key_file_datatmp, + param->temp_filename, MYF(MY_WME)); info->rec_cache.file=-1; /* don't flush data to new_file, it's closed */ } mi_mark_crashed_on_repair(info); @@ -2011,7 +2001,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name) (void) mysql_file_close(share->kfile, MYF(MY_WME)); share->kfile = -1; (void) mysql_file_close(new_file, MYF(MY_WME)); - if (change_to_newfile(share->index_file_name,MI_NAME_IEXT,INDEX_TMP_EXT,0, + if (change_to_newfile(share->index_file_name, MI_NAME_IEXT, INDEX_TMP_EXT, MYF(0)) || mi_open_keyfile(share)) goto err2; @@ -2141,18 +2131,9 @@ err: */ int change_to_newfile(const char * filename, const char * old_ext, - const char * new_ext, - uint raid_chunks __attribute__((unused)), - myf MyFlags) + const char * new_ext, myf MyFlags) { char old_filename[FN_REFLEN],new_filename[FN_REFLEN]; -#ifdef USE_RAID - if (raid_chunks) - return my_raid_redel(fn_format(old_filename,filename,"",old_ext,2+4), - fn_format(new_filename,filename,"",new_ext,2+4), - raid_chunks, - MYF(MY_WME | MY_LINK_WARNING | MyFlags)); -#endif /* Get real path to filename */ (void) fn_format(old_filename,filename,"",old_ext,2+4+32); return my_redel(old_filename, @@ -2293,15 +2274,12 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, if (!rep_quick) { /* Get real path for data file */ - if ((new_file= my_raid_create(mi_key_file_datatmp, - fn_format(param->temp_filename, - share->data_file_name, "", - DATA_TMP_EXT, 2+4), - 0, param->tmpfile_createflag, - share->base.raid_type, - share->base.raid_chunks, - share->base.raid_chunksize, - MYF(0))) < 0) + if ((new_file= mysql_file_create(mi_key_file_datatmp, + fn_format(param->temp_filename, + share->data_file_name, "", + DATA_TMP_EXT, 2+4), + 0, param->tmpfile_createflag, + MYF(0))) < 0) { mi_check_print_error(param,"Can't create new tempfile: '%s'", param->temp_filename); @@ -2527,7 +2505,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, skr < share->base.reloc*share->base.min_pack_length) skr=share->base.reloc*share->base.min_pack_length; #endif - if (skr != sort_info.filelength && !info->s->base.raid_type) + if (skr != sort_info.filelength) if (mysql_file_chsize(info->dfile, skr, 0, MYF(0))) mi_check_print_warning(param, "Can't change size of datafile, error: %d", @@ -2565,8 +2543,7 @@ err: { mysql_file_close(new_file, MYF(0)); info->dfile=new_file= -1; - if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, - DATA_TMP_EXT, share->base.raid_chunks, + if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, DATA_TMP_EXT, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || mi_open_datafile(info,share,name,-1)) @@ -2580,9 +2557,8 @@ err: if (new_file >= 0) { (void) mysql_file_close(new_file, MYF(0)); - (void) my_raid_delete(mi_key_file_datatmp, - param->temp_filename, share->base.raid_chunks, - MYF(MY_WME)); + (void) mysql_file_delete(mi_key_file_datatmp, + param->temp_filename, MYF(MY_WME)); if (info->dfile == new_file) /* Retry with key cache */ if (unlikely(mi_open_datafile(info, share, name, -1))) param->retry_repair= 0; /* Safety */ @@ -2751,16 +2727,12 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, if (!rep_quick) { /* Get real path for data file */ - if ((new_file= my_raid_create(mi_key_file_datatmp, - fn_format(param->temp_filename, - share->data_file_name, "", - DATA_TMP_EXT, - 2+4), - 0, param->tmpfile_createflag, - share->base.raid_type, - share->base.raid_chunks, - share->base.raid_chunksize, - MYF(0))) < 0) + if ((new_file= mysql_file_create(mi_key_file_datatmp, + fn_format(param->temp_filename, + share->data_file_name, "", + DATA_TMP_EXT, 2+4), + 0, param->tmpfile_createflag, + MYF(0))) < 0) { mi_check_print_error(param,"Can't create new tempfile: '%s'", param->temp_filename); @@ -3055,7 +3027,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, skr < share->base.reloc*share->base.min_pack_length) skr=share->base.reloc*share->base.min_pack_length; #endif - if (skr != sort_info.filelength && !info->s->base.raid_type) + if (skr != sort_info.filelength) if (mysql_file_chsize(info->dfile, skr, 0, MYF(0))) mi_check_print_warning(param, "Can't change size of datafile, error: %d", @@ -3105,8 +3077,7 @@ err: { mysql_file_close(new_file, MYF(0)); info->dfile=new_file= -1; - if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, - DATA_TMP_EXT, share->base.raid_chunks, + if (change_to_newfile(share->data_file_name, MI_NAME_DEXT, DATA_TMP_EXT, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || mi_open_datafile(info,share,name,-1)) @@ -3120,9 +3091,8 @@ err: if (new_file >= 0) { (void) mysql_file_close(new_file, MYF(0)); - (void) my_raid_delete(mi_key_file_datatmp, - param->temp_filename, share->base.raid_chunks, - MYF(MY_WME)); + (void) mysql_file_delete(mi_key_file_datatmp, + param->temp_filename, MYF(MY_WME)); if (info->dfile == new_file) /* Retry with key cache */ if (unlikely(mi_open_datafile(info, share, name, -1))) param->retry_repair= 0; /* Safety */ diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 4a91c2d939b..46c61eb4709 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -549,11 +549,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, share.base.pack_bits=packed; share.base.fields=fields; share.base.pack_fields=packed; -#ifdef USE_RAID - share.base.raid_type=ci->raid_type; - share.base.raid_chunks=ci->raid_chunks; - share.base.raid_chunksize=ci->raid_chunksize; -#endif /* max_data_file_length and max_key_file_length are recalculated on open */ if (options & HA_OPTION_TMP_TABLE) @@ -642,20 +637,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, if (!(flags & HA_DONT_TOUCH_DATA)) { -#ifdef USE_RAID - if (share.base.raid_type) - { - (void) fn_format(filename, name, "", MI_NAME_DEXT, - MY_UNPACK_FILENAME | MY_APPEND_EXT); - if ((dfile=my_raid_create(filename, 0, create_mode, - share.base.raid_type, - share.base.raid_chunks, - share.base.raid_chunksize, - MYF(MY_WME | MY_RAID))) < 0) - goto err; - } - else -#endif { if (ci->data_file_name) { @@ -841,7 +822,6 @@ err: (void) mysql_file_close(dfile, MYF(0)); /* fall through */ case 2: - /* QQ: Tõnu should add a call to my_raid_delete() here */ if (! (flags & HA_DONT_TOUCH_DATA)) mysql_file_delete_with_symlink(mi_key_file_dfile, fn_format(filename, name, "", MI_NAME_DEXT, diff --git a/storage/myisam/mi_delete_table.c b/storage/myisam/mi_delete_table.c index 58a60a760aa..a05a2ad6237 100644 --- a/storage/myisam/mi_delete_table.c +++ b/storage/myisam/mi_delete_table.c @@ -22,40 +22,11 @@ int mi_delete_table(const char *name) { char from[FN_REFLEN]; -#ifdef USE_RAID - uint raid_type=0,raid_chunks=0; -#endif DBUG_ENTER("mi_delete_table"); #ifdef EXTRA_DEBUG check_table_is_closed(name,"delete"); #endif -#ifdef USE_RAID - { - MI_INFO *info; - /* - When built with RAID support, we need to determine if this table - makes use of the raid feature. If yes, we need to remove all raid - chunks. This is done with my_raid_delete(). Unfortunately it is - necessary to open the table just to check this. We use - 'open_for_repair' to be able to open even a crashed table. If even - this open fails, we assume no raid configuration for this table - and try to remove the normal data file only. This may however - leave the raid chunks behind. - */ - if (!(info= mi_open(name, O_RDONLY, HA_OPEN_FOR_REPAIR))) - raid_type= 0; - else - { - raid_type= info->s->base.raid_type; - raid_chunks= info->s->base.raid_chunks; - mi_close(info); - } - } -#ifdef EXTRA_DEBUG - check_table_is_closed(name,"delete"); -#endif -#endif /* USE_RAID */ fn_format(from,name,"",MI_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); if (my_is_symlink(from) && (*myisam_test_invalid_symlink)(from)) @@ -73,10 +44,6 @@ int mi_delete_table(const char *name) DBUG_RETURN(my_errno); } fn_format(from,name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); -#ifdef USE_RAID - if (raid_type) - DBUG_RETURN(my_raid_delete(from, raid_chunks, MYF(MY_WME)) ? my_errno : 0); -#endif if (my_is_symlink(from) && (*myisam_test_invalid_symlink)(from)) { /* diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 59b895b5e64..f429edd2759 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -283,13 +283,6 @@ int _mi_write_blob_record(MI_INFO *info, const uchar *record) MI_DYN_DELETE_BLOCK_HEADER+1); reclength= (info->s->base.pack_reclength + _my_calc_total_blob_length(info,record)+ extra); -#ifdef NOT_USED /* We now support big rows */ - if (reclength > MI_DYN_MAX_ROW_LENGTH) - { - my_errno=HA_ERR_TO_BIG_ROW; - return -1; - } -#endif if (!(rec_buff=(uchar*) my_alloca(reclength))) { my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ @@ -317,13 +310,6 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const uchar *record) MI_DYN_DELETE_BLOCK_HEADER); reclength= (info->s->base.pack_reclength+ _my_calc_total_blob_length(info,record)+ extra); -#ifdef NOT_USED /* We now support big rows */ - if (reclength > MI_DYN_MAX_ROW_LENGTH) - { - my_errno=HA_ERR_TO_BIG_ROW; - return -1; - } -#endif if (!(rec_buff=(uchar*) my_alloca(reclength))) { my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ @@ -1009,7 +995,7 @@ uint _mi_rec_pack(MI_INFO *info, register uchar *to, char *temp_pos; size_t tmp_length=length-portable_sizeof_char_ptr; memcpy((uchar*) to,from,tmp_length); - memcpy_fixed(&temp_pos,from+tmp_length,sizeof(char*)); + memcpy(&temp_pos,from+tmp_length,sizeof(char*)); memcpy(to+tmp_length,temp_pos,(size_t) blob->length); to+=tmp_length+blob->length; } @@ -1324,9 +1310,9 @@ ulong _mi_rec_unpack(register MI_INFO *info, register uchar *to, uchar *from, from_left - size_length < blob_length || from_left - size_length - blob_length < min_pack_length) goto err; - memcpy((uchar*) to,(uchar*) from,(size_t) size_length); + memcpy(to, from, (size_t) size_length); from+=size_length; - memcpy_fixed((uchar*) to+size_length,(uchar*) &from,sizeof(char*)); + memcpy(to+size_length, &from, sizeof(char*)); from+=blob_length; } else diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c index 3f445ebf44d..bce42b64e99 100644 --- a/storage/myisam/mi_key.c +++ b/storage/myisam/mi_key.c @@ -139,7 +139,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, else if (keyseg->flag & HA_BLOB_PART) { uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); - memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*)); + memcpy(&pos,pos+keyseg->bit_start,sizeof(char*)); set_if_smaller(length,tmp_length); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index f6bbaab1f87..5af4a057a95 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -149,7 +149,7 @@ void _myisam_log_record(enum myisam_log_commands command, MI_INFO *info, blob != end ; blob++) { - memcpy_fixed((uchar*) &pos, record+blob->offset+blob->pack_length, + memcpy(&pos, record+blob->offset+blob->pack_length, sizeof(char*)); (void) mysql_file_write(myisam_log_file, pos, blob->length, MYF(0)); } diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 5b3da9841b8..e3c29909067 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -260,25 +260,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) set_if_smaller(max_data_file_length, INT_MAX32); set_if_smaller(max_key_file_length, INT_MAX32); #endif -#if USE_RAID && SYSTEM_SIZEOF_OFF_T == 4 - set_if_smaller(max_key_file_length, INT_MAX32); - if (!share->base.raid_type) - { - set_if_smaller(max_data_file_length, INT_MAX32); - } - else - { - set_if_smaller(max_data_file_length, - (ulonglong) share->base.raid_chunks << 31); - } -#elif !defined(USE_RAID) - if (share->base.raid_type) - { - DBUG_PRINT("error",("Table uses RAID but we don't have RAID support")); - my_errno=HA_ERR_UNSUPPORTED; - goto err; - } -#endif share->base.max_data_file_length=(my_off_t) max_data_file_length; share->base.max_key_file_length=(my_off_t) max_key_file_length; @@ -877,7 +858,7 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite) key_blocks=state->header.max_block_size_index; DBUG_ENTER("mi_state_info_write"); - memcpy_fixed(ptr,&state->header,sizeof(state->header)); + memcpy(ptr, &state->header, sizeof(state->header)); ptr+=sizeof(state->header); /* open_count must be first because of _mi_mark_file_changed ! */ @@ -936,7 +917,7 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite) uchar *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state) { uint i,keys,key_parts,key_blocks; - memcpy_fixed(&state->header,ptr, sizeof(state->header)); + memcpy(&state->header, ptr, sizeof(state->header)); ptr +=sizeof(state->header); keys=(uint) state->header.keys; key_parts=mi_uint2korr(state->header.key_parts); @@ -1036,10 +1017,7 @@ uint mi_base_info_write(File file, MI_BASE_INFO *base) mi_int2store(ptr,base->max_key_length); ptr +=2; mi_int2store(ptr,base->extra_alloc_bytes); ptr +=2; *ptr++= base->extra_alloc_procent; - *ptr++= base->raid_type; - mi_int2store(ptr,base->raid_chunks); ptr +=2; - mi_int4store(ptr,base->raid_chunksize); ptr +=4; - bzero(ptr,6); ptr +=6; /* extra */ + bzero(ptr,13); ptr +=13; /* extra */ return mysql_file_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0; } @@ -1070,17 +1048,8 @@ uchar *my_n_base_info_read(uchar *ptr, MI_BASE_INFO *base) base->max_key_length = mi_uint2korr(ptr); ptr +=2; base->extra_alloc_bytes = mi_uint2korr(ptr); ptr +=2; base->extra_alloc_procent = *ptr++; - base->raid_type= *ptr++; - base->raid_chunks= mi_uint2korr(ptr); ptr +=2; - base->raid_chunksize= mi_uint4korr(ptr); ptr +=4; - /* TO BE REMOVED: Fix for old RAID files */ - if (base->raid_type == 0) - { - base->raid_chunks=0; - base->raid_chunksize=0; - } - ptr+=6; + ptr+=13; return ptr; } @@ -1223,7 +1192,7 @@ uchar *mi_recinfo_read(uchar *ptr, MI_COLUMNDEF *recinfo) } /************************************************************************** -Open data file with or without RAID +Open data file. We can't use dup() here as the data file descriptors need to have different active seek-positions. @@ -1251,20 +1220,8 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *org_name, data_name= real_data_name; } } -#ifdef USE_RAID - if (share->base.raid_type) - { - info->dfile=my_raid_open(data_name, - share->mode | O_SHARE, - share->base.raid_type, - share->base.raid_chunks, - share->base.raid_chunksize, - MYF(MY_WME | MY_RAID)); - } - else -#endif - info->dfile= mysql_file_open(mi_key_file_dfile, - data_name, share->mode | O_SHARE, MYF(MY_WME)); + info->dfile= mysql_file_open(mi_key_file_dfile, + data_name, share->mode | O_SHARE, MYF(MY_WME)); return info->dfile >= 0 ? 0 : 1; } diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index 0ba495fdd68..d8d892a5bc9 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -1051,8 +1051,7 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, } decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length); _my_store_blob_length((uchar*) to,pack_length,length); - memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos, - sizeof(char*)); + memcpy((char*) to+pack_length, &bit_buff->blob_pos, sizeof(char*)); bit_buff->blob_pos+=length; } } diff --git a/storage/myisam/mi_rename.c b/storage/myisam/mi_rename.c index 56ccb333d03..455d45cecfe 100644 --- a/storage/myisam/mi_rename.c +++ b/storage/myisam/mi_rename.c @@ -22,28 +22,12 @@ int mi_rename(const char *old_name, const char *new_name) { char from[FN_REFLEN],to[FN_REFLEN]; -#ifdef USE_RAID - uint raid_type=0,raid_chunks=0; -#endif DBUG_ENTER("mi_rename"); #ifdef EXTRA_DEBUG check_table_is_closed(old_name,"rename old_table"); check_table_is_closed(new_name,"rename new table2"); #endif -#ifdef USE_RAID - { - MI_INFO *info; - if (!(info=mi_open(old_name, O_RDONLY, 0))) - DBUG_RETURN(my_errno); - raid_type = info->s->base.raid_type; - raid_chunks = info->s->base.raid_chunks; - mi_close(info); - } -#ifdef EXTRA_DEBUG - check_table_is_closed(old_name,"rename raidcheck"); -#endif -#endif /* USE_RAID */ fn_format(from,old_name,"",MI_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); fn_format(to,new_name,"",MI_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); @@ -51,11 +35,6 @@ int mi_rename(const char *old_name, const char *new_name) DBUG_RETURN(my_errno); fn_format(from,old_name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); fn_format(to,new_name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); -#ifdef USE_RAID - if (raid_type) - DBUG_RETURN(my_raid_rename(from, to, raid_chunks, MYF(MY_WME)) ? my_errno : - 0); -#endif DBUG_RETURN(mysql_file_rename_with_symlink(mi_key_file_dfile, from, to, MYF(MY_WME)) ? my_errno : 0); diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c index baa01a507eb..073b127f1a3 100644 --- a/storage/myisam/mi_static.c +++ b/storage/myisam/mi_static.c @@ -38,7 +38,6 @@ uint myisam_concurrent_insert= 2; uint myisam_concurrent_insert= 0; #endif ulonglong myisam_max_temp_length= MAX_FILE_SIZE; -ulong myisam_bulk_insert_tree_size=8192*1024; ulong myisam_data_pointer_size=4; ulonglong myisam_mmap_size= SIZE_T_MAX, myisam_mmap_used= 0; diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c index 742864fe241..f89f2a8d21d 100644 --- a/storage/myisam/mi_test1.c +++ b/storage/myisam/mi_test1.c @@ -411,7 +411,7 @@ static void create_record(uchar *record,uint rownr) tmp=strlen((char*) blob_key); int4store(pos,tmp); ptr=blob_key; - memcpy_fixed(pos+4,&ptr,sizeof(char*)); + memcpy(pos+4, &ptr, sizeof(char*)); pos+=recinfo[1].length; } else if (recinfo[1].type == FIELD_VARCHAR) @@ -439,7 +439,7 @@ static void create_record(uchar *record,uint rownr) tmp=strlen((char*) blob_record); int4store(pos,tmp); ptr=blob_record; - memcpy_fixed(pos+4,&ptr,sizeof(char*)); + memcpy(pos+4, &ptr, sizeof(char*)); } else if (recinfo[2].type == FIELD_VARCHAR) { @@ -468,10 +468,10 @@ static void update_record(uchar *record) uchar *column,*ptr; int length; length=uint4korr(pos); /* Long blob */ - memcpy_fixed(&column,pos+4,sizeof(char*)); + memcpy(&column, pos+4, sizeof(char*)); memcpy(blob_key,column,length); /* Move old key */ ptr=blob_key; - memcpy_fixed(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */ + memcpy(pos+4, &ptr, sizeof(char*)); /* Store pointer to new key */ if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM) default_charset_info->cset->casedn(default_charset_info, (char*) blob_key, length, @@ -501,13 +501,13 @@ static void update_record(uchar *record) uchar *column; int length; length=uint4korr(pos); - memcpy_fixed(&column,pos+4,sizeof(char*)); + memcpy(&column, pos+4, sizeof(char*)); memcpy(blob_record,column,length); bfill(blob_record+length,20,'.'); /* Make it larger */ length+=20; int4store(pos,length); column= blob_record; - memcpy_fixed(pos+4,&column,sizeof(char*)); + memcpy(pos+4, &column, sizeof(char*)); } else if (recinfo[2].type == FIELD_VARCHAR) { diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 513b390ee68..127d93b5433 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -1030,7 +1030,7 @@ static void put_blob_in_record(uchar *blob_pos, char **blob_buffer) for (i=0 ; i < length ; i++) (*blob_buffer)[i]=(char) (length+i); int4store(blob_pos,length); - memcpy_fixed(blob_pos+4,(char*) blob_buffer,sizeof(char*)); + memcpy(blob_pos+4, blob_buffer, sizeof(char*)); } else { diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c index bf36d8df7f4..c03a34df227 100644 --- a/storage/myisam/mi_test3.c +++ b/storage/myisam/mi_test3.c @@ -458,7 +458,7 @@ int test_update(MI_INFO *file,int id,int lock_type) } } } - memcpy_fixed(new_record.id,record.id,sizeof(record.id)); + memcpy(new_record.id, record.id, sizeof(record.id)); tmp=rnd(20000)+40000; int4store(new_record.nr,tmp); if (!mi_update(file,record.id,new_record.id)) diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index fdba84a2e67..cee159951de 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -111,7 +111,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record) else if (keyseg->flag & HA_BLOB_PART) { uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); - memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*)); + memcpy(&pos, pos+keyseg->bit_start, sizeof(char*)); if (!length || length > tmp_length) length=tmp_length; /* The whole blob */ } @@ -206,8 +206,8 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b, set_if_smaller(a_length, keyseg->length); set_if_smaller(b_length, keyseg->length); } - memcpy_fixed((uchar*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*)); - memcpy_fixed((uchar*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*)); + memcpy(&pos_a, pos_a+keyseg->bit_start, sizeof(char*)); + memcpy(&pos_b, pos_b+keyseg->bit_start, sizeof(char*)); } if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 || type == HA_KEYTYPE_VARTEXT2) diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index f2d43585eef..bd56bb04f65 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -61,11 +61,6 @@ int mi_write(MI_INFO *info, uchar *record) if (_mi_readinfo(info,F_WRLCK,1)) DBUG_RETURN(my_errno); dont_break(); /* Dont allow SIGHUP or SIGINT */ -#if !defined(NO_LOCKING) && defined(USE_RECORD_LOCK) - if (!info->locked && my_lock(info->dfile,F_WRLCK,0L,F_TO_EOF, - MYF(MY_SEEK_NOT_DONE) | info->lock_wait)) - goto err; -#endif filepos= ((share->state.dellink != HA_OFFSET_ERROR && !info->append_insert_at_end) ? share->state.dellink : diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c index 4718abc3481..1c534fe8d02 100644 --- a/storage/myisam/myisam_ftdump.c +++ b/storage/myisam/myisam_ftdump.c @@ -46,7 +46,7 @@ static struct my_option my_long_options[] = {"stats", 's', "Report global stats.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Be verbose.", - (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + &verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index e1cedf6bc31..4df76e31872 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -27,12 +27,6 @@ #ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> #endif -SET_STACK_SIZE(9000) /* Minimum stack size for program */ - -#ifndef USE_RAID -#define my_raid_create(A,B,C,D,E,F,G) my_create(A,B,C,G) -#define my_raid_delete(A,B,C) my_delete(A,B) -#endif static uint decode_bits; static char **default_argv; @@ -782,7 +776,6 @@ static int myisamchk(MI_CHECK *param, char * filename) { int error,lock_type,recreate; int rep_quick= param->testflag & (T_QUICK | T_FORCE_UNIQUENESS); - uint raid_chunks; MI_INFO *info; File datafile; char llbuff[22],llbuff2[22]; @@ -844,7 +837,6 @@ static int myisamchk(MI_CHECK *param, char * filename) share->options&= ~HA_OPTION_READ_ONLY_DATA; /* We are modifing it */ share->tot_locks-= share->r_locks; share->r_locks=0; - raid_chunks=share->base.raid_chunks; /* Skip the checking of the file if: @@ -1013,9 +1005,7 @@ static int myisamchk(MI_CHECK *param, char * filename) if (param->out_flag & O_NEW_DATA) { /* Change temp file to org file */ (void) my_close(info->dfile,MYF(MY_WME)); /* Close new file */ - error|=change_to_newfile(filename,MI_NAME_DEXT,DATA_TMP_EXT, - raid_chunks, - MYF(0)); + error|=change_to_newfile(filename, MI_NAME_DEXT, DATA_TMP_EXT, MYF(0)); if (mi_open_datafile(info,info->s, NULL, -1)) error=1; param->out_flag&= ~O_NEW_DATA; /* We are using new datafile */ @@ -1146,12 +1136,10 @@ end2: { if (param->out_flag & O_NEW_DATA) error|=change_to_newfile(filename,MI_NAME_DEXT,DATA_TMP_EXT, - raid_chunks, ((param->testflag & T_BACKUP_DATA) ? MYF(MY_REDEL_MAKE_BACKUP) : MYF(0))); if (param->out_flag & O_NEW_INDEX) - error|=change_to_newfile(filename,MI_NAME_IEXT,INDEX_TMP_EXT,0, - MYF(0)); + error|=change_to_newfile(filename, MI_NAME_IEXT, INDEX_TMP_EXT, MYF(0)); } (void) fflush(stdout); (void) fflush(stderr); if (param->error_printed) @@ -1247,16 +1235,9 @@ static void descript(MI_CHECK *param, register MI_INFO *info, char * name) share->base.auto_key, llstr(share->state.auto_increment,llbuff)); } - if (share->base.raid_type) - { - printf("RAID: Type: %u Chunks: %u Chunksize: %lu\n", - share->base.raid_type, - share->base.raid_chunks, - share->base.raid_chunksize); - } if (share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD)) printf("Checksum: %23s\n",llstr(info->state->checksum,llbuff)); -; + if (share->options & HA_OPTION_DELAY_KEY_WRITE) printf("Keys are only flushed at close\n"); @@ -1527,14 +1508,11 @@ static int mi_sort_records(MI_CHECK *param, goto err; } fn_format(param->temp_filename,name,"", MI_NAME_DEXT,2+4+32); - new_file=my_raid_create(fn_format(param->temp_filename, - param->temp_filename,"", - DATA_TMP_EXT,2+4), - 0,param->tmpfile_createflag, - share->base.raid_type, - share->base.raid_chunks, - share->base.raid_chunksize, - MYF(0)); + new_file= my_create(fn_format(param->temp_filename, + param->temp_filename, "", + DATA_TMP_EXT, 2+4), + 0, param->tmpfile_createflag, + MYF(0)); if (new_file < 0) { mi_check_print_error(param,"Can't create new tempfile: '%s'", @@ -1609,8 +1587,7 @@ err: { (void) end_io_cache(&info->rec_cache); (void) my_close(new_file,MYF(MY_WME)); - (void) my_raid_delete(param->temp_filename, share->base.raid_chunks, - MYF(MY_WME)); + (void) my_delete(param->temp_filename, MYF(MY_WME)); } if (temp_buff) { diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index 130a96bc9e0..c7f0cb27a40 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -26,8 +26,9 @@ #endif #include <mysql/psi/mysql_file.h> -#if defined(my_write) && !defined(MAP_TO_USE_RAID) -#undef my_write /* undef map from my_nosys; We need test-if-disk full */ +/* undef map from my_nosys; We need test-if-disk full */ +#if defined(my_write) +#undef my_write #endif typedef struct st_mi_status_info @@ -130,9 +131,6 @@ typedef struct st_mi_base_info /* Extra allocation when using dynamic record format */ uint extra_alloc_bytes; uint extra_alloc_procent; - /* Info about raid */ - uint raid_type,raid_chunks; - ulong raid_chunksize; /* The following are from the header */ uint key_parts,all_key_parts; } MI_BASE_INFO; @@ -544,10 +542,6 @@ void _mi_store_static_key(MI_KEYDEF *keyinfo, uchar *key_pos, MI_KEY_PARAM *s_temp); void _mi_store_var_pack_key(MI_KEYDEF *keyinfo, uchar *key_pos, MI_KEY_PARAM *s_temp); -#ifdef NOT_USED -void _mi_store_pack_key(MI_KEYDEF *keyinfo, uchar *key_pos, - MI_KEY_PARAM *s_temp); -#endif void _mi_store_bin_pack_key(MI_KEYDEF *keyinfo, uchar *key_pos, MI_KEY_PARAM *s_temp); diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index d3da0eab22c..84743b8da51 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -619,7 +619,7 @@ static int examine_log(char * file_name, char **table_names) case MI_LOG_LOCK: if (my_b_read(&cache,(uchar*) head,sizeof(lock_command))) goto err; - memcpy_fixed(&lock_command,head,sizeof(lock_command)); + memcpy(&lock_command, head, sizeof(lock_command)); if (verbose && !record_pos_file && (!table_names[0] || (curr_file_info && curr_file_info->used))) printf_log("%s: %s(%d) -> %d\n",FILENAME(curr_file_info), @@ -728,7 +728,7 @@ static void fix_blob_pointers(MI_INFO *info, uchar *record) blob != end ; blob++) { - memcpy_fixed(record+blob->offset+blob->pack_length,&pos,sizeof(char*)); + memcpy(record+blob->offset+blob->pack_length, &pos, sizeof(char*)); pos+=_mi_calc_blob_length(blob->pack_length,record+blob->offset); } } diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 4cd305fdc69..84a7f2a1ba9 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -1040,7 +1040,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) { uint field_length=count->field_length -portable_sizeof_char_ptr; ulong blob_length= _mi_calc_blob_length(field_length, start_pos); - memcpy_fixed((char*) &pos, start_pos+field_length,sizeof(char*)); + memcpy(&pos, start_pos+field_length, sizeof(char*)); end_pos=pos+blob_length; tot_blob_length+=blob_length; set_if_bigger(count->max_length,blob_length); @@ -1889,7 +1889,7 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees) i->tree->tree_pack_length+j->tree->tree_pack_length+ ALLOWED_JOIN_DIFF) { - memcpy_fixed((uchar*) i->counts,(uchar*) count.counts, + memcpy(i->counts, count.counts, sizeof(count.counts[0])*256); my_free(j->tree->element_buffer); j->tree->element_buffer=0; @@ -2040,7 +2040,7 @@ static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees, uchar *buff= (uchar*) file_buffer.pos; bzero(buff,HEAD_LENGTH); - memcpy_fixed(buff,myisam_pack_file_magic,4); + memcpy(buff,myisam_pack_file_magic,4); int4store(buff+4,head_length); int4store(buff+8, mrg->min_pack_length); int4store(buff+12,mrg->max_pack_length); @@ -2697,8 +2697,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) DBUG_PRINT("fields", ("FIELD_BLOB %lu bytes, bits: %2u", blob_length, count->length_bits)); write_bits(blob_length,count->length_bits); - memcpy_fixed(&blob,end_pos-portable_sizeof_char_ptr, - sizeof(char*)); + memcpy(&blob, end_pos-portable_sizeof_char_ptr, sizeof(char*)); blob_end=blob+blob_length; /* Encode the blob bytes. */ for ( ; blob < blob_end ; blob++) diff --git a/storage/myisam/rt_test.c b/storage/myisam/rt_test.c index 4a9b61605d9..7233300c539 100644 --- a/storage/myisam/rt_test.c +++ b/storage/myisam/rt_test.c @@ -366,25 +366,6 @@ static int read_with_pos (MI_INFO * file,int silent) } -#ifdef NOT_USED -static void bprint_record(char * record, - my_off_t offs __attribute__((unused)), - const char * tail) -{ - int i; - char * pos; - i=(unsigned char)record[0]; - printf("%02X ",i); - - for( pos=record+1, i=0; i<32; i++,pos++){ - int b=(unsigned char)*pos; - printf("%02X",b); - } - printf("%s",tail); -} -#endif - - static void print_record(uchar * record, my_off_t offs __attribute__((unused)), const char * tail) @@ -424,30 +405,6 @@ static void create_record1(uchar *record,uint rownr) } } -#ifdef NOT_USED - -static void create_record0(uchar *record,uint rownr) -{ - int i; - char * pos; - double c=rownr+10; - double c0=0; - - bzero((char*) record,MAX_REC_LENGTH); - record[0]=0x01; /* DEL marker */ - - for ( pos=record+1, i=0; i<ndims; i++) - { - memcpy(pos,&c0,sizeof(c0)); - float8store(pos,c0); - pos+=sizeof(c0); - memcpy(pos,&c,sizeof(c)); - float8store(pos,c); - pos+=sizeof(c); - } -} - -#endif static void create_record(uchar *record,uint rownr) { diff --git a/storage/myisam/sp_key.c b/storage/myisam/sp_key.c index 3748a38ff81..bde0e1cb388 100644 --- a/storage/myisam/sp_key.c +++ b/storage/myisam/sp_key.c @@ -47,7 +47,7 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, pos = (uchar*)record + keyseg->start; dlen = _mi_calc_blob_length(keyseg->bit_start, pos); - memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*)); + memcpy(&dptr, pos + keyseg->bit_start, sizeof(char*)); if (!dptr) { my_errno= HA_ERR_NULL_IN_SPATIAL; diff --git a/storage/myisam/sp_test.c b/storage/myisam/sp_test.c index 069f43c320d..d86fdc03908 100644 --- a/storage/myisam/sp_test.c +++ b/storage/myisam/sp_test.c @@ -299,26 +299,6 @@ static int read_with_pos (MI_INFO * file,int silent) } -#ifdef NOT_USED -static void bprint_record(uchar * record, - my_off_t offs __attribute__((unused)), - const char * tail) -{ - int i; - char * pos; - i=(unsigned char)record[0]; - printf("%02X ",i); - - for( pos=record+1, i=0; i<32; i++,pos++) - { - int b=(unsigned char)*pos; - printf("%02X",b); - } - printf("%s",tail); -} -#endif - - static void print_record(uchar * record, my_off_t offs,const char * tail) { uchar *pos; @@ -330,7 +310,7 @@ static void print_record(uchar * record, my_off_t offs,const char * tail) len=sint4korr(pos); pos+=4; printf(" len=%d ",len); - memcpy_fixed(&ptr,pos,sizeof(char*)); + memcpy(&ptr, pos, sizeof(char*)); if (ptr) rtree_PrintWKB((uchar*) ptr,SPDIMS); else @@ -340,34 +320,6 @@ static void print_record(uchar * record, my_off_t offs,const char * tail) } -#ifdef NOT_USED -static void create_point(uchar *record,uint rownr) -{ - uint tmp; - char *ptr; - char *pos=record; - double x[200]; - int i; - - for(i=0;i<SPDIMS;i++) - x[i]=rownr; - - bzero((char*) record,MAX_REC_LENGTH); - *pos=0x01; /* DEL marker */ - pos++; - - memset(blob_key,0,sizeof(blob_key)); - tmp=rtree_CreatePointWKB(x,SPDIMS,blob_key); - - int4store(pos,tmp); - pos+=4; - - ptr=blob_key; - memcpy_fixed(pos,&ptr,sizeof(char*)); -} -#endif - - static void create_linestring(uchar *record,uint rownr) { uint tmp; @@ -376,23 +328,23 @@ static void create_linestring(uchar *record,uint rownr) double x[200]; int i,j; int npoints=2; - + for(j=0;j<npoints;j++) for(i=0;i<SPDIMS;i++) x[i+j*SPDIMS]=rownr*j; - + bzero((char*) record,MAX_REC_LENGTH); *pos=0x01; /* DEL marker */ pos++; - + memset(blob_key,0,sizeof(blob_key)); tmp=rtree_CreateLineStringWKB(x,SPDIMS,npoints, (uchar*) blob_key); - + int4store(pos,tmp); pos+=4; - + ptr=blob_key; - memcpy_fixed(pos,&ptr,sizeof(char*)); + memcpy(pos, &ptr, sizeof(char*)); } @@ -401,7 +353,7 @@ static void create_key(uchar *key,uint rownr) double c=rownr; uchar *pos; uint i; - + bzero(key,MAX_REC_LENGTH); for (pos=key, i=0; i<2*SPDIMS; i++) { @@ -426,27 +378,6 @@ static void print_key(const uchar *key,const char * tail) } -#ifdef NOT_USED - -static int rtree_CreatePointWKB(double *ords, uint n_dims, uchar *wkb) -{ - uint i; - - *wkb = wkbXDR; - ++wkb; - int4store(wkb, wkbPoint); - wkb += 4; - - for (i=0; i < n_dims; ++i) - { - float8store(wkb, ords[i]); - wkb += 8; - } - return 5 + n_dims * 8; -} -#endif - - static int rtree_CreateLineStringWKB(double *ords, uint n_dims, uint n_points, uchar *wkb) { diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index bac8cb7a0b7..eb43e141f27 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -643,7 +643,7 @@ extern "C" MI_INFO *myisammrg_attach_children_callback(void *callback_param) my_errno= HA_ERR_WRONG_MRG_TABLE_DEF; } DBUG_PRINT("myrg", ("MyISAM handle: 0x%lx my_errno: %d", - my_errno ? NULL : (long) myisam, my_errno)); + my_errno ? 0L : (long) myisam, my_errno)); end: DBUG_RETURN(myisam); diff --git a/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp b/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp index 8126267f946..95dbf5204f1 100644 --- a/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp +++ b/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp @@ -203,7 +203,7 @@ Uint32 FsOpenReq::getVersion(const Uint32 fileNumber[]){ inline void FsOpenReq::setVersion(Uint32 fileNumber[], Uint8 val){ const Uint32 t = fileNumber[3]; - fileNumber[3] = t & 0x00FFFFFF | (((Uint32)val) << 24); + fileNumber[3] = (t & 0x00FFFFFF) | (((Uint32)val) << 24); } inline @@ -214,7 +214,7 @@ Uint32 FsOpenReq::getSuffix(const Uint32 fileNumber[]){ inline void FsOpenReq::setSuffix(Uint32 fileNumber[], Uint8 val){ const Uint32 t = fileNumber[3]; - fileNumber[3] = t & 0xFF00FFFF | (((Uint32)val) << 16); + fileNumber[3] = (t & 0xFF00FFFF) | (((Uint32)val) << 16); } inline @@ -225,7 +225,7 @@ Uint32 FsOpenReq::v1_getDisk(const Uint32 fileNumber[]){ inline void FsOpenReq::v1_setDisk(Uint32 fileNumber[], Uint8 val){ const Uint32 t = fileNumber[3]; - fileNumber[3] = t & 0xFFFF00FF | (((Uint32)val) << 8); + fileNumber[3] = (t & 0xFFFF00FF) | (((Uint32)val) << 8); } inline @@ -266,7 +266,7 @@ Uint32 FsOpenReq::v1_getP(const Uint32 fileNumber[]){ inline void FsOpenReq::v1_setP(Uint32 fileNumber[], Uint8 val){ const Uint32 t = fileNumber[3]; - fileNumber[3] = t & 0xFFFFFF00 | val; + fileNumber[3] = (t & 0xFFFFFF00) | val; } /****************/ diff --git a/storage/ndb/include/util/ndb_opts.h b/storage/ndb/include/util/ndb_opts.h index f18bb9646cc..59d9eaf4d33 100644 --- a/storage/ndb/include/util/ndb_opts.h +++ b/storage/ndb/include/util/ndb_opts.h @@ -58,40 +58,40 @@ const char *opt_debug= 0; "Set connect string for connecting to ndb_mgmd. " \ "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \ "Overrides specifying entries in NDB_CONNECTSTRING and my.cnf", \ - (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \ + &opt_ndb_connectstring, &opt_ndb_connectstring, \ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ { "ndb-mgmd-host", OPT_NDB_MGMD, \ "Set host and port for connecting to ndb_mgmd. " \ "Syntax: <hostname>[:<port>].", \ - (uchar**) &opt_ndb_mgmd, (uchar**) &opt_ndb_mgmd, 0, \ + &opt_ndb_mgmd, &opt_ndb_mgmd, 0, \ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ { "ndb-nodeid", OPT_NDB_NODEID, \ "Set node id for this node.", \ - (uchar**) &opt_ndb_nodeid, (uchar**) &opt_ndb_nodeid, 0, \ + &opt_ndb_nodeid, &opt_ndb_nodeid, 0, \ GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ { "ndb-shm", OPT_NDB_SHM,\ "Allow optimizing using shared memory connections when available",\ - (uchar**) &opt_ndb_shm, (uchar**) &opt_ndb_shm, 0,\ + &opt_ndb_shm, &opt_ndb_shm, 0,\ GET_BOOL, NO_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0 },\ {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,\ "Select nodes for transactions in a more optimal way",\ - (uchar**) &opt_ndb_optimized_node_selection,\ - (uchar**) &opt_ndb_optimized_node_selection, 0,\ + &opt_ndb_optimized_node_selection,\ + &opt_ndb_optimized_node_selection, 0,\ GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\ { "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\ - (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \ + &opt_ndb_connectstring, &opt_ndb_connectstring, \ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ { "core-file", OPT_WANT_CORE, "Write core on errors.",\ - (uchar**) &opt_core, (uchar**) &opt_core, 0,\ + &opt_core, &opt_core, 0,\ GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0},\ {"character-sets-dir", OPT_CHARSETS_DIR,\ - "Directory where character sets are.", (uchar**) &charsets_dir,\ - (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\ + "Directory where character sets are.", &charsets_dir,\ + &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\ #ifndef DBUG_OFF #define NDB_STD_OPTS(prog_name) \ { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \ - (uchar**) &opt_debug, (uchar**) &opt_debug, \ + &opt_debug, &opt_debug, \ 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \ NDB_STD_OPTS_COMMON #else diff --git a/storage/ndb/src/cw/cpcd/main.cpp b/storage/ndb/src/cw/cpcd/main.cpp index d5c31d610cb..b750c00bc2a 100644 --- a/storage/ndb/src/cw/cpcd/main.cpp +++ b/storage/ndb/src/cw/cpcd/main.cpp @@ -39,22 +39,22 @@ static const char *user = 0; static struct my_option my_long_options[] = { { "work-dir", 'w', "Work directory", - (uchar**) &work_dir, (uchar**) &work_dir, 0, + &work_dir, &work_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "port", 'p', "TCP port to listen on", - (uchar**) &port, (uchar**) &port, 0, + &port, &port, 0, GET_INT, REQUIRED_ARG, CPCD_DEFAULT_TCP_PORT, 0, 0, 0, 0, 0 }, { "syslog", 'S', "Log events to syslog", - (uchar**) &use_syslog, (uchar**) &use_syslog, 0, + &use_syslog, &use_syslog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "logfile", 'L', "File to log events to", - (uchar**) &logfile, (uchar**) &logfile, 0, + &logfile, &logfile, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "debug", 'D', "Enable debug mode", - (uchar**) &debug, (uchar**) &debug, 0, + &debug, &debug, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "user", 'u', "Run as user", - (uchar**) &user, (uchar**) &user, 0, + &user, &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp index 67ce7a1760a..3917d415575 100644 --- a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp +++ b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp @@ -840,13 +840,13 @@ Dbtux::TreeEnt::cmp(const TreeEnt ent) const */ const unsigned version_wrap_limit = (1 << (ZTUP_VERSION_BITS - 1)); if (m_tupVersion < ent.m_tupVersion) { - if (ent.m_tupVersion - m_tupVersion < version_wrap_limit) + if (unsigned(ent.m_tupVersion - m_tupVersion) < version_wrap_limit) return -1; else return +1; } if (m_tupVersion > ent.m_tupVersion) { - if (m_tupVersion - ent.m_tupVersion < version_wrap_limit) + if (unsigned(m_tupVersion - ent.m_tupVersion) < version_wrap_limit) return +1; else return -1; diff --git a/storage/ndb/src/kernel/vm/Configuration.cpp b/storage/ndb/src/kernel/vm/Configuration.cpp index 72770d35cde..f1e608738e3 100644 --- a/storage/ndb/src/kernel/vm/Configuration.cpp +++ b/storage/ndb/src/kernel/vm/Configuration.cpp @@ -74,35 +74,35 @@ static struct my_option my_long_options[] = { "initial", OPT_INITIAL, "Perform initial start of ndbd, including cleaning the file system. " "Consult documentation before using this", - (uchar**) &_initial, (uchar**) &_initial, 0, + &_initial, &_initial, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "nostart", 'n', "Don't start ndbd immediately. Ndbd will await command from ndb_mgmd", - (uchar**) &_no_start, (uchar**) &_no_start, 0, + &_no_start, &_no_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "daemon", 'd', "Start ndbd as daemon (default)", - (uchar**) &_daemon, (uchar**) &_daemon, 0, + &_daemon, &_daemon, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, { "nodaemon", OPT_NODAEMON, "Do not start ndbd as daemon, provided for testing purposes", - (uchar**) &_no_daemon, (uchar**) &_no_daemon, 0, + &_no_daemon, &_no_daemon, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "foreground", OPT_FOREGROUND, "Run real ndbd in foreground, provided for debugging purposes" " (implies --nodaemon)", - (uchar**) &_foreground, (uchar**) &_foreground, 0, + &_foreground, &_foreground, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "nowait-nodes", OPT_NOWAIT_NODES, "Nodes that will not be waited for during start", - (uchar**) &_nowait_nodes, (uchar**) &_nowait_nodes, 0, + &_nowait_nodes, &_nowait_nodes, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "initial-start", OPT_INITIAL_START, "Perform initial start", - (uchar**) &_initialstart, (uchar**) &_initialstart, 0, + &_initialstart, &_initialstart, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "bind-address", OPT_NOWAIT_NODES, "Local bind address", - (uchar**) &_bind_address, (uchar**) &_bind_address, 0, + &_bind_address, &_bind_address, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp index 980530953ad..7049bdd12e0 100644 --- a/storage/ndb/src/mgmclient/main.cpp +++ b/storage/ndb/src/mgmclient/main.cpp @@ -73,11 +73,11 @@ static struct my_option my_long_options[] = NDB_STD_OPTS("ndb_mgm"), { "execute", 'e', "execute command and exit", - (uchar**) &opt_execute_str, (uchar**) &opt_execute_str, 0, + &opt_execute_str, &opt_execute_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "try-reconnect", 't', "Specify number of tries for connecting to ndb_mgmd (0 = infinite)", - (uchar**) &_try_reconnect, (uchar**) &_try_reconnect, 0, + &_try_reconnect, &_try_reconnect, 0, GET_UINT, REQUIRED_ARG, 3, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp index 26198a44a23..e0d9a550cd2 100644 --- a/storage/ndb/src/mgmsrv/main.cpp +++ b/storage/ndb/src/mgmsrv/main.cpp @@ -142,29 +142,29 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_mgmd"), { "config-file", 'f', "Specify cluster configuration file", - (uchar**) &opt_config_filename, (uchar**) &opt_config_filename, 0, + &opt_config_filename, &opt_config_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "print-full-config", 'P', "Print full config and exit", - (uchar**) &g_print_full_config, (uchar**) &g_print_full_config, 0, + &g_print_full_config, &g_print_full_config, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "daemon", 'd', "Run ndb_mgmd in daemon mode (default)", - (uchar**) &opt_daemon, (uchar**) &opt_daemon, 0, + &opt_daemon, &opt_daemon, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, { "interactive", OPT_INTERACTIVE, "Run interactive. Not supported but provided for testing purposes", - (uchar**) &opt_interactive, (uchar**) &opt_interactive, 0, + &opt_interactive, &opt_interactive, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-nodeid-checks", OPT_NO_NODEID_CHECKS, "Do not provide any node id checks", - (uchar**) &g_no_nodeid_checks, (uchar**) &g_no_nodeid_checks, 0, + &g_no_nodeid_checks, &g_no_nodeid_checks, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "nodaemon", OPT_NO_DAEMON, "Don't run as daemon, but don't read from stdin", - (uchar**) &opt_non_interactive, (uchar**) &opt_non_interactive, 0, + &opt_non_interactive, &opt_non_interactive, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "mycnf", 256, "Read cluster config from my.cnf", - (uchar**) &opt_mycnf, (uchar**) &opt_mycnf, 0, + &opt_mycnf, &opt_mycnf, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/src/ndbapi/TransporterFacade.hpp b/storage/ndb/src/ndbapi/TransporterFacade.hpp index 23fea8792f7..cbda9de6df1 100644 --- a/storage/ndb/src/ndbapi/TransporterFacade.hpp +++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp @@ -366,8 +366,8 @@ bool TransporterFacade::get_node_stopping(NodeId n) const { const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n); return (!node.m_state.getSingleUserMode() && - (node.m_state.startLevel == NodeState::SL_STOPPING_1) || - (node.m_state.startLevel == NodeState::SL_STOPPING_2)); + ((node.m_state.startLevel == NodeState::SL_STOPPING_1) || + (node.m_state.startLevel == NodeState::SL_STOPPING_2))); } inline diff --git a/storage/ndb/test/ndbapi/testIndexStat.cpp b/storage/ndb/test/ndbapi/testIndexStat.cpp index 559fade3132..3b3e593081b 100644 --- a/storage/ndb/test/ndbapi/testIndexStat.cpp +++ b/storage/ndb/test/ndbapi/testIndexStat.cpp @@ -1297,43 +1297,43 @@ my_long_options[] = { NDB_STD_OPTS("testIndexStat"), { "loglevel", 1001, "Logging level in this program 0-3 (default 0)", - (uchar **)&g_opts.loglevel, (uchar **)&g_opts.loglevel, 0, + &g_opts.loglevel, &g_opts.loglevel, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "seed", 1002, "Random seed (0=loop number, default -1=random)", - (uchar **)&g_opts.seed, (uchar **)&g_opts.seed, 0, + &g_opts.seed, &g_opts.seed, 0, GET_INT, REQUIRED_ARG, -1, 0, 0, 0, 0, 0 }, { "loop", 1003, "Number of test loops (default 1, 0=forever)", - (uchar **)&g_opts.loop, (uchar **)&g_opts.loop, 0, + &g_opts.loop, &g_opts.loop, 0, GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 }, { "rows", 1004, "Number of rows (default 100000)", - (uchar **)&g_opts.rows, (uchar **)&g_opts.rows, 0, + &g_opts.rows, &g_opts.rows, 0, GET_UINT, REQUIRED_ARG, 100000, 0, 0, 0, 0, 0 }, { "ops", 1005, "Number of index scans per loop (default 1000)", - (uchar **)&g_opts.ops, (uchar **)&g_opts.ops, 0, + &g_opts.ops, &g_opts.ops, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 }, { "dupkeys", 1006, "Pct records per key (min 100, default 1000)", - (uchar **)&g_opts.dupkeys, (uchar **)&g_opts.dupkeys, 0, + &g_opts.dupkeys, &g_opts.dupkeys, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 }, { "scanpct", 1007, "Preferred max pct of total rows per scan (default 5)", - (uchar **)&g_opts.scanpct, (uchar **)&g_opts.scanpct, 0, + &g_opts.scanpct, &g_opts.scanpct, 0, GET_UINT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 }, { "nullkeys", 1008, "Pct nulls in each key attribute (default 10)", - (uchar **)&g_opts.nullkeys, (uchar **)&g_opts.nullkeys, 0, + &g_opts.nullkeys, &g_opts.nullkeys, 0, GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 }, { "eqscans", 1009, "Pct scans for partial/full equality (default 50)", - (uchar **)&g_opts.eqscans, (uchar **)&g_opts.eqscans, 0, + &g_opts.eqscans, &g_opts.eqscans, 0, GET_UINT, REQUIRED_ARG, 50, 0, 0, 0, 0, 0 }, { "dupscans", 1010, "Pct scans using same bounds (default 10)", - (uchar **)&g_opts.dupscans, (uchar **)&g_opts.dupscans, 0, + &g_opts.dupscans, &g_opts.dupscans, 0, GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 }, { "keeptable", 1011, "Use existing table and data if any and do not drop", - (uchar **)&g_opts.keeptable, (uchar **)&g_opts.keeptable, 0, + &g_opts.keeptable, &g_opts.keeptable, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-extra-checks", 1012, "Omit expensive consistency checks", - (uchar **)&g_opts.nochecks, (uchar **)&g_opts.nochecks, 0, + &g_opts.nochecks, &g_opts.nochecks, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "abort-on-error", 1013, "Dump core on any error", - (uchar **)&g_opts.abort, (uchar **)&g_opts.abort, 0, + &g_opts.abort, &g_opts.abort, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, diff --git a/storage/ndb/test/ndbapi/test_event_merge.cpp b/storage/ndb/test/ndbapi/test_event_merge.cpp index d40b985adc2..c4109a23119 100644 --- a/storage/ndb/test/ndbapi/test_event_merge.cpp +++ b/storage/ndb/test/ndbapi/test_event_merge.cpp @@ -2184,57 +2184,57 @@ my_long_options[] = { NDB_STD_OPTS("test_event_merge"), { "abort-on-error", 1001, "Do abort() on any error", - (uchar **)&g_opts.abort_on_error, (uchar **)&g_opts.abort_on_error, 0, + &g_opts.abort_on_error, &g_opts.abort_on_error, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "loglevel", 1002, "Logging level in this program 0-3 (default 0)", - (uchar **)&g_opts.loglevel, (uchar **)&g_opts.loglevel, 0, + &g_opts.loglevel, &g_opts.loglevel, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "loop", 1003, "Number of test loops (default 5, 0=forever)", - (uchar **)&g_opts.loop, (uchar **)&g_opts.loop, 0, + &g_opts.loop, &g_opts.loop, 0, GET_INT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 }, { "maxops", 1004, "Approx number of PK operations per table (default 1000)", - (uchar **)&g_opts.maxops, (uchar **)&g_opts.maxops, 0, + &g_opts.maxops, &g_opts.maxops, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 }, { "maxpk", 1005, "Number of different PK values (default 10, max 1000)", - (uchar **)&g_opts.maxpk, (uchar **)&g_opts.maxpk, 0, + &g_opts.maxpk, &g_opts.maxpk, 0, GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 }, { "maxtab", 1006, "Number of tables (default 10, max 100)", - (uchar **)&g_opts.maxtab, (uchar **)&g_opts.maxtab, 0, + &g_opts.maxtab, &g_opts.maxtab, 0, GET_INT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 }, { "no-blobs", 1007, "Omit blob attributes (5.0: true)", - (uchar **)&g_opts.no_blobs, (uchar **)&g_opts.no_blobs, 0, + &g_opts.no_blobs, &g_opts.no_blobs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-implicit-nulls", 1008, "Insert must include all attrs" " i.e. no implicit NULLs", - (uchar **)&g_opts.no_implicit_nulls, (uchar **)&g_opts.no_implicit_nulls, 0, + &g_opts.no_implicit_nulls, &g_opts.no_implicit_nulls, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-missing-update", 1009, "Update must include all non-PK attrs", - (uchar **)&g_opts.no_missing_update, (uchar **)&g_opts.no_missing_update, 0, + &g_opts.no_missing_update, &g_opts.no_missing_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-multiops", 1010, "Allow only 1 operation per commit", - (uchar **)&g_opts.no_multiops, (uchar **)&g_opts.no_multiops, 0, + &g_opts.no_multiops, &g_opts.no_multiops, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-nulls", 1011, "Create no NULL values", - (uchar **)&g_opts.no_nulls, (uchar **)&g_opts.no_nulls, 0, + &g_opts.no_nulls, &g_opts.no_nulls, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "one-blob", 1012, "Only one blob attribute (default 2)", - (uchar **)&g_opts.one_blob, (uchar **)&g_opts.one_blob, 0, + &g_opts.one_blob, &g_opts.one_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "opstring", 1013, "Operations to run e.g. idiucdc (c is commit) or" " iuuc:uudc (the : separates loops)", - (uchar **)&g_opts.opstring, (uchar **)&g_opts.opstring, 0, + &g_opts.opstring, &g_opts.opstring, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "seed", 1014, "Random seed (0=loop number, default -1=random)", - (uchar **)&g_opts.seed, (uchar **)&g_opts.seed, 0, + &g_opts.seed, &g_opts.seed, 0, GET_INT, REQUIRED_ARG, -1, 0, 0, 0, 0, 0 }, { "separate-events", 1015, "Do not combine events per GCI (5.0: true)", - (uchar **)&g_opts.separate_events, (uchar **)&g_opts.separate_events, 0, + &g_opts.separate_events, &g_opts.separate_events, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "tweak", 1016, "Whatever the source says", - (uchar **)&g_opts.tweak, (uchar **)&g_opts.tweak, 0, + &g_opts.tweak, &g_opts.tweak, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "use-table", 1017, "Use existing tables", - (uchar **)&g_opts.use_table, (uchar **)&g_opts.use_table, 0, + &g_opts.use_table, &g_opts.use_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, diff --git a/storage/ndb/test/ndbapi/test_event_multi_table.cpp b/storage/ndb/test/ndbapi/test_event_multi_table.cpp index 36fb6f511ae..7fbd43ef5eb 100644 --- a/storage/ndb/test/ndbapi/test_event_multi_table.cpp +++ b/storage/ndb/test/ndbapi/test_event_multi_table.cpp @@ -258,7 +258,7 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS(""), { "database", 'd', "Name of database table is in", - (gptr*) &_dbname, (gptr*) &_dbname, 0, + &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/test/run-test/main.cpp b/storage/ndb/test/run-test/main.cpp index b5c4385f5d3..397eaf8b77e 100644 --- a/storage/ndb/test/run-test/main.cpp +++ b/storage/ndb/test/run-test/main.cpp @@ -77,60 +77,60 @@ my_bool opt_core; static struct my_option g_options[] = { { "help", '?', "Display this help and exit.", - (uchar **) &g_help, (uchar **) &g_help, + &g_help, &g_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "clusters", 256, "Cluster", - (uchar **) &g_clusters, (uchar **) &g_clusters, + &g_clusters, &g_clusters, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "replicate", 1024, "replicate", - (uchar **) &g_dummy, (uchar **) &g_dummy, + &g_dummy, &g_dummy, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "log-file", 256, "log-file", - (uchar **) &g_log_filename, (uchar **) &g_log_filename, + &g_log_filename, &g_log_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "testcase-file", 'f', "testcase-file", - (uchar **) &g_test_case_filename, (uchar **) &g_test_case_filename, + &g_test_case_filename, &g_test_case_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "report-file", 'r', "report-file", - (uchar **) &g_report_filename, (uchar **) &g_report_filename, + &g_report_filename, &g_report_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "basedir", 256, "Base path", - (uchar **) &g_basedir, (uchar **) &g_basedir, + &g_basedir, &g_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "baseport", 256, "Base port", - (uchar **) &g_baseport, (uchar **) &g_baseport, + &g_baseport, &g_baseport, 0, GET_INT, REQUIRED_ARG, g_baseport, 0, 0, 0, 0, 0}, { "prefix", 256, "mysql install dir", - (uchar **) &g_prefix, (uchar **) &g_prefix, + &g_prefix, &g_prefix, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "verbose", 'v', "Verbosity", - (uchar **) &g_verbosity, (uchar **) &g_verbosity, + &g_verbosity, &g_verbosity, 0, GET_INT, REQUIRED_ARG, g_verbosity, 0, 0, 0, 0, 0}, { "configure", 256, "configure", - (uchar **) &g_do_setup, (uchar **) &g_do_setup, + &g_do_setup, &g_do_setup, 0, GET_INT, REQUIRED_ARG, g_do_setup, 0, 0, 0, 0, 0 }, { "deploy", 256, "deploy", - (uchar **) &g_do_deploy, (uchar **) &g_do_deploy, + &g_do_deploy, &g_do_deploy, 0, GET_INT, REQUIRED_ARG, g_do_deploy, 0, 0, 0, 0, 0 }, { "sshx", 256, "sshx", - (uchar **) &g_do_sshx, (uchar **) &g_do_sshx, + &g_do_sshx, &g_do_sshx, 0, GET_INT, REQUIRED_ARG, g_do_sshx, 0, 0, 0, 0, 0 }, { "start", 256, "start", - (uchar **) &g_do_start, (uchar **) &g_do_start, + &g_do_start, &g_do_start, 0, GET_INT, REQUIRED_ARG, g_do_start, 0, 0, 0, 0, 0 }, { "fqpn", 256, "Fully qualified path-names ", - (uchar **) &g_fqpn, (uchar **) &g_fqpn, + &g_fqpn, &g_fqpn, 0, GET_INT, REQUIRED_ARG, g_fqpn, 0, 0, 0, 0, 0 }, { "default-ports", 256, "Use default ports when possible", - (uchar **) &g_default_ports, (uchar **) &g_default_ports, + &g_default_ports, &g_default_ports, 0, GET_INT, REQUIRED_ARG, g_default_ports, 0, 0, 0, 0, 0 }, { "mode", 256, "Mode 0=interactive 1=regression 2=bench", - (uchar **) &g_mode, (uchar **) &g_mode, + &g_mode, &g_mode, 0, GET_INT, REQUIRED_ARG, g_mode, 0, 0, 0, 0, 0 }, { "quit", 256, "Quit before starting tests", - (uchar **) &g_mode, (uchar **) &g_do_quit, + &g_mode, &g_do_quit, 0, GET_BOOL, NO_ARG, g_do_quit, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/test/src/NDBT_Test.cpp b/storage/ndb/test/src/NDBT_Test.cpp index 69f3723ca75..b7b830af23d 100644 --- a/storage/ndb/test/src/NDBT_Test.cpp +++ b/storage/ndb/test/src/NDBT_Test.cpp @@ -1195,35 +1195,35 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS(""), { "print", OPT_PRINT, "Print execution tree", - (uchar **) &opt_print, (uchar **) &opt_print, 0, + &opt_print, &opt_print, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_html", OPT_PRINT_HTML, "Print execution tree in html table format", - (uchar **) &opt_print_html, (uchar **) &opt_print_html, 0, + &opt_print_html, &opt_print_html, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_cases", OPT_PRINT_CASES, "Print list of test cases", - (uchar **) &opt_print_cases, (uchar **) &opt_print_cases, 0, + &opt_print_cases, &opt_print_cases, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "records", 'r', "Number of records", - (uchar **) &opt_records, (uchar **) &opt_records, 0, + &opt_records, &opt_records, 0, GET_INT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 }, { "loops", 'l', "Number of loops", - (uchar **) &opt_loops, (uchar **) &opt_loops, 0, + &opt_loops, &opt_loops, 0, GET_INT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 }, { "seed", 1024, "Random seed", - (uchar **) &opt_seed, (uchar **) &opt_seed, 0, + &opt_seed, &opt_seed, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "testname", 'n', "Name of test to run", - (uchar **) &opt_testname, (uchar **) &opt_testname, 0, + &opt_testname, &opt_testname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "remote_mgm", 'm', "host:port to mgmsrv of remote cluster", - (uchar **) &opt_remote_mgm, (uchar **) &opt_remote_mgm, 0, + &opt_remote_mgm, &opt_remote_mgm, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "timer", 't', "Print execution time", - (uchar **) &opt_timer, (uchar **) &opt_timer, 0, + &opt_timer, &opt_timer, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "verbose", 'v', "Print verbose status", - (uchar **) &opt_verbose, (uchar **) &opt_verbose, 0, + &opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/test/tools/connect.cpp b/storage/ndb/test/tools/connect.cpp index 278dbe833ea..d12d1b7a608 100644 --- a/storage/ndb/test/tools/connect.cpp +++ b/storage/ndb/test/tools/connect.cpp @@ -31,14 +31,14 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "loop", 'l', "loops", - (gptr*) &_loop, (gptr*) &_loop, 0, + &_loop, &_loop, 0, GET_INT, REQUIRED_ARG, _loop, 0, 0, 0, 0, 0 }, { "sleep", 's', "Sleep (ms) between connection attempt", - (gptr*) &_sleep, (gptr*) &_sleep, 0, + &_sleep, &_sleep, 0, GET_INT, REQUIRED_ARG, _sleep, 0, 0, 0, 0, 0 }, { "drop", 'd', "Drop event operations before disconnect (0 = no, 1 = yes, else rand", - (gptr*) &_drop, (gptr*) &_drop, 0, + &_drop, &_drop, 0, GET_INT, REQUIRED_ARG, _drop, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/delete_all.cpp b/storage/ndb/tools/delete_all.cpp index 1bf89f5a32f..23d1ef387d2 100644 --- a/storage/ndb/tools/delete_all.cpp +++ b/storage/ndb/tools/delete_all.cpp @@ -36,16 +36,16 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (uchar**) &_dbname, (uchar**) &_dbname, 0, + &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "transactional", 't', "Single transaction (may run out of operations)", - (uchar**) &_transactional, (uchar**) &_transactional, 0, + &_transactional, &_transactional, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "tupscan", 999, "Run tupscan", - (uchar**) &_tupscan, (uchar**) &_tupscan, 0, + &_tupscan, &_tupscan, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "diskscan", 999, "Run diskcan", - (uchar**) &_diskscan, (uchar**) &_diskscan, 0, + &_diskscan, &_diskscan, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/desc.cpp b/storage/ndb/tools/desc.cpp index 831005139de..f31b4f6ae1b 100644 --- a/storage/ndb/tools/desc.cpp +++ b/storage/ndb/tools/desc.cpp @@ -39,16 +39,16 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (uchar**) &_dbname, (uchar**) &_dbname, 0, + &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "unqualified", 'u', "Use unqualified table names", - (uchar**) &_unqualified, (uchar**) &_unqualified, 0, + &_unqualified, &_unqualified, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "extra-partition-info", 'p', "Print more info per partition", - (uchar**) &_partinfo, (uchar**) &_partinfo, 0, + &_partinfo, &_partinfo, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "retries", 'r', "Retry every second for # retries", - (uchar**) &_retries, (uchar**) &_retries, 0, + &_retries, &_retries, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/drop_index.cpp b/storage/ndb/tools/drop_index.cpp index ec88f331a80..82dd595f7df 100644 --- a/storage/ndb/tools/drop_index.cpp +++ b/storage/ndb/tools/drop_index.cpp @@ -30,7 +30,7 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (uchar**) &_dbname, (uchar**) &_dbname, 0, + &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/drop_tab.cpp b/storage/ndb/tools/drop_tab.cpp index 8d07afbbf50..1fba31b5c8a 100644 --- a/storage/ndb/tools/drop_tab.cpp +++ b/storage/ndb/tools/drop_tab.cpp @@ -30,7 +30,7 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (uchar**) &_dbname, (uchar**) &_dbname, 0, + &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/listTables.cpp b/storage/ndb/tools/listTables.cpp index 45129cb34af..bd70587f77e 100644 --- a/storage/ndb/tools/listTables.cpp +++ b/storage/ndb/tools/listTables.cpp @@ -256,22 +256,22 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_show_tables"), { "database", 'd', "Name of database table is in", - (uchar**) &_dbname, (uchar**) &_dbname, 0, + &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "loops", 'l', "loops", - (uchar**) &_loops, (uchar**) &_loops, 0, + &_loops, &_loops, 0, GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 }, { "type", 't', "type", - (uchar**) &_type, (uchar**) &_type, 0, + &_type, &_type, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "unqualified", 'u', "Use unqualified table names", - (uchar**) &_unqualified, (uchar**) &_unqualified, 0, + &_unqualified, &_unqualified, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "parsable", 'p', "Return output suitable for mysql LOAD DATA INFILE", - (uchar**) &_parsable, (uchar**) &_parsable, 0, + &_parsable, &_parsable, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "show-temp-status", OPT_SHOW_TMP_STATUS, "Show table temporary flag", - (uchar**) &show_temp_status, (uchar**) &show_temp_status, 0, + &show_temp_status, &show_temp_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/ndb_config.cpp b/storage/ndb/tools/ndb_config.cpp index af36103f947..0df88dc0167 100644 --- a/storage/ndb/tools/ndb_config.cpp +++ b/storage/ndb/tools/ndb_config.cpp @@ -58,37 +58,37 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_config"), { "nodes", 256, "Print nodes", - (uchar**) &g_nodes, (uchar**) &g_nodes, + &g_nodes, &g_nodes, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "connections", 256, "Print connections", - (uchar**) &g_connections, (uchar**) &g_connections, + &g_connections, &g_connections, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "query", 'q', "Query option(s)", - (uchar**) &g_query, (uchar**) &g_query, + &g_query, &g_query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "host", 256, "Host", - (uchar**) &g_host, (uchar**) &g_host, + &g_host, &g_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "type", 258, "Type of node/connection", - (uchar**) &g_type, (uchar**) &g_type, + &g_type, &g_type, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "id", 258, "Nodeid", - (uchar**) &g_nodeid, (uchar**) &g_nodeid, + &g_nodeid, &g_nodeid, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "nodeid", 258, "Nodeid", - (uchar**) &g_nodeid, (uchar**) &g_nodeid, + &g_nodeid, &g_nodeid, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "fields", 'f', "Field separator", - (uchar**) &g_field_delimiter, (uchar**) &g_field_delimiter, + &g_field_delimiter, &g_field_delimiter, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "rows", 'r', "Row separator", - (uchar**) &g_row_delimiter, (uchar**) &g_row_delimiter, + &g_row_delimiter, &g_row_delimiter, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "config-file", 256, "Path to config.ini", - (uchar**) &g_config_file, (uchar**) &g_config_file, + &g_config_file, &g_config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "mycnf", 256, "Read config from my.cnf", - (uchar**) &g_mycnf, (uchar**) &g_mycnf, + &g_mycnf, &g_mycnf, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp index 7db77524ad8..966c539cee9 100644 --- a/storage/ndb/tools/restore/restore_main.cpp +++ b/storage/ndb/tools/restore/restore_main.cpp @@ -100,99 +100,99 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_restore"), { "connect", 'c', "same as --connect-string", - (uchar**) &opt_connect_str, (uchar**) &opt_connect_str, 0, + &opt_connect_str, &opt_connect_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "nodeid", 'n', "Backup files from node with id", - (uchar**) &ga_nodeId, (uchar**) &ga_nodeId, 0, + &ga_nodeId, &ga_nodeId, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "backupid", 'b', "Backup id", - (uchar**) &ga_backupId, (uchar**) &ga_backupId, 0, + &ga_backupId, &ga_backupId, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "restore_data", 'r', "Restore table data/logs into NDB Cluster using NDBAPI", - (uchar**) &_restore_data, (uchar**) &_restore_data, 0, + &_restore_data, &_restore_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "restore_meta", 'm', "Restore meta data into NDB Cluster using NDBAPI", - (uchar**) &_restore_meta, (uchar**) &_restore_meta, 0, + &_restore_meta, &_restore_meta, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-upgrade", 'u', "Don't upgrade array type for var attributes, which don't resize VAR data and don't change column attributes", - (uchar**) &ga_no_upgrade, (uchar**) &ga_no_upgrade, 0, + &ga_no_upgrade, &ga_no_upgrade, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-restore-disk-objects", 'd', "Dont restore disk objects (tablespace/logfilegroups etc)", - (uchar**) &_no_restore_disk, (uchar**) &_no_restore_disk, 0, + &_no_restore_disk, &_no_restore_disk, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "restore_epoch", 'e', "Restore epoch info into the status table. Convenient on a MySQL Cluster " "replication slave, for starting replication. The row in " NDB_REP_DB "." NDB_APPLY_TABLE " with id 0 will be updated/inserted.", - (uchar**) &ga_restore_epoch, (uchar**) &ga_restore_epoch, 0, + &ga_restore_epoch, &ga_restore_epoch, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "skip-table-check", 's', "Skip table structure check during restore of data", - (uchar**) &ga_skip_table_check, (uchar**) &ga_skip_table_check, 0, + &ga_skip_table_check, &ga_skip_table_check, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "parallelism", 'p', "No of parallel transactions during restore of data." "(parallelism can be 1 to 1024)", - (uchar**) &ga_nParallelism, (uchar**) &ga_nParallelism, 0, + &ga_nParallelism, &ga_nParallelism, 0, GET_INT, REQUIRED_ARG, 128, 1, 1024, 0, 1, 0 }, { "print", OPT_PRINT, "Print metadata, data and log to stdout", - (uchar**) &_print, (uchar**) &_print, 0, + &_print, &_print, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_data", OPT_PRINT_DATA, "Print data to stdout", - (uchar**) &_print_data, (uchar**) &_print_data, 0, + &_print_data, &_print_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_meta", OPT_PRINT_META, "Print meta data to stdout", - (uchar**) &_print_meta, (uchar**) &_print_meta, 0, + &_print_meta, &_print_meta, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "print_log", OPT_PRINT_LOG, "Print log to stdout", - (uchar**) &_print_log, (uchar**) &_print_log, 0, + &_print_log, &_print_log, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "backup_path", OPT_BACKUP_PATH, "Path to backup files", - (uchar**) &ga_backupPath, (uchar**) &ga_backupPath, 0, + &ga_backupPath, &ga_backupPath, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "dont_ignore_systab_0", 'f', "Experimental. Do not ignore system table during restore.", - (uchar**) &ga_dont_ignore_systab_0, (uchar**) &ga_dont_ignore_systab_0, 0, + &ga_dont_ignore_systab_0, &ga_dont_ignore_systab_0, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "ndb-nodegroup-map", OPT_NDB_NODEGROUP_MAP, "Nodegroup map for ndbcluster. Syntax: list of (source_ng, dest_ng)", - (uchar**) &opt_nodegroup_map_str, - (uchar**) &opt_nodegroup_map_str, + &opt_nodegroup_map_str, + &opt_nodegroup_map_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "fields-enclosed-by", OPT_FIELDS_ENCLOSED_BY, "Fields are enclosed by ...", - (uchar**) &opt_fields_enclosed_by, (uchar**) &opt_fields_enclosed_by, 0, + &opt_fields_enclosed_by, &opt_fields_enclosed_by, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "fields-terminated-by", OPT_FIELDS_TERMINATED_BY, "Fields are terminated by ...", - (uchar**) &opt_fields_terminated_by, - (uchar**) &opt_fields_terminated_by, 0, + &opt_fields_terminated_by, + &opt_fields_terminated_by, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "fields-optionally-enclosed-by", OPT_FIELDS_OPTIONALLY_ENCLOSED_BY, "Fields are optionally enclosed by ...", - (uchar**) &opt_fields_optionally_enclosed_by, - (uchar**) &opt_fields_optionally_enclosed_by, 0, + &opt_fields_optionally_enclosed_by, + &opt_fields_optionally_enclosed_by, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "hex", OPT_HEX_FORMAT, "print binary types in hex format", - (uchar**) &opt_hex_format, (uchar**) &opt_hex_format, 0, + &opt_hex_format, &opt_hex_format, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "tab", 'T', "Creates tab separated textfile for each table to " "given path. (creates .txt files)", - (uchar**) &tab_path, (uchar**) &tab_path, 0, + &tab_path, &tab_path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "append", OPT_APPEND, "for --tab append data to file", - (uchar**) &opt_append, (uchar**) &opt_append, 0, + &opt_append, &opt_append, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "lines-terminated-by", OPT_LINES_TERMINATED_BY, "", - (uchar**) &opt_lines_terminated_by, (uchar**) &opt_lines_terminated_by, 0, + &opt_lines_terminated_by, &opt_lines_terminated_by, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "verbose", OPT_VERBOSE, "verbosity", - (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0, + &opt_verbose, &opt_verbose, 0, GET_INT, REQUIRED_ARG, 1, 0, 255, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/select_all.cpp b/storage/ndb/tools/select_all.cpp index 23d5f95f3f7..95dfeab9eed 100644 --- a/storage/ndb/tools/select_all.cpp +++ b/storage/ndb/tools/select_all.cpp @@ -54,43 +54,43 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (uchar**) &_dbname, (uchar**) &_dbname, 0, + &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "parallelism", 'p', "parallelism", - (uchar**) &_parallelism, (uchar**) &_parallelism, 0, + &_parallelism, &_parallelism, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)", - (uchar**) &_lock, (uchar**) &_lock, 0, + &_lock, &_lock, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "order", 'o', "Sort resultset according to index", - (uchar**) &_order, (uchar**) &_order, 0, + &_order, &_order, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "descending", 'z', "Sort descending (requires order flag)", - (uchar**) &_descending, (uchar**) &_descending, 0, + &_descending, &_descending, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "header", 'h', "Print header", - (uchar**) &_header, (uchar**) &_header, 0, + &_header, &_header, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, { "useHexFormat", 'x', "Output numbers in hexadecimal format", - (uchar**) &_useHexFormat, (uchar**) &_useHexFormat, 0, + &_useHexFormat, &_useHexFormat, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "delimiter", 'D', "Column delimiter", - (uchar**) &_delimiter, (uchar**) &_delimiter, 0, + &_delimiter, &_delimiter, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "disk", 256, "Dump disk ref", - (uchar**) &_dumpDisk, (uchar**) &_dumpDisk, 0, + &_dumpDisk, &_dumpDisk, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "rowid", 256, "Dump rowid", - (uchar**) &use_rowid, (uchar**) &use_rowid, 0, + &use_rowid, &use_rowid, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "gci", 256, "Dump gci", - (uchar**) &use_gci, (uchar**) &use_gci, 0, + &use_gci, &use_gci, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "tupscan", 't', "Scan in tup order", - (uchar**) &_tup, (uchar**) &_tup, 0, + &_tup, &_tup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "nodata", 256, "Dont print data", - (uchar**) &nodata, (uchar**) &nodata, 0, + &nodata, &nodata, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/select_count.cpp b/storage/ndb/tools/select_count.cpp index 73982e886b5..6bdc682c16a 100644 --- a/storage/ndb/tools/select_count.cpp +++ b/storage/ndb/tools/select_count.cpp @@ -43,13 +43,13 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", - (uchar**) &_dbname, (uchar**) &_dbname, 0, + &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "parallelism", 'p', "parallelism", - (uchar**) &_parallelism, (uchar**) &_parallelism, 0, + &_parallelism, &_parallelism, 0, GET_INT, REQUIRED_ARG, 240, 0, 0, 0, 0, 0 }, { "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)", - (uchar**) &_lock, (uchar**) &_lock, 0, + &_lock, &_lock, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/ndb/tools/waiter.cpp b/storage/ndb/tools/waiter.cpp index fc2a4b368b1..26c86e6d196 100644 --- a/storage/ndb/tools/waiter.cpp +++ b/storage/ndb/tools/waiter.cpp @@ -44,17 +44,17 @@ static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "no-contact", 'n', "Wait for cluster no contact", - (uchar**) &_no_contact, (uchar**) &_no_contact, 0, + &_no_contact, &_no_contact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started", - (uchar**) &_not_started, (uchar**) &_not_started, 0, + &_not_started, &_not_started, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "single-user", OPT_WAIT_STATUS_SINGLE_USER, "Wait for cluster to enter single user mode", - (uchar**) &_single_user, (uchar**) &_single_user, 0, + &_single_user, &_single_user, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "timeout", 't', "Timeout to wait in seconds", - (uchar**) &_timeout, (uchar**) &_timeout, 0, + &_timeout, &_timeout, 0, GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc index aae8f9dc8c1..e32a77512cc 100644 --- a/storage/perfschema/pfs_events_waits.cc +++ b/storage/perfschema/pfs_events_waits.cc @@ -39,7 +39,6 @@ bool flag_events_waits_summary_by_thread_by_event_name= true; bool flag_events_waits_summary_by_event_name= true; /** Consumer flag for table EVENTS_WAITS_SUMMARY_BY_INSTANCE. */ bool flag_events_waits_summary_by_instance= true; -bool flag_events_locks_summary_by_thread_by_event_name= true; bool flag_events_locks_summary_by_event_name= true; bool flag_events_locks_summary_by_instance= true; /** Consumer flag for table FILE_SUMMARY_BY_EVENT_NAME. */ @@ -96,9 +95,8 @@ static void copy_events_waits(PFS_events_waits *dest, /* Signal readers they are about to read garbage ... */ dest->m_wait_class= NO_WAIT_CLASS; /* ... that this can generate. */ - memcpy_fixed(dest_body, - source_body, - sizeof(PFS_events_waits) - sizeof(events_waits_class)); + memcpy(dest_body, source_body, + sizeof(PFS_events_waits) - sizeof(events_waits_class)); /* Signal readers the record is now clean again. */ dest->m_wait_class= source->m_wait_class; } diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index abc03302b64..e1e14f20218 100644 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -15,15 +15,19 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) -SET(STRINGS_SOURCES bchange.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c +SET(STRINGS_SOURCES bchange.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c dtoa.c int2str.c - is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c r_strinstr.c + is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c str2int.c str_alloc.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c - strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c xml.c - my_strchr.c strcont.c strinstr.c strnlen.c strappend.c) + strxmov.c strxnmov.c xml.c + my_strchr.c strcont.c strappend.c) +IF(NOT HAVE_STRNLEN) + # OSX does not have strnlen + SET(STRINGS_SOURCES ${STRINGS_SOURCES} strnlen.c) +ENDIF() # Avoid dependencies on perschema data defined in mysys ADD_DEFINITIONS(-DDISABLE_MYSQL_THREAD_H) ADD_CONVENIENCE_LIBRARY(strings ${STRINGS_SOURCES}) diff --git a/strings/Makefile.am b/strings/Makefile.am index fd884a1296a..3a051e38899 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -30,20 +30,13 @@ pkglib_LIBRARIES = libmystrings.a # Exact one of ASSEMBLER_X if ASSEMBLER_x86 ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s -CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c dtoa.c strmov.c -else -if ASSEMBLER_sparc32 -# These file MUST all be on the same line!! Otherwise automake -# generats a very broken makefile -ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s -CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c strmov.c +CSRCS = bfill.c bmove.c bchange.c strxnmov.c int2str.c str2int.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c str_alloc.c longlong2str_asm.c my_strchr.c dtoa.c strmov.c else #no assembler ASRCS = # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile -CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c -endif +CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bchange.c strxnmov.c int2str.c str2int.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c str_alloc.c my_strchr.c dtoa.c endif libmystrings_a_SOURCES = $(ASRCS) $(CSRCS) @@ -57,11 +50,8 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc longlong2str.c longlong2str-x86.s longlong2str_asm.c \ my_strtoll10.c my_strtoll10-x86.s \ strxmov.c bmove_upp.c strappend.c strcont.c strend.c \ - strfill.c strcend.c is_prefix.c strstr.c strinstr.c \ + strfill.c strcend.c is_prefix.c strstr.c \ strmake.c strnmov.c strmov.c strnlen.c \ - bmove_upp-sparc.s strappend-sparc.s strend-sparc.s \ - strinstr-sparc.s strmake-sparc.s strmov-sparc.s \ - strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \ t_ctype.h my_strchr.c CMakeLists.txt \ CHARSET_INFO.txt diff --git a/strings/bfill.c b/strings/bfill.c index 2750553f48a..ccc063f59e3 100644 --- a/strings/bfill.c +++ b/strings/bfill.c @@ -23,10 +23,6 @@ bfill(dst, len, fill) moves "len" fill characters to "dst". Thus to set a buffer to 80 spaces, do bfill(buff, 80, ' '). - - Note: the "b" routines are there to exploit certain VAX order codes, - but the MOVC5 instruction will only move 65535 characters. The asm - code is presented for your interest and amusement. */ #include <my_global.h> @@ -34,58 +30,6 @@ #if !defined(bfill) && !defined(HAVE_BFILL) -#if VaxAsm - -void bfill(dst, len, fill) -char *dst; -uint len; -int fill; /* actually char */ -{ - asm("movc5 $0,*4(ap),12(ap),8(ap),*4(ap)"); -} - -#elif defined(MC68000) && defined(DS90) - -void bfill(dst, len,fill) /* Optimized with long-fill */ -char *dst; -uint len; -pchar fill; -{ -asm(" movl 8.(a7),d1 "); -asm(" jeq .L9 "); -asm(" movl 4.(a7),a0 "); -asm(" moveq #0,d0 "); -asm(" movb 15.(a7),d0 "); -asm(" movl d2,a1 "); -asm(" movw d0,d2 "); -asm(" aslw #8,d0 "); -asm(" orw d2,d0 "); -asm(" movl d0,d2 "); -asm(" swap d0 "); -asm(" orl d2,d0 "); -asm(" movl a0,d2 "); -asm(" btst #0,d2 "); -asm(" jeq .L1 "); -asm(" movb d0,(a0)+ "); -asm(" subql #1,d1 "); -asm(".L1: movl d1,d2 "); -asm(" lsrl #2,d2 "); -asm(" jcc .L2 "); -asm(" movw d0,(a0)+ "); -asm(" jra .L2 "); -asm(".L3: movl d0,(a0)+ "); -asm(".L2: dbra d2,.L3 "); -asm(" addqw #1,d2 "); -asm(" subql #1,d2 "); -asm(" jcc .L3 "); -asm(" andl #1,d1 "); -asm(" jeq .L8 "); -asm(" movb d0,(a0) "); -asm(".L8: movl a1,d2 "); -asm(".L9: rts "); -} -#else - void bfill(dst, len, fill) register byte *dst; register uint len; @@ -95,4 +39,3 @@ register pchar fill; } #endif -#endif diff --git a/strings/bmove.c b/strings/bmove.c index ae9641a5d58..0aa825558ca 100644 --- a/strings/bmove.c +++ b/strings/bmove.c @@ -30,10 +30,6 @@ has its first two arguments the other way around you may find this a bit easier to get right. No value is returned. - - Note: the "b" routines are there to exploit certain VAX order codes, - but the MOVC3 instruction will only move 65535 characters. The asm - code is presented for your interest and amusement. */ #include <my_global.h> @@ -41,33 +37,6 @@ #if !defined(HAVE_BMOVE) && !defined(bmove) -#if VaxAsm - -void bmove(dst, src, len) - char *dst, *src; - uint len; - { - asm("movc3 12(ap),*8(ap),*4(ap)"); - } - -#else -#if defined(MC68000) && defined(DS90) - -void bmove(dst, src, len) -char *dst,*src; -uint len; /* 0 <= len <= 65535 */ -{ -asm(" movl 12(a7),d0 "); -asm(" subql #1,d0 "); -asm(" blt .L5 "); -asm(" movl 4(a7),a1 "); -asm(" movl 8(a7),a0 "); -asm(".L4: movb (a0)+,(a1)+ "); -asm(" dbf d0,.L4 "); -asm(".L5: "); -} -#else - void bmove(dst, src, len) register char *dst; register const char *src; @@ -75,6 +44,5 @@ register uint len; { while (len-- != 0) *dst++ = *src++; } -#endif -#endif + #endif diff --git a/strings/bmove512.c b/strings/bmove512.c deleted file mode 100644 index c3f0446ead6..00000000000 --- a/strings/bmove512.c +++ /dev/null @@ -1,125 +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 */ - -/* File : bmove512.c - Author : Michael Widenius; - Defines: bmove512() - - bmove512(dst, src, len) moves exactly "len" bytes from the source "src" - to the destination "dst". "src" and "dst" must be alligned on long - boundory and len must be a mutliple of 512 byte. If len is not a - multiple of 512 byte len/512*512+1 bytes is copyed. - bmove512 is moustly used to copy IO_BLOCKS. bmove512 should be the - fastest way to move a mutiple of 512 byte. -*/ - -#include <my_global.h> -#include "m_string.h" - -#ifndef bmove512 - -#ifdef HAVE_LONG_LONG -#define LONG ulonglong -#else -#define LONG ulonglong -#endif - -void bmove512(uchar *to, const uchar *from, register size_t length) -{ - reg1 LONG *f,*t,*end= (LONG*) ((char*) from+length); - - f= (LONG*) from; - t= (LONG*) to; - -#if defined(m88k) || defined(sparc) || defined(HAVE_LONG_LONG) - do { - t[0]=f[0]; t[1]=f[1]; t[2]=f[2]; t[3]=f[3]; - t[4]=f[4]; t[5]=f[5]; t[6]=f[6]; t[7]=f[7]; - t[8]=f[8]; t[9]=f[9]; t[10]=f[10]; t[11]=f[11]; - t[12]=f[12]; t[13]=f[13]; t[14]=f[14]; t[15]=f[15]; - t[16]=f[16]; t[17]=f[17]; t[18]=f[18]; t[19]=f[19]; - t[20]=f[20]; t[21]=f[21]; t[22]=f[22]; t[23]=f[23]; - t[24]=f[24]; t[25]=f[25]; t[26]=f[26]; t[27]=f[27]; - t[28]=f[28]; t[29]=f[29]; t[30]=f[30]; t[31]=f[31]; - t[32]=f[32]; t[33]=f[33]; t[34]=f[34]; t[35]=f[35]; - t[36]=f[36]; t[37]=f[37]; t[38]=f[38]; t[39]=f[39]; - t[40]=f[40]; t[41]=f[41]; t[42]=f[42]; t[43]=f[43]; - t[44]=f[44]; t[45]=f[45]; t[46]=f[46]; t[47]=f[47]; - t[48]=f[48]; t[49]=f[49]; t[50]=f[50]; t[51]=f[51]; - t[52]=f[52]; t[53]=f[53]; t[54]=f[54]; t[55]=f[55]; - t[56]=f[56]; t[57]=f[57]; t[58]=f[58]; t[59]=f[59]; - t[60]=f[60]; t[61]=f[61]; t[62]=f[62]; t[63]=f[63]; -#ifdef HAVE_LONG_LONG - t+=64; f+=64; -#else - t[64]=f[64]; t[65]=f[65]; t[66]=f[66]; t[67]=f[67]; - t[68]=f[68]; t[69]=f[69]; t[70]=f[70]; t[71]=f[71]; - t[72]=f[72]; t[73]=f[73]; t[74]=f[74]; t[75]=f[75]; - t[76]=f[76]; t[77]=f[77]; t[78]=f[78]; t[79]=f[79]; - t[80]=f[80]; t[81]=f[81]; t[82]=f[82]; t[83]=f[83]; - t[84]=f[84]; t[85]=f[85]; t[86]=f[86]; t[87]=f[87]; - t[88]=f[88]; t[89]=f[89]; t[90]=f[90]; t[91]=f[91]; - t[92]=f[92]; t[93]=f[93]; t[94]=f[94]; t[95]=f[95]; - t[96]=f[96]; t[97]=f[97]; t[98]=f[98]; t[99]=f[99]; - t[100]=f[100]; t[101]=f[101]; t[102]=f[102]; t[103]=f[103]; - t[104]=f[104]; t[105]=f[105]; t[106]=f[106]; t[107]=f[107]; - t[108]=f[108]; t[109]=f[109]; t[110]=f[110]; t[111]=f[111]; - t[112]=f[112]; t[113]=f[113]; t[114]=f[114]; t[115]=f[115]; - t[116]=f[116]; t[117]=f[117]; t[118]=f[118]; t[119]=f[119]; - t[120]=f[120]; t[121]=f[121]; t[122]=f[122]; t[123]=f[123]; - t[124]=f[124]; t[125]=f[125]; t[126]=f[126]; t[127]=f[127]; - t+=128; f+=128; -#endif - } while (f < end); -#else - do { - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; - } while (f < end); -#endif - return; -} /* bmove512 */ - -#endif /* bmove512 */ diff --git a/strings/bmove_upp-sparc.s b/strings/bmove_upp-sparc.s deleted file mode 100644 index f745f0fc613..00000000000 --- a/strings/bmove_upp-sparc.s +++ /dev/null @@ -1,40 +0,0 @@ -! Copyright (C) 2000, 2002 MySQL AB -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Library General Public -! License as published by the Free Software Foundation; version 2 -! of the License. -! -! This library 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 -! Library General Public License for more details. -! -! You should have received a copy of the GNU Library General Public -! License along with this library; if not, write to the Free -! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA - - .file "bmove_upp-sparc.s" -.section ".text" - .align 4 - .global bmove_upp - .type bmove_upp,#function - .proc 020 -bmove_upp: - subcc %o2, 1, %o2 ! o2= len - bcs .end - nop -.loop: - sub %o1, 1, %o1 - ldub [%o1], %o3 - sub %o0, 1, %o0 - subcc %o2, 1, %o2 - bcc .loop - stb %o3, [%o0] -.end: - retl - nop -.bmove_upp_end: - .size bmove_upp,.bmove_upp_end-bmove_upp - .ident "Matt Wagner & Monty" diff --git a/strings/bmove_upp.c b/strings/bmove_upp.c index fb47bda2d1d..05e786837f4 100644 --- a/strings/bmove_upp.c +++ b/strings/bmove_upp.c @@ -25,26 +25,8 @@ #include <my_global.h> #include "m_string.h" -#if defined(MC68000) && defined(DS90) - -/* 0 <= len <= 65535 */ -void bmove_upp(byte *dst, const byte *src,uint len) -{ -asm(" movl 12(a7),d0 "); -asm(" subql #1,d0 "); -asm(" blt .L5 "); -asm(" movl 4(a7),a1 "); -asm(" movl 8(a7),a0 "); -asm(".L4: movb -(a0),-(a1) "); -asm(" dbf d0,.L4 "); -asm(".L5: "); -} -#else - void bmove_upp(register uchar *dst, register const uchar *src, register size_t len) { while (len-- != 0) *--dst = *--src; } - -#endif diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 8a3d3d7425c..2e5f78a30bf 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -335,10 +335,6 @@ long my_strntol_8bit(CHARSET_INFO *cs, int overflow; *err= 0; /* Initialize error indicator */ -#ifdef NOT_USED - if (base < 0 || base == 1 || base > 36) - base = 10; -#endif s = nptr; e = nptr+l; @@ -364,29 +360,6 @@ long my_strntol_8bit(CHARSET_INFO *cs, else negative = 0; -#ifdef NOT_USED - if (base == 16 && s[0] == '0' && (s[1]=='X' || s[1]=='x')) - s += 2; -#endif - -#ifdef NOT_USED - if (base == 0) - { - if (*s == '0') - { - if (s[1]=='X' || s[1]=='x') - { - s += 2; - base = 16; - } - else - base = 8; - } - else - base = 10; - } -#endif - save = s; cutoff = ((uint32)~0L) / (uint32) base; cutlim = (uint) (((uint32)~0L) % (uint32) base); @@ -458,10 +431,6 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, int overflow; *err= 0; /* Initialize error indicator */ -#ifdef NOT_USED - if (base < 0 || base == 1 || base > 36) - base = 10; -#endif s = nptr; e = nptr+l; @@ -486,29 +455,6 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, else negative = 0; -#ifdef NOT_USED - if (base == 16 && s[0] == '0' && (s[1]=='X' || s[1]=='x')) - s += 2; -#endif - -#ifdef NOT_USED - if (base == 0) - { - if (*s == '0') - { - if (s[1]=='X' || s[1]=='x') - { - s += 2; - base = 16; - } - else - base = 8; - } - else - base = 10; - } -#endif - save = s; cutoff = ((uint32)~0L) / (uint32) base; cutlim = (uint) (((uint32)~0L) % (uint32) base); @@ -571,10 +517,6 @@ longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)), int overflow; *err= 0; /* Initialize error indicator */ -#ifdef NOT_USED - if (base < 0 || base == 1 || base > 36) - base = 10; -#endif s = nptr; e = nptr+l; @@ -599,29 +541,6 @@ longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)), else negative = 0; -#ifdef NOT_USED - if (base == 16 && s[0] == '0' && (s[1]=='X'|| s[1]=='x')) - s += 2; -#endif - -#ifdef NOT_USED - if (base == 0) - { - if (*s == '0') - { - if (s[1]=='X' || s[1]=='x') - { - s += 2; - base = 16; - } - else - base = 8; - } - else - base = 10; - } -#endif - save = s; cutoff = (~(ulonglong) 0) / (unsigned long int) base; @@ -694,10 +613,6 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs, int overflow; *err= 0; /* Initialize error indicator */ -#ifdef NOT_USED - if (base < 0 || base == 1 || base > 36) - base = 10; -#endif s = nptr; e = nptr+l; @@ -722,29 +637,6 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs, else negative = 0; -#ifdef NOT_USED - if (base == 16 && s[0] == '0' && (s[1]=='X' || s[1]=='x')) - s += 2; -#endif - -#ifdef NOT_USED - if (base == 0) - { - if (*s == '0') - { - if (s[1]=='X' || s[1]=='x') - { - s += 2; - base = 16; - } - else - base = 8; - } - else - base = 10; - } -#endif - save = s; cutoff = (~(ulonglong) 0) / (unsigned long int) base; diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 3946f6a83b4..d3b0b93a939 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -134,11 +134,6 @@ my_strntol_mb2_or_mb4(CHARSET_INFO *cs, bs: -#ifdef NOT_USED - if (base <= 0 || base == 1 || base > 36) - base = 10; -#endif - overflow= 0; res= 0; save= s; @@ -250,11 +245,6 @@ my_strntoul_mb2_or_mb4(CHARSET_INFO *cs, bs: -#ifdef NOT_USED - if (base <= 0 || base == 1 || base > 36) - base = 10; -#endif - overflow= 0; res= 0; save= s; @@ -359,11 +349,6 @@ my_strntoll_mb2_or_mb4(CHARSET_INFO *cs, bs: -#ifdef NOT_USED - if (base <= 0 || base == 1 || base > 36) - base = 10; -#endif - overflow = 0; res = 0; save = s; @@ -474,11 +459,6 @@ my_strntoull_mb2_or_mb4(CHARSET_INFO *cs, } while (1); bs: - -#ifdef NOT_USED - if (base <= 0 || base == 1 || base > 36) - base = 10; -#endif overflow = 0; res = 0; diff --git a/strings/do_ctype.c b/strings/do_ctype.c index d038d313a98..f87d55b6251 100644 --- a/strings/do_ctype.c +++ b/strings/do_ctype.c @@ -140,7 +140,7 @@ void init_case_convert() to_upper[i]= sort_order[i]= to_lower[i]= (char) i; #endif -#if defined(HPUX10) && ASCII_BITS_USED == 8 +#if defined(HPUX10) higher_pos= (uchar *) "\xd0\xd8\xda\xdb\xdc\xd3"; lower_pos= (uchar *) "\xd4\xcc\xce\xdf\xc9\xd7"; #else @@ -166,7 +166,7 @@ void init_case_convert() /* sets upp sortorder; higer_pos character (upper and lower) is */ /* changed to lower_pos character */ -#if defined(HPUX10) && ASCII_BITS_USED == 8 +#if defined(HPUX10) higher_pos= lower_pos= (uchar *) ""; /* Tecknen i r{tt ordning */ #else #ifdef USE_ISO_8859_1 /* As in USG5 ICL-386 */ diff --git a/strings/r_strinstr.c b/strings/r_strinstr.c deleted file mode 100644 index fb1e0c5a090..00000000000 --- a/strings/r_strinstr.c +++ /dev/null @@ -1,50 +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 */ - -/* - Author : David - strintstr(src, from, pat) looks for an instance of pat in src - backwards from pos from. pat is not a regex(3) pattern, it is a literal - string which must be matched exactly. - The result 0 if the pattern was not found else it is the start char of - the pattern counted from the begining of the string. -*/ - -#include <my_global.h> -#include "m_string.h" - -size_t r_strinstr(reg1 const char * str, size_t from, reg4 const char * search) -{ - reg2 const char *i, *j; - size_t len = strlen(search); - /* pointer to the last char of buff */ - const char * start = str + from - 1; - /* pointer to the last char of search */ - const char * search_end = search + len - 1; - - skip: - while (start >= str) /* Cant be != because the first char */ - { - if (*start-- == *search_end) - { - i = start; j = search_end - 1; - while (j >= search && start > str) - if (*i-- != *j--) - goto skip; - return (size_t) ((start - len) - str + 3); - } - } - return (0); -} diff --git a/strings/str_test.c b/strings/str_test.c index 0814647472c..7e304fbd10a 100644 --- a/strings/str_test.c +++ b/strings/str_test.c @@ -73,8 +73,6 @@ int main(void) test_arg("strstr(v1,v5)",(long) strstr(v1,v5),0L); test_arg("strstr(v6,v8)",(long) strstr(v6,v8),0L); - test_arg("strinstr(v1,v4)",(long) strinstr(v1,v4),4L); - test_arg("strinstr(v1,v5)",(long) strinstr(v1,v5),0L); test_arg("strlen(from)",(long) strlen(from),(long) F_LEN); test_arg("strlen(\"\")",(long) strlen(""),0L); #ifdef HAVE_STRNLEN diff --git a/strings/strappend-sparc.s b/strings/strappend-sparc.s deleted file mode 100644 index d5add816eb0..00000000000 --- a/strings/strappend-sparc.s +++ /dev/null @@ -1,49 +0,0 @@ -! Copyright (C) 2000, 2002 MySQL AB -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Library General Public -! License as published by the Free Software Foundation; version 2 -! of the License. -! -! This library 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 -! Library General Public License for more details. -! -! You should have received a copy of the GNU Library General Public -! License along with this library; if not, write to the Free -! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA - - .file "strappend-sparc.s" -.section ".text" - .align 4 - .global strappend - .type strappend,#function - .proc 020 -strappend: - add %o0, %o1, %o3 ! o3 = endpos - ldsb [%o0], %o4 -.loop1: - add %o0, 1, %o0 ! find end of str - cmp %o4, 0 - bne,a .loop1 - ldsb [%o0], %o4 - - sub %o0, 1, %o0 - cmp %o0, %o3 - bgeu .end - nop - - stb %o2, [%o0] -.loop2: - add %o0, 1, %o0 - cmp %o0, %o3 - blu,a .loop2 - stb %o2, [%o0] -.end: - retl - stb %g0, [%o3] -.strappend_end: - .size strappend,.strappend_end-strappend - .ident "Matt Wagner & Monty" diff --git a/strings/strcend.c b/strings/strcend.c index 56e31d5f994..e08ad2b1e75 100644 --- a/strings/strcend.c +++ b/strings/strcend.c @@ -25,23 +25,6 @@ #include <my_global.h> #include "m_string.h" -#if defined(MC68000) && defined(DS90) - -char *strcend(const char *s, pchar c) -{ -asm(" movl 4(a7),a0 "); -asm(" movl 8(a7),d1 "); -asm(".L2: movb (a0)+,d0 "); -asm(" cmpb d0,d1 "); -asm(" beq .L1 "); -asm(" tstb d0 "); -asm(" bne .L2 "); -asm(".L1: movl a0,d0 "); -asm(" subql #1,d0 "); -} - -#else - char *strcend(register const char *s, register pchar c) { for (;;) @@ -51,4 +34,3 @@ char *strcend(register const char *s, register pchar c) } } -#endif diff --git a/strings/strend-sparc.s b/strings/strend-sparc.s deleted file mode 100644 index f264fcef32f..00000000000 --- a/strings/strend-sparc.s +++ /dev/null @@ -1,35 +0,0 @@ -! Copyright (C) 2000, 2002 MySQL AB -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Library General Public -! License as published by the Free Software Foundation; version 2 -! of the License. -! -! This library 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 -! Library General Public License for more details. -! -! You should have received a copy of the GNU Library General Public -! License along with this library; if not, write to the Free -! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA - - .file "strend-sparc.s" -.section ".text" - .align 4 - .global strend - .type strend,#function - .proc 0102 -strend: - ldsb [%o0], %o3 ! Handle first char differently to make -.loop: ! a faster loop - add %o0, 1, %o0 - cmp %o3, 0 - bne,a .loop - ldsb [%o0], %o3 - retl - sub %o0,1,%o0 -.strend_end: - .size strend,.strend_end-strend - .ident "Matt Wagner & Monty" diff --git a/strings/strend.c b/strings/strend.c index 4dadf0675dc..d70a5d648d5 100644 --- a/strings/strend.c +++ b/strings/strend.c @@ -24,27 +24,14 @@ is, strend(s)-s == strlen(s). This is useful for adding things at the end of strings. It is redundant, because strchr(s,'\0') could be used instead, but this is clearer and faster. - Beware: the asm version works only if strlen(s) < 65535. */ #include <my_global.h> #include "m_string.h" -#if VaxAsm - -char *strend(s) -const char *s; -{ - asm("locc $0,$65535,*4(ap)"); - asm("movl r1,r0"); -} - -#else /* ~VaxAsm */ - char *strend(register const char *s) { while (*s++); return (char*) (s-1); } -#endif /* VaxAsm */ diff --git a/strings/string.doc b/strings/string.doc index 954f7226759..fcd020b8c60 100644 --- a/strings/string.doc +++ b/strings/string.doc @@ -77,11 +77,6 @@ Speciella användbara nya string-rutiner: The result is a pointer to the first character of the located instance, or NullS if pat does not occur in src. - strinstr(src, pat) looks for an instance of pat in src. pat is not a - regex(3) pattern, it is a literal string which must be matched exactly. - The result 0 if the pattern was not found else it is the start char of - the pattern counted from the begining of the string. - strmake(dst,src,length) moves length characters, or until end, of src to dst and appends a closing NUL to dst. strmake() returns pointer to closing null; diff --git a/strings/strings-not-used.h b/strings/strings-not-used.h deleted file mode 100644 index 8311545f22f..00000000000 --- a/strings/strings-not-used.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef STRINGS_NOT_USED_INCLUDED -#define STRINGS_NOT_USED_INCLUDED - -/* 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 */ - -/* File : strings.h - Author : Richard A. O'Keefe. - Updated: 1 June 1984 - Purpose: Header file for the "string(3C)" package. - - All the routines in this package are the original work of - R.A.O'Keefe. Any resemblance between them and any routines in - licensed software is due entirely to these routines having been - written using the "man 3 string" UNIX manual page, or in some cases - the "man 1 sort" manual page as a specification. See the READ-ME to - find the conditions under which these routines may be used & copied. -*/ - -#ifndef NullS - -#include <my_global.h> /* Define standar vars */ -#include "m_string.h" - -#define NUL '\0' -#define _AlphabetSize 256 - -#endif /* NullS */ -#endif /* STRINGS_NOT_USED_INCLUDED */ diff --git a/strings/strings-x86.s b/strings/strings-x86.s index db7bb0c1274..4872c566685 100644 --- a/strings/strings-x86.s +++ b/strings/strings-x86.s @@ -281,29 +281,6 @@ sf_fo: movl %edx,%eax # Char found here .strstr_end: .size strstr,.strstr_end-strstr - - # Find a substring in string, return index - # Arg: str,search - -.globl strinstr - .type strinstr,@function - -strinstr: - pushl %ebp - movl %esp,%ebp - pushl 12(%ebp) # search - pushl 8(%ebp) # str - call strstr - add $8,%esp - or %eax,%eax - jz si_99 # Not found, return NULL - sub 8(%ebp),%eax # Pos from start - inc %eax # And first pos = 1 -si_99: popl %ebp - ret -.strinstr_end: - .size strinstr,.strinstr_end-strinstr - # Make a string of len length from another string # Arg: dst,src,length # ret: end of dst diff --git a/strings/strinstr-sparc.s b/strings/strinstr-sparc.s deleted file mode 100644 index 5278aff6aa7..00000000000 --- a/strings/strinstr-sparc.s +++ /dev/null @@ -1,43 +0,0 @@ -! Copyright (C) 2000 MySQL AB -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Library General Public -! License as published by the Free Software Foundation; version 2 -! of the License. -! -! This library 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 -! Library General Public License for more details. -! -! You should have received a copy of the GNU Library General Public -! License along with this library; if not, write to the Free -! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA - - .file "strinstr-sparc.s" -.section ".text" - .align 4 - .global strinstr - .type strinstr,#function - .proc 0102 -strinstr: - save %sp,-96,%sp - or %g0,%i1,%o1 - call strstr,2 ! Result = %o0 - or %g0,%i0,%o0 - orcc %g0,%o0,%o0 - bne .end - sub %o0,%i0,%i0 - ret - restore %g0,%g0,%o0 -.end: - ret - restore %i0,1,%o0 ! Offset for return value is from 1 - -.strinstr_end: - .size strinstr,.strinstr_end-strinstr - .ident "Matt Wagner & Monty" - - - diff --git a/strings/strinstr.c b/strings/strinstr.c deleted file mode 100644 index dce498d61e8..00000000000 --- a/strings/strinstr.c +++ /dev/null @@ -1,48 +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 */ - -/* File : strinstr.c - Author : Monty & David - Updated: 1986.12.08 - Defines: strinstr() - - strinstr(src, pat) looks for an instance of pat in src. pat is not a - regex(3) pattern, it is a literal string which must be matched exactly. - The result 0 if the pattern was not found else it is the start char of - the pattern counted from the beginning of the string, where the first - char is 1. -*/ - -#include <my_global.h> -#include "m_string.h" - -size_t strinstr(reg1 const char *str,reg4 const char *search) -{ - reg2 const char *i, *j; - const char *start= str; - - skip: - while (*str != '\0') - { - if (*str++ == *search) - { - i= str; j= search+1; - while (*j) - if (*i++ != *j++) goto skip; - return ((size_t) (str - start)); - } - } - return (0); -} diff --git a/strings/strmake-sparc.s b/strings/strmake-sparc.s deleted file mode 100644 index 36db8efd402..00000000000 --- a/strings/strmake-sparc.s +++ /dev/null @@ -1,43 +0,0 @@ -! Copyright (C) 2000, 2002 MySQL AB -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Library General Public -! License as published by the Free Software Foundation; version 2 -! of the License. -! -! This library 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 -! Library General Public License for more details. -! -! You should have received a copy of the GNU Library General Public -! License along with this library; if not, write to the Free -! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA - - .file "strmake-sparc.s" -.section ".text" - .align 4 - .global strmake - .type strmake,#function - .proc 0102 -strmake: - orcc %g0,%o2,%g0 - be,a .end - nop - ldsb [%o1],%o3 -.loop: - stb %o3,[%o0] - cmp %o3,0 - be .end ! Jump to end on end of string - add %o1,1,%o1 - add %o0,1,%o0 - subcc %o2,1,%o2 - bne,a .loop - ldsb [%o1],%o3 -.end: - retl - stb %g0,[%o0] -.strmake_end: - .size strmake,.strmake_end-strmake - .ident "Matt Wagner & Monty" diff --git a/strings/strmov-sparc.s b/strings/strmov-sparc.s deleted file mode 100644 index f124da2dc9f..00000000000 --- a/strings/strmov-sparc.s +++ /dev/null @@ -1,36 +0,0 @@ -! Copyright (C) 2000, 2002 MySQL AB -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Library General Public -! License as published by the Free Software Foundation; version 2 -! of the License. -! -! This library 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 -! Library General Public License for more details. -! -! You should have received a copy of the GNU Library General Public -! License along with this library; if not, write to the Free -! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA - - .file "strmov-sparc.s" -.section ".text" - .align 4 - .global strmov - .type strmov,#function - .proc 0102 -strmov: -.loop: - ldub [%o1], %o3 - stb %o3, [%o0] - add %o1, 1, %o1 - cmp %o3, 0 - bne,a .loop - add %o0, 1, %o0 - retl - nop -.strmov_end: - .size strmov,.strmov_end-strmov - .ident "Matt Wagner" diff --git a/strings/strmov.c b/strings/strmov.c index eedf22a4ef1..4d4915d27a0 100644 --- a/strings/strmov.c +++ b/strings/strmov.c @@ -29,25 +29,9 @@ #define strmov strmov_overlapp #endif -#if !defined(MC68000) && !defined(DS90) - char *strmov(register char *dst, register const char *src) { while ((*dst++ = *src++)) ; return dst-1; } -#else - -char *strmov(dst, src) - char *dst, *src; -{ - asm(" movl 4(a7),a1 "); - asm(" movl 8(a7),a0 "); - asm(".L4: movb (a0)+,(a1)+ "); - asm(" jne .L4 "); - asm(" movl a1,d0 "); - asm(" subql #1,d0 "); -} - -#endif diff --git a/strings/strnmov-sparc.s b/strings/strnmov-sparc.s deleted file mode 100644 index df0c4bebf03..00000000000 --- a/strings/strnmov-sparc.s +++ /dev/null @@ -1,43 +0,0 @@ -! Copyright (C) 2000, 2002 MySQL AB -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Library General Public -! License as published by the Free Software Foundation; version 2 -! of the License. -! -! This library 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 -! Library General Public License for more details. -! -! You should have received a copy of the GNU Library General Public -! License along with this library; if not, write to the Free -! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA - - .file "strnmov-sparc.s" -.section ".text" - .align 4 - .global strnmov - .type strnmov,#function - .proc 0102 -strnmov: - orcc %g0,%o2,%g0 - be,a .end - nop - ldsb [%o1],%o3 -.loop: - stb %o3,[%o0] - cmp %o3,0 - be .end ! Jump to end on end of string - add %o1,1,%o1 - add %o0,1,%o0 - subcc %o2,1,%o2 - bne,a .loop - ldsb [%o1],%o3 -.end: - retl - nop -.strnmov_end: - .size strnmov,.strnmov_end-strnmov - .ident "Matt Wagner" diff --git a/strings/strstr-sparc.s b/strings/strstr-sparc.s deleted file mode 100644 index 2a6590c9c93..00000000000 --- a/strings/strstr-sparc.s +++ /dev/null @@ -1,72 +0,0 @@ -! Copyright (C) 2000, 2002 MySQL AB -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Library General Public -! License as published by the Free Software Foundation; version 2 -! of the License. -! -! This library 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 -! Library General Public License for more details. -! -! You should have received a copy of the GNU Library General Public -! License along with this library; if not, write to the Free -! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA - - .file "strstr-sparc.s" -.section ".text" - .align 4 - .global strstr - .type strstr,#function - .proc 0102 -strstr: - -!char *strstr(register const char *str,const char *search) -!{ -! register char *i,*j; -!skipp: -! while (*str != '\0') { -! if (*str++ == *search) { -! i=(char*) str; j=(char*) search+1; - - ldsb [%o1],%o2 ! o2= First char of search -.top: - ldsb [%o0],%o4 ! o4= First char of rest of str - cmp %o4,0 - be .abort ! Found end null ; - cmp %o4,%o2 - bne .top - add %o0,1,%o0 - -.outloop1: - -! while (*j) -! if (*i++ != *j++) goto skipp; - - or %g0,%o0,%o3 - add %o1,1,%o4 ! o4= search+1 - ldsb [%o0],%o5 ! o5= [current_str+1] - -.loop2: - ldsb [%o4],%g4 - add %o4,1,%o4 - cmp %g4,0 - be .end - cmp %o5,%g4 - bne .top - add %o3,1,%o3 - ba .loop2 - ldsb [%o3],%o5 - -.end: - retl - sub %o0,1,%o0 -.abort: - retl - or %g0,0,%o0 - -.strstr_end: - .size strstr,.strstr_end-strstr - .ident "Matt Wagner & Monty" diff --git a/strings/strxmov-sparc.s b/strings/strxmov-sparc.s deleted file mode 100644 index 11ae49a876b..00000000000 --- a/strings/strxmov-sparc.s +++ /dev/null @@ -1,54 +0,0 @@ -! Copyright (C) 2000, 2002 MySQL AB -! -! This library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Library General Public -! License as published by the Free Software Foundation; version 2 -! of the License. -! -! This library 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 -! Library General Public License for more details. -! -! You should have received a copy of the GNU Library General Public -! License along with this library; if not, write to the Free -! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA - -! -! Note that this function only works on 32 bit sparc systems -! on 64 bits the offsets to %sp are different ! - - .file "strxmov-sparc.s" -.section ".text" - .align 4 - .global strxmov - .type strxmov,#function - .proc 0102 - -strxmov: - st %o2, [%sp+76] ! store 3rd param before other params - st %o3, [%sp+80] ! store 4th param " " - cmp %o1, 0 ! check if no from args - st %o4, [%sp+84] ! store 5th param - be .end - st %o5, [%sp+88] ! store last - add %sp, 76, %o4 ! put pointer to 3rd arg -.loop: - ldub [%o1], %o5 ! set values of src (o1) - add %o1, 1, %o1 ! inc src - stb %o5, [%o0] ! and dst (o2) equal - cmp %o5, 0 ! second while cmp - bne,a .loop - add %o0, 1, %o0 ! inc dst - ld [%o4], %o1 ! get next param - cmp %o1, 0 ! check if last param - bne .loop - add %o4, 4, %o4 ! advance to next param -.end: - retl - stb %g0, [%o0] -.strxmov_end: - .size strxmov,.strxmov_end-strxmov - .ident "Matt Wagner & Monty" - diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index a3640077889..61f9d4881cb 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -5775,215 +5775,6 @@ static void test_set_variable() mysql_stmt_close(stmt1); } -#if NOT_USED - -/* Insert meta info .. */ - -static void test_insert_meta() -{ - MYSQL_STMT *stmt; - int rc; - MYSQL_RES *result; - MYSQL_FIELD *field; - - myheader("test_insert_meta"); - - rc= mysql_autocommit(mysql, TRUE); - myquery(rc); - - rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_insert"); - myquery(rc); - - rc= mysql_query(mysql, "CREATE TABLE test_prep_insert(col1 tinyint, \ - col2 varchar(50), col3 varchar(30))"); - myquery(rc); - - strmov(query, "INSERT INTO test_prep_insert VALUES(10, 'venu1', 'test')"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 0); - - result= mysql_param_result(stmt); - mytest_r(result); - - mysql_stmt_close(stmt); - - strmov(query, "INSERT INTO test_prep_insert VALUES(?, 'venu', ?)"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 2); - - result= mysql_param_result(stmt); - mytest(result); - - my_print_result_metadata(result); - - mysql_field_seek(result, 0); - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col1"); - DIE_UNLESS(strcmp(field->name, "col1") == 0); - - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col3"); - DIE_UNLESS(strcmp(field->name, "col3") == 0); - - field= mysql_fetch_field(result); - mytest_r(field); - - mysql_free_result(result); - mysql_stmt_close(stmt); -} - - -/* Update meta info .. */ - -static void test_update_meta() -{ - MYSQL_STMT *stmt; - int rc; - MYSQL_RES *result; - MYSQL_FIELD *field; - - myheader("test_update_meta"); - - rc= mysql_autocommit(mysql, TRUE); - myquery(rc); - - rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_update"); - myquery(rc); - - rc= mysql_query(mysql, "CREATE TABLE test_prep_update(col1 tinyint, \ - col2 varchar(50), col3 varchar(30))"); - myquery(rc); - - strmov(query, "UPDATE test_prep_update SET col1=10, col2='venu1' WHERE col3='test'"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 0); - - result= mysql_param_result(stmt); - mytest_r(result); - - mysql_stmt_close(stmt); - - strmov(query, "UPDATE test_prep_update SET col1=?, col2='venu' WHERE col3=?"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 2); - - result= mysql_param_result(stmt); - mytest(result); - - my_print_result_metadata(result); - - mysql_field_seek(result, 0); - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - { - fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1"); - fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update"); - } - DIE_UNLESS(strcmp(field->name, "col1") == 0); - DIE_UNLESS(strcmp(field->table, "test_prep_update") == 0); - - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - { - fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col3"); - fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update"); - } - DIE_UNLESS(strcmp(field->name, "col3") == 0); - DIE_UNLESS(strcmp(field->table, "test_prep_update") == 0); - - field= mysql_fetch_field(result); - mytest_r(field); - - mysql_free_result(result); - mysql_stmt_close(stmt); -} - - -/* Select meta info .. */ - -static void test_select_meta() -{ - MYSQL_STMT *stmt; - int rc; - MYSQL_RES *result; - MYSQL_FIELD *field; - - myheader("test_select_meta"); - - rc= mysql_autocommit(mysql, TRUE); - myquery(rc); - - rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_select"); - myquery(rc); - - rc= mysql_query(mysql, "CREATE TABLE test_prep_select(col1 tinyint, \ - col2 varchar(50), col3 varchar(30))"); - myquery(rc); - - strmov(query, "SELECT * FROM test_prep_select WHERE col1=10"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 0); - - result= mysql_param_result(stmt); - mytest_r(result); - - strmov(query, "SELECT col1, col3 from test_prep_select WHERE col1=? AND col3='test' AND col2= ?"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 2); - - result= mysql_param_result(stmt); - mytest(result); - - my_print_result_metadata(result); - - mysql_field_seek(result, 0); - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - { - fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1"); - fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select"); - } - DIE_UNLESS(strcmp(field->name, "col1") == 0); - DIE_UNLESS(strcmp(field->table, "test_prep_select") == 0); - - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - { - fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col2"); - fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select"); - } - DIE_UNLESS(strcmp(field->name, "col2") == 0); - DIE_UNLESS(strcmp(field->table, "test_prep_select") == 0); - - field= mysql_fetch_field(result); - mytest_r(field); - - mysql_free_result(result); - mysql_stmt_close(stmt); -} -#endif - - /* Test FUNCTION field info / DATE_FORMAT() table_name . */ static void test_func_fields() diff --git a/tests/thread_test.c b/tests/thread_test.c index 1a3dd60c1fd..c243a3a7321 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -88,36 +88,36 @@ static struct my_option my_long_options[] = { {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"database", 'D', "Database to use", (uchar**) &database, (uchar**) &database, + {"database", 'D', "Database to use", &database, &database, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"host", 'h', "Connect to host", (uchar**) &host, (uchar**) &host, 0, GET_STR, + {"host", 'h', "Connect to host", &host, &host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', "Password to use when connecting to server. If password is not given it's asked from the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"user", 'u', "User for login if not current user", (uchar**) &user, - (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"user", 'u', "User for login if not current user", &user, + &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"verbose", 'v', "Write some progress indicators", (uchar**) &verbose, - (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"query", 'Q', "Query to execute in each threads", (uchar**) &query, - (uchar**) &query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Write some progress indicators", &verbose, + &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"query", 'Q', "Query to execute in each threads", &query, + &query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 "/etc/services, " #endif "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", - (uchar**) &tcp_port, - (uchar**) &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, - {"socket", 'S', "Socket file to use for connection", (uchar**) &unix_socket, - (uchar**) &unix_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + &tcp_port, + &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, + {"socket", 'S', "Socket file to use for connection", &unix_socket, + &unix_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"test-count", 'c', "Run test count times (default %d)", - (uchar**) &number_of_tests, (uchar**) &number_of_tests, 0, GET_UINT, + &number_of_tests, &number_of_tests, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, {"thread-count", 't', "Number of threads to start", - (uchar**) &number_of_threads, (uchar**) &number_of_threads, 0, GET_UINT, + &number_of_threads, &number_of_threads, 0, GET_UINT, REQUIRED_ARG, 2, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/unittest/mysys/my_atomic-t.c b/unittest/mysys/my_atomic-t.c index 9853d3cf964..95799be7bb1 100644 --- a/unittest/mysys/my_atomic-t.c +++ b/unittest/mysys/my_atomic-t.c @@ -15,13 +15,6 @@ #include "thr_template.c" -/* at least gcc 3.4.5 and 3.4.6 (but not 3.2.3) on RHEL */ -#if __GNUC__ == 3 && __GNUC_MINOR__ == 4 -#define GCC_BUG_WORKAROUND volatile -#else -#define GCC_BUG_WORKAROUND -#endif - volatile uint32 b32; volatile int32 c32; my_atomic_rwlock_t rwl; @@ -29,8 +22,8 @@ my_atomic_rwlock_t rwl; /* add and sub a random number in a loop. Must get 0 at the end */ pthread_handler_t test_atomic_add(void *arg) { - int m= (*(int *)arg)/2; - GCC_BUG_WORKAROUND int32 x; + int m= (*(int *)arg)/2; + int32 x; for (x= ((int)(intptr)(&m)); m ; m--) { x= (x*m+0x87654321) & INT_MAX32; @@ -52,8 +45,8 @@ volatile int64 a64; /* add and sub a random number in a loop. Must get 0 at the end */ pthread_handler_t test_atomic_add64(void *arg) { - int m= (*(int *)arg)/2; - GCC_BUG_WORKAROUND int64 x; + int m= (*(int *)arg)/2; + int64 x; for (x= ((int64)(intptr)(&m)); m ; m--) { x= (x*m+0xfdecba987654321LL) & INT_MAX64; @@ -128,8 +121,8 @@ pthread_handler_t test_atomic_fas(void *arg) */ pthread_handler_t test_atomic_cas(void *arg) { - int m= (*(int *)arg)/2, ok= 0; - GCC_BUG_WORKAROUND int32 x, y; + int m= (*(int *)arg)/2, ok= 0; + int32 x, y; for (x= ((int)(intptr)(&m)); m ; m--) { my_atomic_rwlock_wrlock(&rwl); diff --git a/unittest/mytap/tap.c b/unittest/mytap/tap.c index 2f1747d7167..7facb23e7e3 100644 --- a/unittest/mytap/tap.c +++ b/unittest/mytap/tap.c @@ -29,9 +29,9 @@ /* Visual Studio 2003 does not know vsnprintf but knows _vsnprintf. - We don't put this #define in config-win.h because we prefer - my_vsnprintf everywhere instead, except when linking with libmysys - is not desirable - the case here. + We don't put this #define elsewhere because we prefer my_vsnprintf + everywhere instead, except when linking with libmysys is not + desirable - the case here. */ #if defined(_MSC_VER) && ( _MSC_VER == 1310 ) #define vsnprintf _vsnprintf |