diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-07-23 17:16:29 -0300 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-07-23 17:16:29 -0300 |
commit | 75e22123972f3404cd384839695c9e7b0165565f (patch) | |
tree | 6e64b324e47ec067c848617b8ea8340fde01d8b2 | |
parent | 7a344b61065080902ad9530d33ed0fa72a1522fa (diff) | |
download | mariadb-git-75e22123972f3404cd384839695c9e7b0165565f.tar.gz |
WL#5498: Remove dead and unused source code
Remove unused macros or macro which are always defined.
include/my_global.h:
Remove unused macros and move macros which aren't used globally.
-rw-r--r-- | client/mysqltest.cc | 6 | ||||
-rw-r--r-- | extra/replace.c | 6 | ||||
-rw-r--r-- | include/my_attribute.h | 6 | ||||
-rw-r--r-- | include/my_global.h | 176 | ||||
-rw-r--r-- | libmysql/errmsg.c | 134 | ||||
-rw-r--r-- | mysys/mf_iocache2.c | 10 | ||||
-rw-r--r-- | mysys/my_handler.c | 2 | ||||
-rw-r--r-- | mysys/my_init.c | 3 | ||||
-rw-r--r-- | regex/regcomp.c | 12 | ||||
-rw-r--r-- | sql/handler.cc | 4 | ||||
-rw-r--r-- | sql/handler.h | 4 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 5 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 23 | ||||
-rw-r--r-- | sql/item_subselect.h | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 6 | ||||
-rw-r--r-- | sql/sql_lex.h | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sys_vars.cc | 6 | ||||
-rw-r--r-- | sql/table.cc | 6 | ||||
-rw-r--r-- | storage/heap/ha_heap.cc | 2 | ||||
-rw-r--r-- | storage/myisam/ft_boolean_search.c | 2 | ||||
-rw-r--r-- | storage/myisam/ft_nlq_search.c | 3 | ||||
-rw-r--r-- | storage/myisam/mi_write.c | 5 | ||||
-rw-r--r-- | storage/myisam/myisamchk.c | 1 | ||||
-rw-r--r-- | strings/do_ctype.c | 4 |
25 files changed, 52 insertions, 382 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index c8ec6c981ef..3b4c593922b 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -8513,7 +8513,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 +9644,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 +9680,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/extra/replace.c b/extra/replace.c index 5b5f9cee6f8..2ce374726eb 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -51,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; @@ -266,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; @@ -303,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/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_global.h b/include/my_global.h index 9eab692b924..49a80d68016 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,78 +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 @@ -298,22 +214,6 @@ /* 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 @@ -557,14 +457,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 */ - #define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ #define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ @@ -606,12 +498,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 @@ -619,8 +505,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) @@ -634,18 +518,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> /* @@ -672,9 +544,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 */ @@ -751,14 +620,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) */ @@ -819,10 +681,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 @@ -847,7 +705,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 @@ -894,7 +751,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" @@ -1010,9 +866,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)) @@ -1163,14 +1016,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 @@ -1214,23 +1063,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 */ @@ -1561,11 +1396,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 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/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index e940fc31c30..7a40ea8a86f 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -70,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/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 a3ca6159c77..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; diff --git a/regex/regcomp.c b/regex/regcomp.c index 812cdd115d1..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; diff --git a/sql/handler.cc b/sql/handler.cc index 06f869d4dff..efbc335f9b2 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -230,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/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_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/mysqld.cc b/sql/mysqld.cc index 4c0d290f2cc..cb579324644 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1465,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(); @@ -1932,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 */ @@ -3343,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 diff --git a/sql/sql_lex.h b/sql/sql_lex.h index ed521e4791f..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(); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index bfae3d9c199..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 diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 37a87687d48..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); 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/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 350958f8230..0176b2db96a 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -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/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/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/myisamchk.c b/storage/myisam/myisamchk.c index 6cc3ef9081b..4df76e31872 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -27,7 +27,6 @@ #ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> #endif -SET_STACK_SIZE(9000) /* Minimum stack size for program */ static uint decode_bits; static char **default_argv; 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 */ |