diff options
-rw-r--r-- | include/config-win.h | 1 | ||||
-rw-r--r-- | include/my_global.h | 8 | ||||
-rw-r--r-- | sql/item_func.cc | 43 | ||||
-rw-r--r-- | sql/item_func.h | 4 | ||||
-rw-r--r-- | sql/mysql_priv.h | 8 | ||||
-rw-r--r-- | sql/mysqld.cc | 8 | ||||
-rw-r--r-- | sql/sql_class.h | 2 |
7 files changed, 39 insertions, 35 deletions
diff --git a/include/config-win.h b/include/config-win.h index abc1aa7a6ee..518f445861a 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -95,6 +95,7 @@ functions */ #define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF) #define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF) #define LL(A) ((__int64) A) +#define ULL(A) ((unsigned __int64) A) /* Type information */ diff --git a/include/my_global.h b/include/my_global.h index 2a82173979d..4a56741ddbc 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -842,6 +842,14 @@ typedef char bool; /* Ordinary boolean values 0 1 */ #endif #endif +#ifndef ULL +#ifdef HAVE_LONG_LONG +#define ULL(A) A ## ULL +#else +#define ULL(A) A ## UL +#endif +#endif + /* Defines to make it possible to prioritize register assignments. No longer that important with modern compilers. diff --git a/sql/item_func.cc b/sql/item_func.cc index 0327204dbfd..99a429e48fb 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1728,7 +1728,7 @@ bool udf_handler::get_arguments() { return 0; } pthread_mutex_t LOCK_user_locks; static HASH hash_user_locks; -class ULL +class User_level_lock { char *key; uint key_length; @@ -1740,7 +1740,7 @@ public: pthread_t thread; ulong thread_id; - ULL(const char *key_arg,uint length, ulong id) + User_level_lock(const char *key_arg,uint length, ulong id) :key_length(length),count(1),locked(1), thread_id(id) { key=(char*) my_memdup((byte*) key_arg,length,MYF(0)); @@ -1754,7 +1754,7 @@ public: } } } - ~ULL() + ~User_level_lock() { if (key) { @@ -1764,11 +1764,12 @@ public: pthread_cond_destroy(&cond); } inline bool initialized() { return key != 0; } - friend void item_user_lock_release(ULL *ull); - friend char *ull_get_key(const ULL *ull,uint *length,my_bool not_used); + friend void item_user_lock_release(User_level_lock *ull); + friend char *ull_get_key(const User_level_lock *ull, uint *length, + my_bool not_used); }; -char *ull_get_key(const ULL *ull,uint *length, +char *ull_get_key(const User_level_lock *ull, uint *length, my_bool not_used __attribute__((unused))) { *length=(uint) ull->key_length; @@ -1796,7 +1797,7 @@ void item_user_lock_free(void) } } -void item_user_lock_release(ULL *ull) +void item_user_lock_release(User_level_lock *ull) { ull->locked=0; if (mysql_bin_log.is_open()) @@ -1852,7 +1853,7 @@ longlong Item_master_pos_wait::val_int() void debug_sync_point(const char* lock_name, uint lock_timeout) { THD* thd=current_thd; - ULL* ull; + User_level_lock* ull; struct timespec abstime; int lock_name_len,error=0; lock_name_len=strlen(lock_name); @@ -1870,7 +1871,7 @@ void debug_sync_point(const char* lock_name, uint lock_timeout) this case, we will not be waiting, but rather, just waste CPU and memory on the whole deal */ - if (!(ull= ((ULL*) hash_search(&hash_user_locks,lock_name, + if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks, lock_name, lock_name_len)))) { pthread_mutex_unlock(&LOCK_user_locks); @@ -1931,7 +1932,7 @@ longlong Item_func_get_lock::val_int() longlong timeout=args[1]->val_int(); struct timespec abstime; THD *thd=current_thd; - ULL *ull; + User_level_lock *ull; int error=0; pthread_mutex_lock(&LOCK_user_locks); @@ -1950,10 +1951,11 @@ longlong Item_func_get_lock::val_int() thd->ull=0; } - if (!(ull= ((ULL*) hash_search(&hash_user_locks,(byte*) res->ptr(), - res->length())))) + if (!(ull= ((User_level_lock *) hash_search(&hash_user_locks, + (byte*) res->ptr(), + res->length())))) { - ull=new ULL(res->ptr(),res->length(), thd->thread_id); + ull=new User_level_lock(res->ptr(),res->length(), thd->thread_id); if (!ull || !ull->initialized()) { delete ull; @@ -2022,7 +2024,7 @@ longlong Item_func_get_lock::val_int() longlong Item_func_release_lock::val_int() { String *res=args[0]->val_str(&value); - ULL *ull; + User_level_lock *ull; longlong result; if (!res || !res->length()) { @@ -2033,8 +2035,9 @@ longlong Item_func_release_lock::val_int() result=0; pthread_mutex_lock(&LOCK_user_locks); - if (!(ull= ((ULL*) hash_search(&hash_user_locks,(const byte*) res->ptr(), - res->length())))) + if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks, + (const byte*) res->ptr(), + res->length())))) { null_value=1; } @@ -3041,7 +3044,7 @@ longlong Item_func_is_free_lock::val_int() { String *res=args[0]->val_str(&value); THD *thd=current_thd; - ULL *ull; + User_level_lock *ull; null_value=0; if (!res || !res->length()) @@ -3051,7 +3054,7 @@ longlong Item_func_is_free_lock::val_int() } pthread_mutex_lock(&LOCK_user_locks); - ull= (ULL*) hash_search(&hash_user_locks,(byte*) res->ptr(), + ull= (User_level_lock *) hash_search(&hash_user_locks, (byte*) res->ptr(), res->length()); pthread_mutex_unlock(&LOCK_user_locks); if (!ull || !ull->locked) @@ -3063,14 +3066,14 @@ longlong Item_func_is_used_lock::val_int() { String *res=args[0]->val_str(&value); THD *thd=current_thd; - ULL *ull; + User_level_lock *ull; null_value=1; if (!res || !res->length()) return 0; pthread_mutex_lock(&LOCK_user_locks); - ull= (ULL*) hash_search(&hash_user_locks,(byte*) res->ptr(), + ull= (User_level_lock *) hash_search(&hash_user_locks, (byte*) res->ptr(), res->length()); pthread_mutex_unlock(&LOCK_user_locks); if (!ull || !ull->locked) diff --git a/sql/item_func.h b/sql/item_func.h index 3890e7c6de5..8fbe5a124da 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -864,9 +864,9 @@ public: ** User level locks */ -class ULL; +class User_level_lock; void item_user_lock_init(void); -void item_user_lock_release(ULL *ull); +void item_user_lock_release(User_level_lock *ull); void item_user_lock_free(void); class Item_func_get_lock :public Item_int_func diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 8696a09962c..8f86d9990fe 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -64,14 +64,6 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); #define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1)) #define all_bits_set(A,B) ((A) & (B) != (B)) -#ifndef LL -#ifdef HAVE_LONG_LONG -#define LL(A) A ## LL -#else -#define LL(A) A ## L -#endif -#endif - extern CHARSET_INFO *system_charset_info, *files_charset_info ; extern CHARSET_INFO *national_charset_info, *table_alias_charset; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9a469e529cf..786390efd6b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -308,10 +308,10 @@ double log_10[32]; /* 10 potences */ ulonglong log_10_int[20]= { 1, 10, 100, 1000, 10000UL, 100000UL, 1000000UL, 10000000UL, - 100000000UL, 1000000000UL, 10000000000UL, 100000000000UL, - 1000000000000UL, 10000000000000UL, 100000000000000UL, - 1000000000000000UL, 10000000000000000UL, 100000000000000000UL, - 1000000000000000000UL, 10000000000000000000UL + ULL(100000000), ULL(1000000000), ULL(10000000000), ULL(100000000000), + ULL(1000000000000), ULL(10000000000000), ULL(100000000000000), + ULL(1000000000000000), ULL(10000000000000000), ULL(100000000000000000), + ULL(1000000000000000000), ULL(10000000000000000000) }; time_t start_time; diff --git a/sql/sql_class.h b/sql/sql_class.h index 567135b1378..33684f93d93 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -657,7 +657,7 @@ public: points to a lock object if the lock is present. See item_func.cc and chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK. */ - ULL *ull; + User_level_lock *ull; #ifndef DBUG_OFF uint dbug_sentry; // watch out for memory corruption #endif |