diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-07-27 18:32:42 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-07-27 18:32:42 +0400 |
commit | 2abe7b9d4ee96919cc0504be3805c8712a46a532 (patch) | |
tree | f5b4dd56c20ccff8f87fcf2ff244d4be368ac972 /include | |
parent | 6d059673f7dc1dbff5e154b0ca6d1ef2f0fa3cc3 (diff) | |
parent | c6a34a99616c749c1d4874c9e7f7424fd2765de6 (diff) | |
download | mariadb-git-2abe7b9d4ee96919cc0504be3805c8712a46a532.tar.gz |
Merge trunk-bugfixing -> trunk-runtime.
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 6 | ||||
-rw-r--r-- | include/atomic/gcc_builtins.h | 5 | ||||
-rw-r--r-- | include/atomic/nolock.h | 17 | ||||
-rw-r--r-- | include/atomic/solaris.h | 8 | ||||
-rw-r--r-- | include/atomic/x86-gcc.h | 41 | ||||
-rw-r--r-- | include/config-win.h | 441 | ||||
-rw-r--r-- | include/lf.h | 5 | ||||
-rw-r--r-- | include/m_string.h | 38 | ||||
-rw-r--r-- | include/my_atomic.h | 35 | ||||
-rw-r--r-- | include/my_attribute.h | 6 | ||||
-rw-r--r-- | include/my_bit.h | 21 | ||||
-rw-r--r-- | include/my_bitmap.h | 22 | ||||
-rw-r--r-- | include/my_global.h | 257 | ||||
-rw-r--r-- | include/my_net.h | 7 | ||||
-rw-r--r-- | include/my_nosys.h | 2 | ||||
-rw-r--r-- | include/my_sys.h | 23 | ||||
-rw-r--r-- | include/my_trie.h | 141 | ||||
-rw-r--r-- | include/my_vle.h | 38 | ||||
-rw-r--r-- | include/myisam.h | 5 | ||||
-rw-r--r-- | include/mysql_embed.h | 2 |
20 files changed, 93 insertions, 1027 deletions
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 */ |