summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-01-30 16:43:23 +0200
committerMichael Widenius <monty@askmonty.org>2011-01-30 16:43:23 +0200
commit2e75dda33ebc7468f777f55e403c1d40a00ec0e0 (patch)
treeb9ebb0c9950f8fa52958d1198e6df31c21cee7a3
parent4e17ec5a298b118e7f86df8d470abf06d3d5dbad (diff)
parent5bcf3a242c753449dde504a1a27712ad48b3ed8c (diff)
downloadmariadb-git-2e75dda33ebc7468f777f55e403c1d40a00ec0e0.tar.gz
Merge with 5.1
Fixed a couple of compilation failures that was not detected before merge.
-rw-r--r--client/Makefile.am2
-rw-r--r--include/my_dbug.h2
-rw-r--r--libmysql/Makefile.am2
-rw-r--r--libmysql/Makefile.shared1
-rw-r--r--storage/maria/ma_bitmap.c30
-rw-r--r--storage/maria/ma_blockrec.c7
-rw-r--r--storage/maria/ma_pagecache.c67
-rw-r--r--storage/maria/ma_recovery.c19
-rw-r--r--storage/maria/maria_chk.c21
-rw-r--r--storage/maria/maria_def.h2
-rw-r--r--strings/bchange.c3
-rw-r--r--strings/bcmp.c3
-rw-r--r--strings/bfill.c3
-rw-r--r--strings/bmove.c3
-rw-r--r--strings/bmove512.c3
-rw-r--r--strings/bmove_upp.c3
-rw-r--r--strings/conf_to_src.c5
-rw-r--r--strings/ctype-big5.c5
-rw-r--r--strings/ctype-bin.c5
-rw-r--r--strings/ctype-cp932.c5
-rw-r--r--strings/ctype-czech.c8
-rw-r--r--strings/ctype-euc_kr.c5
-rw-r--r--strings/ctype-eucjpms.c5
-rw-r--r--strings/ctype-extra.c2
-rw-r--r--strings/ctype-gb2312.c5
-rw-r--r--strings/ctype-gbk.c5
-rw-r--r--strings/ctype-latin1.c5
-rw-r--r--strings/ctype-mb.c5
-rw-r--r--strings/ctype-simple.c5
-rw-r--r--strings/ctype-sjis.c5
-rw-r--r--strings/ctype-tis620.c7
-rw-r--r--strings/ctype-uca.c6
-rw-r--r--strings/ctype-ucs2.c6
-rw-r--r--strings/ctype-ujis.c5
-rw-r--r--strings/ctype-utf8.c6
-rw-r--r--strings/ctype-win1250ch.c5
-rw-r--r--strings/ctype.c6
-rw-r--r--strings/decimal.c3
-rw-r--r--strings/do_ctype.c3
-rw-r--r--strings/int2str.c3
-rw-r--r--strings/is_prefix.c3
-rw-r--r--strings/llstr.c3
-rw-r--r--strings/longlong2str.c3
-rw-r--r--strings/longlong2str_asm.c3
-rw-r--r--strings/my_strchr.c5
-rw-r--r--strings/my_strtoll10.c3
-rw-r--r--strings/my_vsnprintf.c5
-rw-r--r--strings/r_strinstr.c3
-rw-r--r--strings/str2int.c5
-rw-r--r--strings/str_alloc.c3
-rw-r--r--strings/str_test.c37
-rw-r--r--strings/strappend.c3
-rw-r--r--strings/strcend.c3
-rw-r--r--strings/strcont.c3
-rw-r--r--strings/strend.c3
-rw-r--r--strings/strfill.c3
-rw-r--r--strings/strings_def.h31
-rw-r--r--strings/strinstr.c3
-rw-r--r--strings/strmake.c3
-rw-r--r--strings/strmov.c3
-rw-r--r--strings/strmov_overlapp.c3
-rw-r--r--strings/strnlen.c3
-rw-r--r--strings/strnmov.c3
-rw-r--r--strings/strstr.c3
-rw-r--r--strings/strto.c2
-rw-r--r--strings/strtod.c2
-rw-r--r--strings/strtol.c3
-rw-r--r--strings/strtoll.c3
-rw-r--r--strings/strtoul.c3
-rw-r--r--strings/strtoull.c3
-rw-r--r--strings/strxmov.c3
-rw-r--r--strings/strxnmov.c3
-rw-r--r--strings/uctypedump.c13
-rw-r--r--strings/udiv.c2
-rw-r--r--strings/xml.c3
75 files changed, 237 insertions, 234 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index a491ce364b6..1f2644f1e79 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -106,7 +106,7 @@ sql_src=log_event.h mysql_priv.h rpl_constants.h \
log_event.cc my_decimal.h my_decimal.cc \
log_event_old.h log_event_old.cc \
rpl_record_old.h rpl_record_old.cc
-strings_src=decimal.c
+strings_src=decimal.c strings_def.h
link_sources:
for f in $(sql_src) ; do \
diff --git a/include/my_dbug.h b/include/my_dbug.h
index e1cd4e2b7dc..3c1eb820028 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -126,7 +126,7 @@ extern void _db_flush_();
#define DBUG_END() _db_end_ ()
#define DBUG_LOCK_FILE _db_lock_file_()
#define DBUG_UNLOCK_FILE _db_unlock_file_()
-#define DBUG_ASSERT(A) assert(A)
+#define DBUG_ASSERT(A) do { _db_flush_(); assert(A); } while(0)
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
#define DEBUGGER_OFF do { _dbug_on_= 0; } while(0)
diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am
index b628bff9a3f..af10794f693 100644
--- a/libmysql/Makefile.am
+++ b/libmysql/Makefile.am
@@ -41,7 +41,7 @@ link_sources:
ms=`echo $(mysysobjects) | sed "s;\.lo;.c;g"`; \
vs=`echo $(vio_objects) | sed "s;\.lo;.c;g"`; \
scs=`echo $(sql_cmn_objects) | sed "s;\.lo;.c;g"`; \
- for f in $$ss; do \
+ for f in $$ss $(mystringsheaders); do \
rm -f $$f; \
@LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
done; \
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index bdac91c803d..472846d356b 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -50,6 +50,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
strmov_overlapp.lo
mystringsextra= strto.c
+mystringsheaders= strings_def.h
dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
mysysheaders = mysys_priv.h my_static.h
vioheaders = vio_priv.h
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index 2cbb66299a8..d9fd26da008 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -235,7 +235,8 @@ my_bool _ma_bitmap_init(MARIA_SHARE *share, File file)
The +1 is to add the bitmap page, as this doesn't have to be covered
*/
bitmap->pages_covered= aligned_bit_blocks * 16 + 1;
- bitmap->flush_all_requested= 0;
+ bitmap->flush_all_requested= bitmap->waiting_for_flush_all_requested=
+ bitmap->waiting_for_non_flushable= 0;
bitmap->non_flushable= 0;
/* Update size for bits */
@@ -365,6 +366,7 @@ filter_flush_bitmap_pages(enum pagecache_page_type type
my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
{
my_bool res= 0;
+ uint send_signal= 0;
MARIA_FILE_BITMAP *bitmap= &share->bitmap;
DBUG_ENTER("_ma_bitmap_flush_all");
@@ -374,7 +376,7 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
uint len= my_sprintf(buff,
(buff, "bitmap_flush: fd: %d id: %u "
"changed: %d changed_not_flushed: %d "
- "flush_all_requsted: %d",
+ "flush_all_requested: %d",
share->bitmap.file.file,
share->id,
bitmap->changed,
@@ -389,6 +391,7 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
if (bitmap->changed || bitmap->changed_not_flushed)
{
bitmap->flush_all_requested++;
+ bitmap->waiting_for_non_flushable++;
#ifndef WRONG_BITMAP_FLUSH
while (bitmap->non_flushable > 0)
{
@@ -396,6 +399,7 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
pthread_cond_wait(&bitmap->bitmap_cond, &bitmap->bitmap_lock);
}
#endif
+ bitmap->waiting_for_non_flushable--;
#ifdef EXTRA_DEBUG_BITMAP
{
char tmp[MAX_BITMAP_INFO_LENGTH];
@@ -440,10 +444,12 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
become false, wake them up.
*/
DBUG_PRINT("info", ("bitmap flusher waking up others"));
- if (bitmap->flush_all_requested)
- pthread_cond_broadcast(&bitmap->bitmap_cond);
+ send_signal= (bitmap->waiting_for_flush_all_requested |
+ bitmap->waiting_for_non_flushable);
}
pthread_mutex_unlock(&bitmap->bitmap_lock);
+ if (send_signal)
+ pthread_cond_broadcast(&bitmap->bitmap_cond);
DBUG_RETURN(res);
}
@@ -473,11 +479,13 @@ void _ma_bitmap_lock(MARIA_SHARE *share)
pthread_mutex_lock(&bitmap->bitmap_lock);
bitmap->flush_all_requested++;
+ bitmap->waiting_for_non_flushable++;
while (bitmap->non_flushable)
{
DBUG_PRINT("info", ("waiting for bitmap to be flushable"));
pthread_cond_wait(&bitmap->bitmap_cond, &bitmap->bitmap_lock);
}
+ bitmap->waiting_for_non_flushable--;
/*
Ensure that _ma_bitmap_flush_all() and _ma_bitmap_lock() are blocked.
ma_bitmap_flushable() is blocked thanks to 'flush_all_requested'.
@@ -497,6 +505,7 @@ void _ma_bitmap_lock(MARIA_SHARE *share)
void _ma_bitmap_unlock(MARIA_SHARE *share)
{
MARIA_FILE_BITMAP *bitmap= &share->bitmap;
+ uint send_signal;
DBUG_ENTER("_ma_bitmap_unlock");
if (!share->now_transactional)
@@ -504,10 +513,12 @@ void _ma_bitmap_unlock(MARIA_SHARE *share)
DBUG_ASSERT(bitmap->flush_all_requested > 0 && bitmap->non_flushable == 1);
pthread_mutex_lock(&bitmap->bitmap_lock);
- bitmap->flush_all_requested--;
bitmap->non_flushable= 0;
+ send_signal= bitmap->waiting_for_non_flushable;
+ if (!--bitmap->flush_all_requested)
+ send_signal|= bitmap->waiting_for_flush_all_requested;
pthread_mutex_unlock(&bitmap->bitmap_lock);
- if (bitmap->flush_all_requested > 0)
+ if (send_signal)
pthread_cond_broadcast(&bitmap->bitmap_cond);
DBUG_VOID_RETURN;
}
@@ -2334,7 +2345,7 @@ void _ma_bitmap_flushable(MARIA_HA *info, int non_flushable_inc)
the bitmap's mutex.
*/
_ma_bitmap_unpin_all(share);
- if (unlikely(bitmap->flush_all_requested))
+ if (unlikely(bitmap->waiting_for_non_flushable))
{
DBUG_PRINT("info", ("bitmap flushable waking up flusher"));
pthread_cond_broadcast(&bitmap->bitmap_cond);
@@ -2347,6 +2358,8 @@ void _ma_bitmap_flushable(MARIA_HA *info, int non_flushable_inc)
}
DBUG_ASSERT(non_flushable_inc == 1);
DBUG_ASSERT(info->non_flushable_state == 0);
+
+ bitmap->waiting_for_flush_all_requested++;
while (unlikely(bitmap->flush_all_requested))
{
/*
@@ -2363,6 +2376,7 @@ void _ma_bitmap_flushable(MARIA_HA *info, int non_flushable_inc)
DBUG_PRINT("info", ("waiting for bitmap flusher"));
pthread_cond_wait(&bitmap->bitmap_cond, &bitmap->bitmap_lock);
}
+ bitmap->waiting_for_flush_all_requested--;
bitmap->non_flushable++;
DBUG_PRINT("info", ("bitmap->non_flushable: %u", bitmap->non_flushable));
pthread_mutex_unlock(&bitmap->bitmap_lock);
@@ -2490,7 +2504,7 @@ my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks)
if (--bitmap->non_flushable == 0)
{
_ma_bitmap_unpin_all(info->s);
- if (unlikely(bitmap->flush_all_requested))
+ if (unlikely(bitmap->waiting_for_non_flushable))
{
DBUG_PRINT("info", ("bitmap flushable waking up flusher"));
pthread_cond_broadcast(&bitmap->bitmap_cond);
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 9704fe5d174..d149ca35682 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -3922,8 +3922,11 @@ static my_bool _ma_update_at_original_place(MARIA_HA *info,
goto err;
block= blocks->block;
block->empty_space= row_pos.empty_space;
- block->org_bitmap_value= _ma_free_size_to_head_pattern(&share->bitmap,
- org_empty_size);
+ block->org_bitmap_value=
+ _ma_free_size_to_head_pattern(&share->bitmap,
+ (enough_free_entries_on_page(share, buff) ?
+ org_empty_size : 0));
+
DBUG_ASSERT(block->org_bitmap_value ==
_ma_bitmap_get_page_bits(info, &info->s->bitmap, page));
block->used|= BLOCKUSED_USE_ORG_BITMAP;
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 97b9f70c902..156fe47a77b 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -113,7 +113,7 @@
(uint)((B)->hash_link ? \
(B)->hash_link->requests : \
0), \
- block->wlocks, block->rlocks, block->rlocks_queue, \
+ (B)->wlocks, (B)->rlocks, (B)->rlocks_queue, \
(uint)(B)->pins, (uint)(B)->status, \
page_cache_page_type_str[(B)->type]))
@@ -153,8 +153,20 @@ struct st_pagecache_hash_link
/* simple states of a block */
#define PCBLOCK_ERROR 1 /* an error occurred when performing disk i/o */
#define PCBLOCK_READ 2 /* the is page in the block buffer */
-#define PCBLOCK_IN_SWITCH 4 /* block is preparing to read new page */
-#define PCBLOCK_REASSIGNED 8 /* block does not accept requests for old page */
+
+/*
+ A tread is reading the data to the page. The page is not yet ready
+ to be used.
+*/
+#define PCBLOCK_IN_SWITCH 4
+/*
+ Block does not accept new requests for old page that would cause
+ the page to be pinned or written to.
+ (Reads that copies the block can still continue).
+ This state happens when another thread is waiting for readers to finish
+ to read/write new data to the block.
+*/
+#define PCBLOCK_REASSIGNED 8
#define PCBLOCK_IN_FLUSH 16 /* block is in flush operation */
#define PCBLOCK_CHANGED 32 /* block buffer contains a dirty page */
#define PCBLOCK_DIRECT_W 64 /* possible direct write to the block */
@@ -1807,7 +1819,9 @@ restart:
pageno number of the page in the file
init_hits_left how initialize the block counter for the page
wrmode <-> get for writing
- reg_req Register request to thye page
+ block_is_copied 1 if block will be copied from page cache under
+ the pagelock mutex.
+ reg_req Register request to the page
page_st out {PAGE_READ,PAGE_TO_BE_READ,PAGE_WAIT_TO_BE_READ}
RETURN VALUE
@@ -1836,6 +1850,7 @@ static PAGECACHE_BLOCK_LINK *find_block(PAGECACHE *pagecache,
pgcache_page_no_t pageno,
int init_hits_left,
my_bool wrmode,
+ my_bool block_is_copied,
my_bool reg_req,
int *page_st)
{
@@ -1941,7 +1956,7 @@ restart:
Only reading requests can proceed until the old dirty page is flushed,
all others are to be suspended, then resubmitted
*/
- if (!wrmode && !(block->status & PCBLOCK_REASSIGNED))
+ if (!wrmode && block_is_copied && !(block->status & PCBLOCK_REASSIGNED))
{
if (reg_req)
reg_requests(pagecache, block, 1);
@@ -2135,7 +2150,7 @@ restart:
(my_bool)(block->hash_link ? 1 : 0));
PCBLOCK_INFO(block);
block->status= error ? PCBLOCK_ERROR : 0;
- block->error= (int16) my_errno;
+ block->error= error ? (int16) my_errno : 0;
#ifndef DBUG_OFF
block->type= PAGECACHE_EMPTY_PAGE;
if (error)
@@ -2536,22 +2551,13 @@ static my_bool make_lock_and_pin(PAGECACHE *pagecache,
my_bool any)
{
DBUG_ENTER("make_lock_and_pin");
+ DBUG_PRINT("enter", ("block: 0x%lx (%u) lock: %s pin: %s any %d",
+ (ulong)block, PCBLOCK_NUMBER(pagecache, block),
+ page_cache_page_lock_str[lock],
+ page_cache_page_pin_str[pin], (int)any));
+ PCBLOCK_INFO(block);
- DBUG_PRINT("enter", ("block: 0x%lx", (ulong)block));
-#ifndef DBUG_OFF
- if (block)
- {
- DBUG_PRINT("enter", ("block: 0x%lx (%u) wrlocks: %u rdlocks: %u "
- "rdlocks_q: %u pins: %u lock: %s pin: %s any %d",
- (ulong)block, PCBLOCK_NUMBER(pagecache, block),
- block->wlocks, block->rlocks, block->rlocks_queue,
- block->pins,
- page_cache_page_lock_str[lock],
- page_cache_page_pin_str[pin], (int)any));
- PCBLOCK_INFO(block);
- }
-#endif
-
+ DBUG_ASSERT(block);
DBUG_ASSERT(!any ||
((lock == PAGECACHE_LOCK_LEFT_UNLOCKED) &&
(pin == PAGECACHE_UNPIN)));
@@ -2619,17 +2625,13 @@ static my_bool make_lock_and_pin(PAGECACHE *pagecache,
DBUG_ASSERT(0); /* Never should happened */
}
-#ifndef DBUG_OFF
- if (block)
- PCBLOCK_INFO(block);
-#endif
+ PCBLOCK_INFO(block);
DBUG_RETURN(0);
retry:
DBUG_PRINT("INFO", ("Retry block 0x%lx", (ulong)block));
PCBLOCK_INFO(block);
DBUG_ASSERT(block->hash_link->requests > 0);
block->hash_link->requests--;
- PCBLOCK_INFO(block);
DBUG_RETURN(1);
}
@@ -2661,7 +2663,6 @@ static void read_block(PAGECACHE *pagecache,
PAGECACHE_BLOCK_LINK *block,
my_bool primary)
{
-
DBUG_ENTER("read_block");
DBUG_PRINT("enter", ("read block: 0x%lx primary: %d",
(ulong)block, primary));
@@ -2823,8 +2824,7 @@ void pagecache_unlock(PAGECACHE *pagecache,
page_cache_page_pin_str[pin]));
/* we do not allow any lock/pin increasing here */
DBUG_ASSERT(pin != PAGECACHE_PIN);
- DBUG_ASSERT(lock != PAGECACHE_LOCK_READ);
- DBUG_ASSERT(lock != PAGECACHE_LOCK_WRITE);
+ DBUG_ASSERT(lock != PAGECACHE_LOCK_READ && lock != PAGECACHE_LOCK_WRITE);
pagecache_pthread_mutex_lock(&pagecache->cache_lock);
/*
@@ -2835,7 +2835,7 @@ void pagecache_unlock(PAGECACHE *pagecache,
inc_counter_for_resize_op(pagecache);
/* See NOTE for pagecache_unlock about registering requests */
- block= find_block(pagecache, file, pageno, 0, 0,
+ block= find_block(pagecache, file, pageno, 0, 0, 0,
pin == PAGECACHE_PIN_LEFT_UNPINNED, &page_st);
PCBLOCK_INFO(block);
DBUG_ASSERT(block != 0 && page_st == PAGE_READ);
@@ -2924,7 +2924,7 @@ void pagecache_unpin(PAGECACHE *pagecache,
inc_counter_for_resize_op(pagecache);
/* See NOTE for pagecache_unlock about registering requests */
- block= find_block(pagecache, file, pageno, 0, 0, 0, &page_st);
+ block= find_block(pagecache, file, pageno, 0, 0, 0, 0, &page_st);
DBUG_ASSERT(block != 0);
DBUG_ASSERT(page_st == PAGE_READ);
/* we can't unpin such page without unlock */
@@ -3367,7 +3367,7 @@ restart:
/* See NOTE for pagecache_unlock about registering requests. */
reg_request= ((new_pin == PAGECACHE_PIN_LEFT_UNPINNED) ||
(new_pin == PAGECACHE_PIN));
- block= find_block(pagecache, file, pageno, level,
+ block= find_block(pagecache, file, pageno, level, buff != 0,
lock == PAGECACHE_LOCK_WRITE,
reg_request, &page_st);
DBUG_PRINT("info", ("Block type: %s current type %s",
@@ -3785,7 +3785,6 @@ restart:
/* See NOTE for pagecache_unlock about registering requests. */
if (pin == PAGECACHE_PIN)
reg_requests(pagecache, block, 1);
- DBUG_ASSERT(block != 0);
if (make_lock_and_pin(pagecache, block, lock, pin, FALSE))
{
/*
@@ -3964,7 +3963,7 @@ restart:
reg_request= ((pin == PAGECACHE_PIN_LEFT_UNPINNED) ||
(pin == PAGECACHE_PIN));
block= find_block(pagecache, file, pageno, level,
- TRUE,
+ TRUE, FALSE,
reg_request, &page_st);
if (!block)
{
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index a7e97b12773..bc7f0a84237 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -1,5 +1,5 @@
/* Copyright (C) 2006, 2007 MySQL AB
- Copyright (C) 2010 Monty Program Ab
+ Copyright (C) 2010-2011 Monty Program 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
@@ -1292,6 +1292,21 @@ prototype_redo_exec_hook(FILE_ID)
{
tprint(tracef, " Closing table '%s'\n", info->s->open_file_name.str);
prepare_table_for_close(info, rec->lsn);
+
+ /*
+ Ensure that open count is 1 on close. This is needed as the
+ table may initially had an open_count > 0 when we initially
+ opened it as the server may have crashed without closing it
+ properly. As we now have applied all redo's for the table up to
+ now, we know the table is ok, so it's safe to reset the open
+ count to 0.
+ */
+ if (info->s->state.open_count != 0 && info->s->reopen == 1)
+ {
+ /* let ma_close() mark the table properly closed */
+ info->s->state.open_count= 1;
+ info->s->global_changed= 1;
+ }
if (maria_close(info))
{
eprint(tracef, "Failed to close table");
@@ -3412,7 +3427,7 @@ static int close_all_tables(void)
*/
if (info->s->state.open_count != 0)
{
- /* let ma_close() mark the table properly closed */
+ /* let maria_close() mark the table properly closed */
info->s->state.open_count= 1;
info->s->global_changed= 1;
}
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index a2b4bdf5547..fd7be248a82 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -42,7 +42,7 @@ static CHARSET_INFO *set_collation;
static int stopwords_inited= 0;
static MY_TMPDIR maria_chk_tmpdir;
static my_bool opt_transaction_logging, opt_debug, opt_require_control_file;
-static my_bool opt_warning_for_wrong_transid;
+static my_bool opt_warning_for_wrong_transid, opt_update_state;
static const char *type_names[]=
{
@@ -348,7 +348,8 @@ static struct my_option my_long_options[] =
"Mark tables as crashed if any errors were found and clean if check didn't "
"find any errors. This allows one to get rid of warnings like 'table not "
"properly closed'",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ &opt_update_state, &opt_update_state, 0, GET_BOOL, NO_ARG,
+ 1, 0, 0, 0, 0, 0},
{"unpack", 'u',
"Unpack file packed with maria_pack.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -483,8 +484,12 @@ static void usage(void)
-i, --information Print statistics information about table that is checked.\n\
-m, --medium-check Faster than extend-check, but only finds 99.99% of\n\
all errors. Should be good enough for most cases.\n\
+ -T, --read-only Don't mark table as checked.\n\
-U, --update-state Mark tables as crashed if you find any errors.\n\
- -T, --read-only Don't mark table as checked.\n");
+ --warning-for-wrong-transaction-id\n\
+ Give a warning if we find a transaction id in the table that is bigger\n\
+ than what exists in the control file. Use --skip-... to disable warning\n\
+ ");
puts("\
Recover (repair)/ options (When using '--recover' or '--safe-recover'):\n\
@@ -856,6 +861,7 @@ static void get_options(register int *argc,register char ***argv)
default_argv= *argv;
if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP;
+ check_param.testflag= T_UPDATE_STATE;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
@@ -1326,13 +1332,18 @@ static int maria_chk(HA_CHECK *param, char *filename)
(my_bool) !test(param->testflag & T_AUTO_INC));
if (info->update & HA_STATE_CHANGED && ! (param->testflag & T_READONLY))
+ {
error|=maria_update_state_info(param, info,
UPDATE_OPEN_COUNT |
- (((param->testflag & T_REP_ANY) ?
+ (((param->testflag &
+ (T_REP_ANY | T_UPDATE_STATE)) ?
UPDATE_TIME : 0) |
(state_updated ? UPDATE_STAT : 0) |
((param->testflag & T_SORT_RECORDS) ?
UPDATE_SORT : 0)));
+ if (!(param->testflag & T_SILENT))
+ printf("State updated\n");
+ }
info->update&= ~HA_STATE_CHANGED;
_ma_reenable_logging_for_table(info, FALSE);
maria_lock_database(info, F_UNLCK);
@@ -1438,7 +1449,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
if (share->state.check_time)
{
get_date(buff,1,share->state.check_time);
- printf("Recover time: %s\n",buff);
+ printf("Check/recover time: %s\n",buff);
}
if (share->base.born_transactional)
{
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index a57bd2f63a0..8ec54dac73b 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -249,7 +249,9 @@ typedef struct st_maria_file_bitmap
my_bool changed; /* 1 if page needs to be written */
my_bool changed_not_flushed; /* 1 if some bitmap is not flushed */
uint flush_all_requested; /**< If _ma_bitmap_flush_all waiting */
+ uint waiting_for_flush_all_requested; /* If someone is waiting for above */
uint non_flushable; /**< 0 if bitmap and log are in sync */
+ uint waiting_for_non_flushable; /* If someone is waiting for above */
PAGECACHE_FILE file; /* datafile where bitmap is stored */
#ifdef THREAD
diff --git a/strings/bchange.c b/strings/bchange.c
index 0b2c62019b5..3a054efdb0a 100644
--- a/strings/bchange.c
+++ b/strings/bchange.c
@@ -23,8 +23,7 @@
src in a buffer with tot_length bytes.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
void bchange(register uchar *dst, size_t old_length, register const uchar *src,
size_t new_length, size_t tot_length)
diff --git a/strings/bcmp.c b/strings/bcmp.c
index 39b5f24e055..e34c47ca596 100644
--- a/strings/bcmp.c
+++ b/strings/bcmp.c
@@ -21,8 +21,7 @@
comparing a shorter string with bcmp.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#ifdef HAVE_valgrind
#undef bcmp
diff --git a/strings/bfill.c b/strings/bfill.c
index 2750553f48a..9ca9e6b551b 100644
--- a/strings/bfill.c
+++ b/strings/bfill.c
@@ -29,8 +29,7 @@
code is presented for your interest and amusement.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#if !defined(bfill) && !defined(HAVE_BFILL)
diff --git a/strings/bmove.c b/strings/bmove.c
index ae9641a5d58..f94f262d7b4 100644
--- a/strings/bmove.c
+++ b/strings/bmove.c
@@ -36,8 +36,7 @@
code is presented for your interest and amusement.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#if !defined(HAVE_BMOVE) && !defined(bmove)
diff --git a/strings/bmove512.c b/strings/bmove512.c
index 0ae23d1f42d..308646c0586 100644
--- a/strings/bmove512.c
+++ b/strings/bmove512.c
@@ -25,8 +25,7 @@
fastest way to move a mutiple of 512 byte.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#ifndef bmove512
diff --git a/strings/bmove_upp.c b/strings/bmove_upp.c
index fb47bda2d1d..fa136751b76 100644
--- a/strings/bmove_upp.c
+++ b/strings/bmove_upp.c
@@ -22,8 +22,7 @@
"src-len" to the destination "dst-len" counting downwards.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#if defined(MC68000) && defined(DS90)
diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c
index aa40a269848..f64346e353c 100644
--- a/strings/conf_to_src.c
+++ b/strings/conf_to_src.c
@@ -13,8 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-#include <m_string.h>
+#include "strings_def.h"
#include <m_ctype.h>
#include <fcntl.h>
#include <my_xml.h>
@@ -250,7 +249,7 @@ static void
fprint_copyright(FILE *file)
{
fprintf(file,
-"/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n"
+"/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems Inc., 2010-2011 Monty Program Ab\n"
"\n"
" This program is free software; you can redistribute it and/or modify\n"
" it under the terms of the GNU General Public License as published by\n"
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 2cb40c266d2..7f2c5019ad3 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -26,9 +26,8 @@
* .configure. mbmaxlen_big5=2
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#ifdef HAVE_CHARSET_big5
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 95d97af2bfb..ed5cf86c4e2 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -18,9 +18,8 @@
/* This file is for binary pseudo charset, created by bar@mysql.com */
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
static uchar ctype_bin[]=
{
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 238c6f61baa..a2b7f1da2da 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -16,9 +16,8 @@
/* This file is for cp932 charaset (Windows Japanese),
and created based on ctype-sjis.c file */
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#ifdef HAVE_CHARSET_cp932
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index a5df86cc6b3..a06804262a7 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -65,9 +65,8 @@
#ifdef REAL_MYSQL
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#else
@@ -427,8 +426,7 @@ static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
*
* definition table reworked by Jaromir Dolecek <dolecek@ics.muni.cz>
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
static uchar NEAR ctype_czech[257] = {
0,
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index ee957304716..bd506ba7708 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -25,9 +25,8 @@
* .configure. mbmaxlen_euc_kr=2
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#ifdef HAVE_CHARSET_euckr
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c
index 615981b4d27..832bf1f849e 100644
--- a/strings/ctype-eucjpms.c
+++ b/strings/ctype-eucjpms.c
@@ -26,9 +26,8 @@ ctype-ujis.c file.
* .configure. mbmaxlen_eucjpms=3
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#ifdef HAVE_CHARSET_eucjpms
diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c
index 64cf30e3673..bf9e31bfa18 100644
--- a/strings/ctype-extra.c
+++ b/strings/ctype-extra.c
@@ -21,7 +21,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#include <my_global.h>
+#include "strings_def.h"
#include <m_ctype.h>
#ifdef HAVE_CHARSET_dec8
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 84f67dbbc2e..18a048e7c57 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -23,9 +23,8 @@
* .configure. mbmaxlen_gb2312=2
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#ifdef HAVE_CHARSET_gb2312
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 89607823d34..56d2fed3bce 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -26,9 +26,8 @@
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#ifdef HAVE_CHARSET_gbk
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index e5333c4101b..fb2f166ece8 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -13,9 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
static uchar ctype_latin1[] = {
0,
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 6e79d791b17..eb82f8f3806 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -13,9 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-#include "m_ctype.h"
-#include "m_string.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#ifdef USE_MB
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 4f3aaa6f668..84ccf9358a0 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -13,9 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#include "my_sys.h" /* Needed for MY_ERRNO_ERANGE */
#include <errno.h>
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index f52974e879e..b96bc0df342 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -16,9 +16,8 @@
/* This file is for Shift JIS charset, and created by tommy@valley.ne.jp.
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#ifdef HAVE_CHARSET_sjis
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index a8c05dc4fd0..995d5302f49 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -47,11 +47,10 @@
* .configure. strxfrm_multiply_tis620=4
*/
-#include <my_global.h>
-#include <my_sys.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#include "t_ctype.h"
+#include <my_sys.h>
#ifdef HAVE_CHARSET_tis620
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 3d08e466ca3..0966c124cca 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -32,10 +32,8 @@
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
-
+#include "strings_def.h"
+#include <m_ctype.h>
#define MY_UCA_CNT_FLAG_SIZE 4096
#define MY_UCA_CNT_FLAG_MASK 4095
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 9e37518fb1b..ca82c71a1d2 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -17,11 +17,9 @@
/* UCS2 support. Written by Alexander Barkov <bar@mysql.com> */
-#include <my_global.h>
+#include "strings_def.h"
+#include <m_ctype.h>
#include <my_sys.h>
-#include "m_string.h"
-#include "m_ctype.h"
-#include <errno.h>
#include <stdarg.h>
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index 4474bd0cf96..596d8bc1723 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -25,9 +25,8 @@
* .configure. mbmaxlen_ujis=3
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#ifdef HAVE_CHARSET_ujis
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 9cfee43fa36..0b688d62856 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -18,10 +18,8 @@
/* UTF8 according RFC 2279 */
/* Written by Alexander Barkov <bar@udm.net> */
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
-#include <errno.h>
+#include "strings_def.h"
+#include <m_ctype.h>
#ifndef EILSEQ
#define EILSEQ ENOENT
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index b22b4364e8a..30bf2146c9d 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -39,9 +39,8 @@
#define REAL_MYSQL
#ifdef REAL_MYSQL
-#include "my_global.h"
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#else
diff --git a/strings/ctype.c b/strings/ctype.c
index 75d76aceea3..41b81b6591c 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -13,13 +13,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
+#include "strings_def.h"
#include <m_ctype.h>
#include <my_xml.h>
-#ifndef SCO
-#include <m_string.h>
-#endif
-
/*
diff --git a/strings/decimal.c b/strings/decimal.c
index 236b62b9296..65919296f61 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -99,11 +99,10 @@
implementation-defined.
*/
-#include <my_global.h>
+#include "strings_def.h"
#include <m_ctype.h>
#include <myisampack.h>
#include <my_sys.h> /* for my_alloca */
-#include <m_string.h>
#include <decimal.h>
/*
diff --git a/strings/do_ctype.c b/strings/do_ctype.c
index f33ddc5eb81..91e29c55158 100644
--- a/strings/do_ctype.c
+++ b/strings/do_ctype.c
@@ -20,10 +20,9 @@
#undef DBUG_OFF
#endif
-#include <my_global.h>
+#include "strings_def.h"
#include <ctype.h>
#include <my_sys.h>
-#include "m_string.h"
uchar NEAR to_upper[256];
uchar NEAR to_lower[256],NEAR sort_order[256];
diff --git a/strings/int2str.c b/strings/int2str.c
index fba98aac3f1..f784e5ec717 100644
--- a/strings/int2str.c
+++ b/strings/int2str.c
@@ -13,8 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
/*
_dig_vec arrays are public because they are used in several outer places.
diff --git a/strings/is_prefix.c b/strings/is_prefix.c
index 451cd468b7e..f116e6bf1bf 100644
--- a/strings/is_prefix.c
+++ b/strings/is_prefix.c
@@ -21,8 +21,7 @@
A empty t is allways a prefix.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
int is_prefix(register const char *s, register const char *t)
{
diff --git a/strings/llstr.c b/strings/llstr.c
index 678f8b05f39..fdbe1b6f6dc 100644
--- a/strings/llstr.c
+++ b/strings/llstr.c
@@ -24,8 +24,7 @@
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
char *llstr(longlong value,char *buff)
{
diff --git a/strings/longlong2str.c b/strings/longlong2str.c
index d7de5bb0f7c..e25143b00f9 100644
--- a/strings/longlong2str.c
+++ b/strings/longlong2str.c
@@ -37,8 +37,7 @@
itoa assumes that 10 -base numbers are allways signed and other arn't.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#if defined(HAVE_LONG_LONG) && !defined(longlong2str) && !defined(HAVE_LONGLONG2STR)
diff --git a/strings/longlong2str_asm.c b/strings/longlong2str_asm.c
index 637815e52c5..1689b2582b4 100644
--- a/strings/longlong2str_asm.c
+++ b/strings/longlong2str_asm.c
@@ -20,8 +20,7 @@
_dig_vector in a portable manner.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
extern char *longlong2str_with_dig_vector(longlong val,char *dst,int radix,
const char *dig_vector);
diff --git a/strings/my_strchr.c b/strings/my_strchr.c
index 6724bf39ff2..8c471b1ab3a 100644
--- a/strings/my_strchr.c
+++ b/strings/my_strchr.c
@@ -21,9 +21,8 @@
frequently.
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end,
diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c
index 4f73b1f8e71..f8e3825b441 100644
--- a/strings/my_strtoll10.c
+++ b/strings/my_strtoll10.c
@@ -13,9 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
+#include "strings_def.h"
#include <my_sys.h> /* Needed for MY_ERRNO_ERANGE */
-#include <m_string.h>
#undef ULONGLONG_MAX
/*
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 920022aae91..a39cfb7083a 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -13,10 +13,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-#include <m_string.h>
-#include <stdarg.h>
+#include "strings_def.h"
#include <m_ctype.h>
+#include <stdarg.h>
/*
Limited snprintf() implementations
diff --git a/strings/r_strinstr.c b/strings/r_strinstr.c
index fb1e0c5a090..e342f72ed52 100644
--- a/strings/r_strinstr.c
+++ b/strings/r_strinstr.c
@@ -22,8 +22,7 @@
the pattern counted from the begining of the string.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
size_t r_strinstr(reg1 const char * str, size_t from, reg4 const char * search)
{
diff --git a/strings/str2int.c b/strings/str2int.c
index c4a4c07eeff..1bee56d1846 100644
--- a/strings/str2int.c
+++ b/strings/str2int.c
@@ -37,9 +37,8 @@
call has no problems.
*/
-#include <my_global.h>
-#include "m_string.h"
-#include "m_ctype.h"
+#include "strings_def.h"
+#include <m_ctype.h>
#include "my_sys.h" /* defines errno */
#include <errno.h>
diff --git a/strings/str_alloc.c b/strings/str_alloc.c
index 615ad1ba1e2..bb20fde0f56 100644
--- a/strings/str_alloc.c
+++ b/strings/str_alloc.c
@@ -13,8 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-#include <m_string.h>
+#include "strings_def.h"
static void *my_str_malloc_default(size_t size)
{
diff --git a/strings/str_test.c b/strings/str_test.c
index 3ddfca39419..3ad1392f185 100644
--- a/strings/str_test.c
+++ b/strings/str_test.c
@@ -15,9 +15,8 @@
/* Test of all stringfunktions that is coded in assembler */
-#include <my_global.h>
+#include "strings_def.h"
#include <stdarg.h>
-#include "m_string.h"
#define F_LEN 8
#define F_CHAR 'A'
@@ -50,10 +49,10 @@ int main(void)
errors=tests=0;
init_strings();
- test_arg("bcmp(from,to,5)",(long) my_test(bcmp(from,to,5)),1L);
- test_arg("bcmp(from,from,5)",(long) bcmp(from,from,5),0L);
+ test_arg("bcmp(from,to,5)",(long) my_test(bcmp((uchar*) from, (uchar*) to,5)),1L);
+ test_arg("bcmp(from,from,5)",(long) bcmp((uchar*) from, (uchar*) from,5),0L);
- test_arg("bcmp(from,to,0)",(long) bcmp(from,to,0),0L);
+ test_arg("bcmp(from,to,0)",(long) bcmp((uchar*) from, (uchar*) to,0),0L);
test_arg("strend(from)",(long) strend(from),(long) from+F_LEN);
test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1);
test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4);
@@ -90,10 +89,10 @@ int main(void)
test_strarg("bmove(to,from,4)",(bmove(to,from,4),0L),INT_MAX32,4,F_CHAR,
0,0);
test_strarg("bmove(to,from,0)",(bmove(to,from,0),0L),INT_MAX32,0,0);
- test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp(to+6,from+6,3),0L),INT_MAX32,
+ test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp((uchar*) to+6, (uchar*) from+6,3),0L),INT_MAX32,
3,T_CHAR,3,F_CHAR,0,0);
- test_strarg("bmove_upp(to,from,0)",(bmove_upp(to,from,0),0L),INT_MAX32,0,0);
- test_strarg("bmove_align(to,from,8)",(bmove_align(to,from,8),0L),INT_MAX32,
+ test_strarg("bmove_upp(to,from,0)",(bmove_upp((uchar*) to, (uchar*) from,0),0L),INT_MAX32,0,0);
+ test_strarg("bmove_align(to,from,8)",(bmove_align((uchar*) to, (uchar*) from,8),0L),INT_MAX32,
8,F_CHAR,0,0);
test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32,
3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0);
@@ -124,7 +123,7 @@ int main(void)
test_strarg("strxnmov(to,2,\"!!\",NullS)",strxnmov(to,2,"!!","xx",NullS),to+2,2,'!',0,0,0);
test_strarg("strxnmov(to,2,\"!\",\"x\",\"y\",NullS)",strxnmov(to,2,"!","x","y",NullS),to+2,1,'!',1,'x',0,0,0);
- test_strarg("bchange(to,2,from,4,6)",(bchange(to,2,from,4,6),0L),INT_MAX32,
+ test_strarg("bchange(to,2,from,4,6)",(bchange((uchar*) to,2,(uchar*) from,4,6),0L),INT_MAX32,
4,F_CHAR,2,T_CHAR,0,0);
printf("tests: %d errors: %d\n",tests,errors);
@@ -233,7 +232,7 @@ int compare_buff(const char *message, char * b1, char * b2, int length,
{
int i,error=0;
- if (bcmp(b1,b2,length))
+ if (bcmp((uchar*) b1, (uchar*) b2, length))
{
errors++;
printf("func: '%s' Buffers differ\nIs: ",message);
@@ -259,19 +258,19 @@ int compare_buff(const char *message, char * b1, char * b2, int length,
return error;
} /* compare_buff */
- /* These are here to be loaded and examined */
+ /* These are here to be loaded and examined in debugger */
extern void dummy_functions(void);
void dummy_functions(void)
{
- VOID(memchr(from,'a',5));
- VOID(memcmp(from,to,5));
- VOID(memcpy(from,to,5));
- VOID(memset(from,' ',5));
- VOID(strcmp(from,to));
- VOID(strcpy(from,to));
- VOID(strstr(from,to));
- VOID(strrchr(from,'a'));
+ (void) memchr(from,'a',5);
+ (void) memcmp(from,to,5);
+ (void) memcpy(from,to,5);
+ (void) memset(from,' ',5);
+ (void) strcmp(from,to);
+ (void) strcpy(from,to);
+ (void) strstr(from,to);
+ (void) strrchr(from,'a');
return;
}
diff --git a/strings/strappend.c b/strings/strappend.c
index bb926f74665..1a95da673a7 100644
--- a/strings/strappend.c
+++ b/strings/strappend.c
@@ -23,8 +23,7 @@
trunked. The des+len character is allways set to NULL.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
void strappend(register char *s, size_t len, pchar fill)
diff --git a/strings/strcend.c b/strings/strcend.c
index 56e31d5f994..426995f5f31 100644
--- a/strings/strcend.c
+++ b/strings/strcend.c
@@ -22,8 +22,7 @@
occurs, or a pointer to the end-null of s if c does not occur in s.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#if defined(MC68000) && defined(DS90)
diff --git a/strings/strcont.c b/strings/strcont.c
index 5a518a3550f..9041d84b1c1 100644
--- a/strings/strcont.c
+++ b/strings/strcont.c
@@ -24,8 +24,7 @@
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
char * strcont(reg1 const char *str,reg2 const char *set)
{
diff --git a/strings/strend.c b/strings/strend.c
index 4dadf0675dc..18facccdc3f 100644
--- a/strings/strend.c
+++ b/strings/strend.c
@@ -27,8 +27,7 @@
Beware: the asm version works only if strlen(s) < 65535.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#if VaxAsm
diff --git a/strings/strfill.c b/strings/strfill.c
index 4b1fe67b206..9f30ef07548 100644
--- a/strings/strfill.c
+++ b/strings/strfill.c
@@ -23,8 +23,7 @@
strfill() returns pointer to dest+len;
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
char * strfill(char *s, size_t len, pchar fill)
{
diff --git a/strings/strings_def.h b/strings/strings_def.h
new file mode 100644
index 00000000000..0430e9cd4d6
--- /dev/null
+++ b/strings/strings_def.h
@@ -0,0 +1,31 @@
+/* Copyright (C) 2011 Monty Program 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 */
+
+/* This file is to be include first in all files in the string directory */
+
+#include <my_global.h> /* Define standar vars */
+#include "m_string.h" /* Exernal defintions of string functions */
+
+/*
+ We can't use the original DBUG_ASSERT() (which includes _db_flush())
+ in the strings library as libdbug is compiled after the the strings
+ library and we don't want to have strings depending on libdbug which
+ depends on mysys and strings.
+*/
+
+#if !defined(DBUG_OFF)
+#undef DBUG_ASSERT
+#define DBUG_ASSERT(A) assert(A)
+#endif
diff --git a/strings/strinstr.c b/strings/strinstr.c
index dce498d61e8..8f2e4ecd1ee 100644
--- a/strings/strinstr.c
+++ b/strings/strinstr.c
@@ -25,8 +25,7 @@
char is 1.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
size_t strinstr(reg1 const char *str,reg4 const char *search)
{
diff --git a/strings/strmake.c b/strings/strmake.c
index 56bd3a8f084..761a0cdc5f7 100644
--- a/strings/strmake.c
+++ b/strings/strmake.c
@@ -24,8 +24,7 @@
strmake() returns pointer to closing null
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
char *strmake(register char *dst, register const char *src, size_t length)
{
diff --git a/strings/strmov.c b/strings/strmov.c
index 5112ad8d90e..322c9f9ec04 100644
--- a/strings/strmov.c
+++ b/strings/strmov.c
@@ -21,8 +21,7 @@
into dst, which seems useful.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#ifndef strmov
diff --git a/strings/strmov_overlapp.c b/strings/strmov_overlapp.c
index 4cc3e294620..59d980fc7c4 100644
--- a/strings/strmov_overlapp.c
+++ b/strings/strmov_overlapp.c
@@ -13,8 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
/* A trivial implementation */
char *strmov_overlapp(char *dst, const char *src)
diff --git a/strings/strnlen.c b/strings/strnlen.c
index 826cd5ae5dd..891087a6ebe 100644
--- a/strings/strnlen.c
+++ b/strings/strnlen.c
@@ -20,8 +20,7 @@
strnlen(s, len) returns the length of s or len if s is longer than len.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#ifndef HAVE_STRNLEN
diff --git a/strings/strnmov.c b/strings/strnmov.c
index 7e26877637b..2087980429a 100644
--- a/strings/strnmov.c
+++ b/strings/strnmov.c
@@ -20,8 +20,7 @@
truncated.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
char *strnmov(register char *dst, register const char *src, size_t n)
{
diff --git a/strings/strstr.c b/strings/strstr.c
index a5b50d12043..b19fb39724c 100644
--- a/strings/strstr.c
+++ b/strings/strstr.c
@@ -27,8 +27,7 @@
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#ifndef HAVE_STRSTR
diff --git a/strings/strto.c b/strings/strto.c
index fcb0d800b81..858d10a134f 100644
--- a/strings/strto.c
+++ b/strings/strto.c
@@ -40,7 +40,7 @@
/* see 'strtoll.c' and 'strtoull.c' for the reasons */
#endif
-#include "m_ctype.h"
+#include <m_ctype.h>
#include "my_sys.h" /* defines errno */
#include <errno.h>
diff --git a/strings/strtod.c b/strings/strtod.c
index 4c9cf931cb3..5f2fd664da3 100644
--- a/strings/strtod.c
+++ b/strings/strtod.c
@@ -27,7 +27,7 @@
*/
#include "my_base.h" /* Includes errno.h + EOVERFLOW */
-#include "m_ctype.h"
+#include <m_ctype.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
diff --git a/strings/strtol.c b/strings/strtol.c
index 42476b0226a..b8269191aa7 100644
--- a/strings/strtol.c
+++ b/strings/strtol.c
@@ -20,8 +20,7 @@
functions, especially they handle tricks for Tru64 where 'long' is
64 bit already and our 'longlong' is just a 'long'.
*/
-#include <my_global.h>
-#include <m_string.h>
+#include "strings_def.h"
#if !defined(MSDOS) && !defined(HAVE_STRTOL) && !defined(__WIN__)
#include "strto.c"
diff --git a/strings/strtoll.c b/strings/strtoll.c
index cfb6fbd75ee..a619ca69546 100644
--- a/strings/strtoll.c
+++ b/strings/strtoll.c
@@ -24,8 +24,7 @@
for 'strtoll()' but no implementation, see "6.1 New C99 library functions"
in file '/usr/share/doclib/cc.dtk/release_notes.txt'.
*/
-#include <my_global.h>
-#include <m_string.h>
+#include "strings_def.h"
#if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG)
#define USE_LONGLONG
diff --git a/strings/strtoul.c b/strings/strtoul.c
index 3e2b51bc982..ce3b61c9b3f 100644
--- a/strings/strtoul.c
+++ b/strings/strtoul.c
@@ -20,8 +20,7 @@
functions, especially they handle tricks for Tru64 where 'long' is
64 bit already and our 'longlong' is just a 'long'.
*/
-#include <my_global.h>
-#include <m_string.h>
+#include "strings_def.h"
#if !defined(MSDOS) && !defined(HAVE_STRTOUL)
#define USE_UNSIGNED
diff --git a/strings/strtoull.c b/strings/strtoull.c
index 94bf6904f8d..76228ec0717 100644
--- a/strings/strtoull.c
+++ b/strings/strtoull.c
@@ -24,8 +24,7 @@
for 'strtoull()' but no implementation, see "6.1 New C99 library functions"
in file '/usr/share/doclib/cc.dtk/release_notes.txt'.
*/
-#include <my_global.h>
-#include <m_string.h>
+#include "strings_def.h"
#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
#define USE_UNSIGNED
diff --git a/strings/strxmov.c b/strings/strxmov.c
index d5d81fd9274..1f4a44b5b88 100644
--- a/strings/strxmov.c
+++ b/strings/strxmov.c
@@ -30,8 +30,7 @@
character pointer, or not the same bit pattern as NullS.
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
char *strxmov(char *dst,const char *src, ...)
{
diff --git a/strings/strxnmov.c b/strings/strxnmov.c
index 16469be6e45..4685affeac9 100644
--- a/strings/strxnmov.c
+++ b/strings/strxnmov.c
@@ -35,8 +35,7 @@
if total-string-length >= length then dst[length] will be set to \0
*/
-#include <my_global.h>
-#include "m_string.h"
+#include "strings_def.h"
#include <stdarg.h>
char *strxnmov(char *dst, size_t len, const char *src, ...)
diff --git a/strings/uctypedump.c b/strings/uctypedump.c
index 2e484604fd3..3ae4b7935e1 100644
--- a/strings/uctypedump.c
+++ b/strings/uctypedump.c
@@ -13,15 +13,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-/*
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-*/
-#include <my_global.h>
-#include <m_string.h>
+#include "strings_def.h"
#include <m_ctype.h>
-#include "m_ctype.h"
typedef struct my_ctype_name_st
@@ -204,7 +197,7 @@ int main(int ac, char ** av)
int charnum=0;
int num=0;
- printf("static unsigned char uctype_page%02X[256]=\n{\n",plane);
+ printf("static unsigned char uctype_page%02X[256]=\n{\n", (uint) plane);
for(charnum=0;charnum<256;charnum++)
{
@@ -231,7 +224,7 @@ int main(int ac, char ** av)
{
char plane_name[128]="NULL";
if(uctype[plane].ctype){
- sprintf(plane_name,"uctype_page%02X",plane);
+ sprintf(plane_name,"uctype_page%02X",(uint) plane);
}
printf("\t{%d,%s}%s\n",uctype[plane].pctype,plane_name,plane<255?",":"");
}
diff --git a/strings/udiv.c b/strings/udiv.c
index 81ac01ee9c3..7655e52e2cb 100644
--- a/strings/udiv.c
+++ b/strings/udiv.c
@@ -15,7 +15,7 @@
/* Do udiv and urem if machine dosn't have it */
-#include <my_global.h>
+#include "strings_def.h"
#include <math.h>
unsigned long udiv(long unsigned int a, long unsigned int b)
diff --git a/strings/xml.c b/strings/xml.c
index 14da69e088a..58b20553ff7 100644
--- a/strings/xml.c
+++ b/strings/xml.c
@@ -13,8 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "my_global.h"
-#include "m_string.h"
+#include "strings_def.h"
#include "my_xml.h"