diff options
author | unknown <monty@donna.mysql.com> | 2001-01-31 04:47:25 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2001-01-31 04:47:25 +0200 |
commit | 495231ea25a82d97e69e96ff9e5d7688434cfff2 (patch) | |
tree | 851a8ba92ed9883efe2504e0726aae6843c317c0 /mysys | |
parent | bf1f8fd3eb4b98dadd265f8ed10d92220dabe1bb (diff) | |
download | mariadb-git-495231ea25a82d97e69e96ff9e5d7688434cfff2.tar.gz |
New myisamchk option --sort-recover
Allow delete of crashed MyISAM tables
Fixed bug when BLOB was first part of key
Fixed bug when using result from CASE in GROUP BY
Fixed core-dump bug in monthname()
Optimized calling of check_db_name()
Docs/manual.texi:
Added more information about myisamchk
client/mysqladmin.c:
Added error message for CREATE database and fixed possible overflow bug
include/myisam.h:
New myisamchk option --sort-recover
libmysql/libmysql.c:
Removed commented code
Don't define getpwuid (breaks on SCO 3.2)
myisam/mi_check.c:
Fixed (new) bug when using --recover --optimize
myisam/mi_delete_table.c:
Allow delete of crashed tables
myisam/mi_key.c:
Fixed bug when BLOB was first part of key
myisam/myisamchk.c:
New myisamchk option --sort-recover
mysql-test/r/case.result:
New test cases to check for reported bugs
mysql-test/r/func_time.result:
New test cases to check for reported bugs
mysql-test/r/type_blob.result:
New test cases to check for reported bugs
mysql-test/r/type_datetime.result:
New test cases to check for reported bugs
mysql-test/t/case.test:
New test cases to check for reported bugs
mysql-test/t/func_time.test:
New test cases to check for reported bugs
mysql-test/t/type_blob.test:
New test cases to check for reported bugs
mysql-test/t/type_datetime.test:
New test cases to check for reported bugs
mysys/my_bitmap.c:
Optimize
sql-bench/limits/ms-sql.cfg:
Updated limits
sql/item_cmpfunc.cc:
Fixed bug when using result from CASE in GROUP BY
sql/item_cmpfunc.h:
Fixed bug when using result from CASE in GROUP BY
sql/item_timefunc.cc:
Fixed core-dump bug in monthname()
sql/sql_db.cc:
Optimized calling of check_db_name()
sql/sql_parse.cc:
Optimized calling of check_db_name()
sql/table.cc:
Fixed typo
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_bitmap.c | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index 1434f472f98..848df42d4d4 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -17,6 +17,13 @@ /* Handling of uchar arrays as large bitmaps. + We assume that the size of the used bitmap is less than ~(uint) 0 + + TODO: + + create an unique structure for this that includes the mutex and bitmap size + make a init function that will allocate the bitmap and init the mutex + make an end function that will free everything */ #include "mysys_priv.h" @@ -24,37 +31,51 @@ pthread_mutex_t LOCK_bitmap; -void bitmap_set_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit) { - if((bitmap_bit != MY_BIT_NONE) && (bitmap_bit < bitmap_size*8)) { +void bitmap_set_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit) +{ + if (bitmap_bit < bitmap_size*8) + { pthread_mutex_lock(&LOCK_bitmap); - bitmap[bitmap_bit / 8] |= (1 << bitmap_bit % 8); + bitmap[bitmap_bit / 8] |= (1 << (bitmap_bit & 7)); pthread_mutex_unlock(&LOCK_bitmap); - }; -}; + } +} -uint bitmap_set_next(uchar *bitmap, uint bitmap_size) { +uint bitmap_set_next(uchar *bitmap, uint bitmap_size) +{ uint bit_found = MY_BIT_NONE; - int i, b; + uint i; pthread_mutex_lock(&LOCK_bitmap); - for(i=0; (i<bitmap_size) && (bit_found==MY_BIT_NONE); i++) { - if(bitmap[i] == 0xff) continue; - for(b=0; (b<8) && (bit_found==MY_BIT_NONE); b++) - if((bitmap[i] & 1<<b) == 0) { - bit_found = (i*8)+b; - bitmap[i] |= 1<<b; - }; - }; + for (i=0; i < bitmap_size ; i++, bitmap++) + { + if (*bitmap != 0xff) + { /* Found slot with free bit */ + uint b; + for (b=0; ; b++) + { + if (!(*bitmap & (1 << b))) + { + *bitmap |= 1<<b; + bit_found = (i*8)+b; + break; + } + } + break; /* Found bit */ + } + } pthread_mutex_unlock(&LOCK_bitmap); - return bit_found; -}; +} + -void bitmap_clear_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit) { - if((bitmap_bit != MY_BIT_NONE) && (bitmap_bit < bitmap_size*8)) { +void bitmap_clear_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit) +{ + if (bitmap_bit < bitmap_size*8) + { pthread_mutex_lock(&LOCK_bitmap); - bitmap[bitmap_bit / 8] &= ~(1 << bitmap_bit % 8); + bitmap[bitmap_bit / 8] &= ~ (1 << (bitmap_bit & 7)); pthread_mutex_unlock(&LOCK_bitmap); - }; -}; + } +} |