Commit 2e0d5eac authored by unknown's avatar unknown

Fix of compilation failure of latest 4.1 tree: new constants in mysqld.cc

exceed unsigned long limit.


include/config-win.h:
  implementation of ULL macro for Windows
include/my_global.h:
  ULL macro defined: we need this macro because ULL qualifier is not defined 
  on systems withoug unsigned long long
sql/item_func.cc:
  new ULL macro caused conflict with class for user level lock ULL.
  ULL renamed to User_level_lock
sql/item_func.h:
  ULL -> User_level_lock
sql/mysql_priv.h:
  merge error fixed: LL defined in my_global.h
sql/mysqld.cc:
  ULL macro used for long long constants to fix compilation failure on gcc 3.*
sql/sql_class.h:
  ULL renamed to User_level_lock
parent ef44fb9a
......@@ -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 */
......
......@@ -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.
......
......@@ -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 @@ class ULL
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 @@ class ULL
}
}
}
~ULL()
~User_level_lock()
{
if (key)
{
......@@ -1764,11 +1764,12 @@ class ULL
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)
......
......@@ -864,9 +864,9 @@ class Item_func_udf_str :public Item_func
** 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
......
......@@ -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;
......
......@@ -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;
......
......@@ -657,7 +657,7 @@ class THD :public ilink,
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment