summaryrefslogtreecommitdiff
path: root/storage/maria
diff options
context:
space:
mode:
Diffstat (limited to 'storage/maria')
-rw-r--r--storage/maria/CMakeLists.txt5
-rw-r--r--storage/maria/ha_maria.cc221
-rw-r--r--storage/maria/ha_maria.h7
-rw-r--r--storage/maria/lockman.c4
-rw-r--r--storage/maria/ma_bitmap.c2
-rw-r--r--storage/maria/ma_blockrec.c52
-rw-r--r--storage/maria/ma_changed.c2
-rw-r--r--storage/maria/ma_check.c94
-rw-r--r--storage/maria/ma_check_standalone.h24
-rw-r--r--storage/maria/ma_checkpoint.c14
-rw-r--r--storage/maria/ma_close.c14
-rw-r--r--storage/maria/ma_create.c18
-rw-r--r--storage/maria/ma_dbug.c36
-rw-r--r--storage/maria/ma_delete.c6
-rw-r--r--storage/maria/ma_delete_all.c4
-rw-r--r--storage/maria/ma_dynrec.c14
-rw-r--r--storage/maria/ma_ft_boolean_search.c55
-rw-r--r--storage/maria/ma_ft_nlq_search.c6
-rw-r--r--storage/maria/ma_ft_parser.c28
-rw-r--r--storage/maria/ma_ft_update.c3
-rw-r--r--storage/maria/ma_ftdefs.h10
-rw-r--r--storage/maria/ma_info.c2
-rw-r--r--storage/maria/ma_init.c10
-rw-r--r--storage/maria/ma_key.c2
-rw-r--r--storage/maria/ma_locking.c4
-rw-r--r--storage/maria/ma_loghandler.c37
-rw-r--r--storage/maria/ma_open.c26
-rw-r--r--storage/maria/ma_packrec.c17
-rw-r--r--storage/maria/ma_pagecache.c185
-rw-r--r--storage/maria/ma_pagecache.h4
-rw-r--r--storage/maria/ma_preload.c4
-rw-r--r--storage/maria/ma_recovery.c30
-rw-r--r--storage/maria/ma_recovery_util.c2
-rw-r--r--storage/maria/ma_rsame.c4
-rw-r--r--storage/maria/ma_rt_index.c2
-rw-r--r--storage/maria/ma_rt_test.c2
-rw-r--r--storage/maria/ma_search.c2
-rw-r--r--storage/maria/ma_sort.c26
-rw-r--r--storage/maria/ma_sp_key.c2
-rw-r--r--storage/maria/ma_sp_test.c8
-rw-r--r--storage/maria/ma_state.c18
-rw-r--r--storage/maria/ma_static.c22
-rw-r--r--storage/maria/ma_statrec.c2
-rw-r--r--storage/maria/ma_test1.c19
-rw-r--r--storage/maria/ma_test2.c11
-rw-r--r--storage/maria/ma_test3.c15
-rw-r--r--storage/maria/ma_unique.c6
-rw-r--r--storage/maria/ma_update.c4
-rw-r--r--storage/maria/ma_write.c9
-rw-r--r--storage/maria/maria_chk.c90
-rw-r--r--storage/maria/maria_def.h21
-rw-r--r--storage/maria/maria_ftdump.c6
-rw-r--r--storage/maria/maria_pack.c272
-rw-r--r--storage/maria/maria_read_log.c10
-rw-r--r--storage/maria/plug.in2
-rw-r--r--storage/maria/tablockman.c16
-rw-r--r--storage/maria/trnman.c4
-rw-r--r--storage/maria/unittest/ma_control_file-t.c8
-rw-r--r--storage/maria/unittest/ma_pagecache_consist.c8
-rw-r--r--storage/maria/unittest/ma_pagecache_rwconsist.c8
-rw-r--r--storage/maria/unittest/ma_pagecache_rwconsist2.c8
-rw-r--r--storage/maria/unittest/ma_pagecache_single.c12
-rw-r--r--storage/maria/unittest/ma_test_loghandler-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_first_lsn-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_max_lsn-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multigroup-t.c4
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multithread-t.c8
-rw-r--r--storage/maria/unittest/ma_test_loghandler_noflush-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_nologs-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_pagecache-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_purge-t.c2
-rw-r--r--storage/maria/unittest/test_file.c2
-rw-r--r--storage/maria/unittest/trnman-t.c3
73 files changed, 757 insertions, 833 deletions
diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt
index 7b5b190bd57..4095c1fc594 100644
--- a/storage/maria/CMakeLists.txt
+++ b/storage/maria/CMakeLists.txt
@@ -13,6 +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(CMakeDependentOption)
+
SET(ARIA_SOURCES ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c
ma_rnext.c ma_rnext_same.c
ma_search.c ma_page.c ma_key_recover.c ma_key.c
@@ -82,3 +84,6 @@ IF (MSVC)
SET_TARGET_PROPERTIES(aria_chk aria_pack PROPERTIES LINK_FLAGS "setargv.obj")
ENDIF()
+CMAKE_DEPENDENT_OPTION(USE_ARIA_FOR_TMP_TABLES "Use Aria for temporary tables" ON
+ "WITH_ARIA_STORAGE_ENGINE" OFF)
+
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 27958285a2e..8227449679e 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -20,7 +20,6 @@
#endif
#define MYSQL_SERVER 1
-#include "mysql_priv.h"
#include <mysql/plugin.h>
#include <m_ctype.h>
#include <my_dir.h>
@@ -39,6 +38,13 @@ C_MODE_START
#include "ma_recovery.h"
C_MODE_END
+//#include "sql_priv.h"
+#include "protocol.h"
+#include "sql_class.h"
+#include "key.h"
+#include "log.h"
+#include "sql_parse.h"
+
/*
Note that in future versions, only *transactional* Maria tables can
rollback, so this flag should be up or down conditionally.
@@ -262,12 +268,12 @@ static MYSQL_SYSVAR_ENUM(sync_log_dir, sync_log_dir, PLUGIN_VAR_RQCMDARG,
"\"always\").", NULL, NULL, TRANSLOG_SYNC_DIR_NEWFILE,
&maria_sync_log_dir_typelib);
-#ifdef USE_MARIA_FOR_TMP_TABLES
-#define USE_MARIA_FOR_TMP_TABLES_VAL 1
+#ifdef USE_ARIA_FOR_TMP_TABLES
+#define USE_ARIA_FOR_TMP_TABLES_VAL 1
#else
-#define USE_MARIA_FOR_TMP_TABLES_VAL 0
+#define USE_ARIA_FOR_TMP_TABLES_VAL 0
#endif
-my_bool use_maria_for_temp_tables= USE_MARIA_FOR_TMP_TABLES_VAL;
+my_bool use_maria_for_temp_tables= USE_ARIA_FOR_TMP_TABLES_VAL;
static MYSQL_SYSVAR_BOOL(used_for_temp_tables,
use_maria_for_temp_tables, PLUGIN_VAR_READONLY | PLUGIN_VAR_NOCMDOPT,
@@ -768,7 +774,7 @@ static int maria_create_trn_for_mysql(MARIA_HA *info)
if (unlikely(!trn))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
THD_TRN= trn;
- if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
+ if (thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
trans_register_ha(thd, TRUE, maria_hton);
}
_ma_set_trn_for_table(info, trn);
@@ -972,7 +978,7 @@ int ha_maria::dump(THD * thd, int fd)
}
err:
- my_free((uchar*) buf, MYF(0));
+ my_free(buf);
return error;
}
#endif /* HAVE_REPLICATION */
@@ -1015,11 +1021,11 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
file->s->chst_invalidator= query_cache_invalidate_by_MyISAM_filename_ref;
if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE))
- VOID(maria_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0));
+ maria_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0);
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
- VOID(maria_extra(file, HA_EXTRA_WAIT_LOCK, 0));
+ maria_extra(file, HA_EXTRA_WAIT_LOCK, 0);
if ((data_file_type= file->s->data_file_type) != STATIC_RECORD)
int_table_flags |= HA_REC_NOT_IN_SEQ;
if (!file->s->base.born_transactional)
@@ -1215,131 +1221,6 @@ int ha_maria::analyze(THD *thd, HA_CHECK_OPT * check_opt)
return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK;
}
-
-int ha_maria::restore(THD * thd, HA_CHECK_OPT *check_opt)
-{
- HA_CHECK_OPT tmp_check_opt;
- char *backup_dir= thd->lex->backup_dir;
- char src_path[FN_REFLEN], dst_path[FN_REFLEN];
- char table_name[FN_REFLEN];
- int error;
- const char *errmsg;
- DBUG_ENTER("restore");
-
- VOID(tablename_to_filename(table->s->table_name.str, table_name,
- sizeof(table_name)));
-
- if (fn_format_relative_to_data_home(src_path, table_name, backup_dir,
- MARIA_NAME_DEXT))
- DBUG_RETURN(HA_ADMIN_INVALID);
-
- strxmov(dst_path, table->s->normalized_path.str, MARIA_NAME_DEXT, NullS);
- if (my_copy(src_path, dst_path, MYF(MY_WME)))
- {
- error= HA_ADMIN_FAILED;
- errmsg= "Failed in my_copy (Error %d)";
- goto err;
- }
-
- tmp_check_opt.init();
- tmp_check_opt.flags |= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK;
- DBUG_RETURN(repair(thd, &tmp_check_opt));
-
-err:
- {
- /*
- Don't allocate param on stack here as this may be huge and it's
- also allocated by repair()
- */
- HA_CHECK *param;
- if (!(param= (HA_CHECK*) my_malloc(sizeof(*param), MYF(MY_WME | MY_FAE))))
- DBUG_RETURN(error);
- maria_chk_init(param);
- param->thd= thd;
- param->op_name= "restore";
- param->db_name= table->s->db.str;
- param->table_name= table->s->table_name.str;
- param->testflag= 0;
- _ma_check_print_error(param, errmsg, my_errno);
- my_free(param, MYF(0));
- DBUG_RETURN(error);
- }
-}
-
-
-int ha_maria::backup(THD * thd, HA_CHECK_OPT *check_opt)
-{
- char *backup_dir= thd->lex->backup_dir;
- char src_path[FN_REFLEN], dst_path[FN_REFLEN];
- char table_name[FN_REFLEN];
- int error;
- const char *errmsg;
- DBUG_ENTER("ha_maria::backup");
-
- VOID(tablename_to_filename(table->s->table_name.str, table_name,
- sizeof(table_name)));
-
- if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
- reg_ext))
- {
- errmsg= "Failed in fn_format() for .frm file (errno: %d)";
- error= HA_ADMIN_INVALID;
- goto err;
- }
-
- strxmov(src_path, table->s->normalized_path.str, reg_ext, NullS);
- if (my_copy(src_path, dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
- {
- error= HA_ADMIN_FAILED;
- errmsg= "Failed copying .frm file (errno: %d)";
- goto err;
- }
-
- /* Change extension */
- if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
- MARIA_NAME_DEXT))
- {
- errmsg= "Failed in fn_format() for .MYD file (errno: %d)";
- error= HA_ADMIN_INVALID;
- goto err;
- }
-
- strxmov(src_path, table->s->normalized_path.str, MARIA_NAME_DEXT, NullS);
- if (_ma_flush_table_files(file, MARIA_FLUSH_DATA, FLUSH_FORCE_WRITE,
- FLUSH_KEEP))
- {
- error= HA_ADMIN_FAILED;
- errmsg= "Failed in flush (Error %d)";
- goto err;
- }
- if (my_copy(src_path, dst_path,
- MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
- {
- errmsg= "Failed copying .MYD file (errno: %d)";
- error= HA_ADMIN_FAILED;
- goto err;
- }
- DBUG_RETURN(HA_ADMIN_OK);
-
-err:
- {
- HA_CHECK &param= *(HA_CHECK*) thd->alloc(sizeof(param));
- if (!&param)
- return HA_ADMIN_INTERNAL_ERROR;
-
- maria_chk_init(&param);
- param.thd= thd;
- param.op_name= "backup";
- param.db_name= table->s->db.str;
- param.table_name= table->s->table_name.str;
- param.testflag= 0;
- _ma_check_print_error(&param, errmsg, my_errno);
- DBUG_RETURN(error);
- }
-}
-
-
int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
{
int error;
@@ -1497,7 +1378,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
strmov(fixed_name, share->open_file_name.str);
// Don't lock tables if we have used LOCK TABLE
- if (!thd->locked_tables &&
+ if (!thd->locked_tables_mode &&
maria_lock_database(file, table->s->tmp_table ? F_EXTRA_LCK : F_WRLCK))
{
_ma_check_print_error(param, ER(ER_CANT_LOCK), my_errno);
@@ -1600,7 +1481,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
(local_testflag &
T_STATISTICS ? UPDATE_STAT : 0));
info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
- HA_STATUS_CONST, 0);
+ HA_STATUS_CONST);
if (rows != file->state->records && !(param->testflag & T_VERY_SILENT))
{
char llbuff[22], llbuff2[22];
@@ -1620,7 +1501,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
}
pthread_mutex_unlock(&share->intern_lock);
thd_proc_info(thd, old_proc_info);
- if (!thd->locked_tables)
+ if (!thd->locked_tables_mode)
maria_lock_database(file, F_UNLCK);
/* Reset trn, that may have been set by repair */
@@ -2087,9 +1968,9 @@ bool ha_maria::check_and_repair(THD *thd)
check_opt.flags |= T_QUICK;
old_query= thd->query_string;
- pthread_mutex_lock(&LOCK_thread_count);
+ mysql_mutex_lock(&LOCK_thread_count);
thd->query_string= table->s->table_name;
- pthread_mutex_unlock(&LOCK_thread_count);
+ mysql_mutex_unlock(&LOCK_thread_count);
if (!(crashed= maria_is_crashed(file)))
{
@@ -2107,9 +1988,9 @@ bool ha_maria::check_and_repair(THD *thd)
if (repair(thd, &check_opt))
error= 1;
}
- pthread_mutex_lock(&LOCK_thread_count);
+ mysql_mutex_lock(&LOCK_thread_count);
thd->query_string= old_query;
- pthread_mutex_unlock(&LOCK_thread_count);
+ mysql_mutex_unlock(&LOCK_thread_count);
DBUG_RETURN(error);
}
@@ -2333,11 +2214,6 @@ void ha_maria::position(const uchar *record)
int ha_maria::info(uint flag)
{
- return info(flag, table->s->tmp_table == NO_TMP_TABLE);
-}
-
-int ha_maria::info(uint flag, my_bool lock_table_share)
-{
MARIA_INFO maria_info;
char name_buff[FN_REFLEN];
@@ -2364,8 +2240,6 @@ int ha_maria::info(uint flag, my_bool lock_table_share)
stats.mrr_length_per_rec= maria_info.reflength + 8; // 8 = max(sizeof(void *))
/* Update share */
- if (lock_table_share)
- pthread_mutex_lock(&share->mutex);
share->keys_in_use.set_prefix(share->keys);
share->keys_in_use.intersect_extended(maria_info.key_map);
share->keys_for_keyread.intersect(share->keys_in_use);
@@ -2377,8 +2251,6 @@ int ha_maria::info(uint flag, my_bool lock_table_share)
for (end= to+ share->key_parts ; to < end ; to++, from++)
*to= (ulong) (*from + 0.5);
}
- if (lock_table_share)
- pthread_mutex_unlock(&share->mutex);
/*
Set data_file_name and index_file_name to point at the symlink value
@@ -2472,8 +2344,8 @@ int ha_maria::delete_all_rows()
(void) translog_log_debug_info(file->trn, LOGREC_DEBUG_INFO_QUERY,
(uchar*) thd->query(), thd->query_length());
if (file->s->now_transactional &&
- ((table->in_use->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ||
- table->in_use->locked_tables))
+ ((table->in_use->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ||
+ table->in_use->locked_tables_mode))
{
/*
We are not in autocommit mode or user have done LOCK TABLES.
@@ -2602,7 +2474,7 @@ int ha_maria::external_lock(THD *thd, int lock_type)
This is a bit excessive, ACID requires this only if there are some
changes to commit (rollback shouldn't be tested).
*/
- DBUG_ASSERT(!thd->main_da.is_sent ||
+ DBUG_ASSERT(!thd->stmt_da->is_sent ||
thd->killed == THD::KILL_CONNECTION);
/* autocommit ? rollback a transaction */
#ifdef MARIA_CANNOT_ROLLBACK
@@ -2610,7 +2482,7 @@ int ha_maria::external_lock(THD *thd, int lock_type)
DBUG_RETURN(1);
THD_TRN= 0;
#else
- if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
+ if (!(thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
{
trnman_rollback_trn(trn);
DBUG_PRINT("info", ("THD_TRN set to 0x0"));
@@ -2693,23 +2565,19 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn)
int error= 0;
TABLE *table;
DBUG_ENTER("ha_maria::implicit_commit");
- if (!new_trn && thd->locked_tables)
+ if (!maria_hton)
+ DBUG_RETURN(0);
+ if (!new_trn && (thd->locked_tables_mode == LTM_LOCK_TABLES ||
+ thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES))
{
/*
- "we are under LOCK TABLES" <=> "we shouldn't commit".
- As thd->locked_tables is true, we are either under LOCK TABLES, or in
- prelocking; prelocking can be under LOCK TABLES, or not (and in this
- latter case only we should commit).
+ No commit inside LOCK TABLES.
+
Note that we come here only at the end of the top statement
(dispatch_command()), we are never committing inside a sub-statement./
*/
- enum prelocked_mode_type prelocked_mode= thd->prelocked_mode;
- if ((prelocked_mode == NON_PRELOCKED) ||
- (prelocked_mode == PRELOCKED_UNDER_LOCK_TABLES))
- {
- DBUG_PRINT("info", ("locked_tables, skipping"));
- DBUG_RETURN(0);
- }
+ DBUG_PRINT("info", ("locked_tables, skipping"));
+ DBUG_RETURN(0);
}
if ((trn= THD_TRN) != NULL)
{
@@ -2780,10 +2648,10 @@ THR_LOCK_DATA **ha_maria::store_lock(THD *thd,
that only does reading that are not SELECT.
*/
if (lock_type <= TL_READ_HIGH_PRIORITY &&
- !thd->current_stmt_binlog_row_based &&
+ !thd->is_current_stmt_binlog_format_row() &&
(sql_command != SQLCOM_SELECT &&
sql_command != SQLCOM_LOCK_TABLES) &&
- (thd->options & OPTION_BIN_LOG) &&
+ (thd->variables.option_bits & OPTION_BIN_LOG) &&
mysql_bin_log.is_open())
lock_type= TL_READ_NO_INSERT;
else if (lock_type == TL_WRITE_CONCURRENT_INSERT)
@@ -2953,7 +2821,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
0, (MARIA_UNIQUEDEF *) 0,
&create_info, create_flags);
- my_free((uchar*) recinfo, MYF(0));
+ my_free(recinfo);
DBUG_RETURN(error);
}
@@ -3111,7 +2979,7 @@ static int maria_commit(handlerton *hton __attribute__ ((unused)),
trnman_set_flags(trn, trnman_get_flags(trn) & ~TRN_STATE_INFO_LOGGED);
/* statement or transaction ? */
- if ((thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && !all)
+ if ((thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && !all)
DBUG_RETURN(0); // end of statement
DBUG_PRINT("info", ("THD_TRN set to 0x0"));
THD_TRN= 0;
@@ -3126,7 +2994,7 @@ static int maria_rollback(handlerton *hton __attribute__ ((unused)),
DBUG_ENTER("maria_rollback");
trnman_reset_locked_tables(trn, 0);
/* statement or transaction ? */
- if ((thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && !all)
+ if ((thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && !all)
{
trnman_rollback_statement(trn);
DBUG_RETURN(0); // end of statement
@@ -3335,6 +3203,11 @@ static int ha_maria_init(void *p)
int res;
copy_variable_aliases();
const char *log_dir= maria_data_root;
+
+#ifdef HAVE_PSI_INTERFACE
+ init_aria_psi_keys();
+#endif
+
maria_hton= (handlerton *)p;
maria_hton->state= SHOW_OPTION_YES;
maria_hton->db_type= DB_TYPE_UNKNOWN;
@@ -3589,9 +3462,9 @@ static void update_log_file_size(MYSQL_THD thd,
SHOW_VAR status_variables[]= {
- {"pagecache_blocks_not_flushed", (char*) &maria_pagecache_var.global_blocks_changed, SHOW_LONG_NOFLUSH},
- {"pagecache_blocks_unused", (char*) &maria_pagecache_var.blocks_unused, SHOW_LONG_NOFLUSH},
- {"pagecache_blocks_used", (char*) &maria_pagecache_var.blocks_used, SHOW_LONG_NOFLUSH},
+ {"pagecache_blocks_not_flushed", (char*) &maria_pagecache_var.global_blocks_changed, SHOW_LONG},
+ {"pagecache_blocks_unused", (char*) &maria_pagecache_var.blocks_unused, SHOW_LONG},
+ {"pagecache_blocks_used", (char*) &maria_pagecache_var.blocks_used, SHOW_LONG},
{"pagecache_read_requests", (char*) &maria_pagecache_var.global_cache_r_requests, SHOW_LONGLONG},
{"pagecache_reads", (char*) &maria_pagecache_var.global_cache_read, SHOW_LONGLONG},
{"pagecache_write_requests", (char*) &maria_pagecache_var.global_cache_w_requests, SHOW_LONGLONG},
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index 605ad1d3a20..1e540fd5e7b 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -1,3 +1,5 @@
+#ifndef HA_MARIA_INCLUDED
+#define HA_MARIA_INCLUDED
/* Copyright (C) 2006,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
@@ -13,9 +15,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifndef HA_MARIA_INCLUDED
-#define HA_MARIA_INCLUDED
-
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
@@ -23,6 +22,8 @@
/* class for the maria handler */
#include <maria.h>
+#include "handler.h"
+#include "table.h"
#define HA_RECOVER_NONE 0 /* No automatic recover */
#define HA_RECOVER_DEFAULT 1 /* Automatic recover active */
diff --git a/storage/maria/lockman.c b/storage/maria/lockman.c
index d6d4dcd44e6..56d2e261da4 100644
--- a/storage/maria/lockman.c
+++ b/storage/maria/lockman.c
@@ -541,7 +541,7 @@ void lockman_destroy(LOCKMAN *lm)
if (el->hashnr & 1)
lf_alloc_direct_free(&lm->alloc, el);
else
- my_free((void *)el, MYF(0));
+ my_free((void *)el);
el= (LOCK *)next;
}
lf_alloc_destroy(&lm->alloc);
@@ -571,7 +571,7 @@ static void initialize_bucket(LOCKMAN *lm, LOCK * volatile *node,
DBUG_ASSERT(res & (ALREADY_HAVE_THE_LOCK | RESOURCE_WAS_UNLOCKED));
if (res & ALREADY_HAVE_THE_LOCK)
{
- my_free((void *)dummy, MYF(0));
+ my_free((void *)dummy);
dummy= cur;
}
my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index c0763b0612d..83e0d276417 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -271,7 +271,7 @@ my_bool _ma_bitmap_end(MARIA_SHARE *share)
pthread_mutex_destroy(&share->bitmap.bitmap_lock);
pthread_cond_destroy(&share->bitmap.bitmap_cond);
delete_dynamic(&share->bitmap.pinned_pages);
- my_free(share->bitmap.map, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(share->bitmap.map);
share->bitmap.map= 0;
return res;
}
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index fd02e2ac0ec..df5a16d7efd 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -541,10 +541,10 @@ err:
void _ma_end_block_record(MARIA_HA *info)
{
DBUG_ENTER("_ma_end_block_record");
- my_free(info->cur_row.empty_bits, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(info->cur_row.empty_bits);
delete_dynamic(&info->bitmap_blocks);
- my_free(info->cur_row.extents, MYF(MY_ALLOW_ZERO_PTR));
- my_free(info->blob_buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(info->cur_row.extents);
+ my_free(info->blob_buff);
/*
The data file is closed, when needed, in ma_once_end_block_record().
The following protects us from doing an extra, not allowed, close
@@ -2787,8 +2787,7 @@ static my_bool write_block_record(MARIA_HA *info,
if (!*blob_lengths) /* Null or "" */
continue;
length= column->length - portable_sizeof_char_ptr;
- memcpy_fixed((uchar*) &tmp_pos, record + column->offset + length,
- sizeof(char*));
+ memcpy(&tmp_pos, record + column->offset + length, sizeof(char*));
memcpy(data, tmp_pos, *blob_lengths);
data+= *blob_lengths;
/*
@@ -2876,8 +2875,7 @@ static my_bool write_block_record(MARIA_HA *info,
{
uint length;
length= column->length - portable_sizeof_char_ptr;
- memcpy_fixed((uchar *) &blob_pos, record + column->offset + length,
- sizeof(char*));
+ memcpy(&blob_pos, record + column->offset + length, sizeof(char*));
length= *blob_lengths % FULL_PAGE_SIZE(block_size); /* tail size */
if (length != *blob_lengths)
blob_full_pages_exists= 1;
@@ -3235,8 +3233,7 @@ static my_bool write_block_record(MARIA_HA *info,
blob_length-= (blob_length % FULL_PAGE_SIZE(block_size));
if (blob_length)
{
- memcpy_fixed((uchar*) &log_array_pos->str,
- record + tmp_column->offset + length,
+ memcpy(&log_array_pos->str, record + tmp_column->offset + length,
sizeof(uchar*));
log_array_pos->length= blob_length;
log_entry_length+= blob_length;
@@ -3264,7 +3261,7 @@ static my_bool write_block_record(MARIA_HA *info,
(uint) (log_array_pos - log_array),
log_array, log_data, NULL);
if (log_array != tmp_log_array)
- my_free(log_array, MYF(0));
+ my_free(log_array);
if (error)
goto disk_err;
}
@@ -3401,8 +3398,7 @@ static my_bool write_block_record(MARIA_HA *info,
if (!*blob_lengths) /* Null or "" */
continue;
length= column->length - portable_sizeof_char_ptr;
- memcpy_fixed((uchar*) &blob_pos, record + column->offset + length,
- sizeof(char*));
+ memcpy(&blob_pos, record + column->offset + length, sizeof(char*));
/* remove tail part */
blob_length= *blob_lengths;
if (block[block->sub_blocks - 1].used & BLOCKUSED_TAIL)
@@ -4875,8 +4871,8 @@ int _ma_read_block_record2(MARIA_HA *info, uchar *record,
}
memcpy(field_pos, field_length_data, column_size_length);
- memcpy_fixed(field_pos + column_size_length, (uchar *) &blob_buffer,
- sizeof(char*));
+ memcpy(field_pos + column_size_length, (uchar *) &blob_buffer,
+ sizeof(char*));
field_length_data+= column_size_length;
/*
@@ -5116,7 +5112,7 @@ my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
error= _ma_unique_comp(def, record, old_record, def->null_are_equal);
if (info->s->base.blobs)
{
- my_free(info->rec_buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(info->rec_buff);
info->rec_buff= org_rec_buff;
info->rec_buff_size= org_rec_buff_size;
}
@@ -5180,11 +5176,11 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info)
void _ma_scan_end_block_record(MARIA_HA *info)
{
DBUG_ENTER("_ma_scan_end_block_record");
- my_free(info->scan.bitmap_buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(info->scan.bitmap_buff);
info->scan.bitmap_buff= 0;
if (info->scan_save)
{
- my_free(info->scan_save, MYF(0));
+ my_free(info->scan_save);
info->scan_save= 0;
}
DBUG_VOID_RETURN;
@@ -5706,8 +5702,8 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
if (blob_length)
{
uchar *blob_pos;
- memcpy_fixed(&blob_pos, record + column->offset + size_length,
- sizeof(blob_pos));
+ memcpy(&blob_pos, record + column->offset + size_length,
+ sizeof(blob_pos));
log_parts->str= blob_pos;
log_parts->length= blob_length;
row_length+= log_parts->length;
@@ -5889,15 +5885,13 @@ static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec,
{
uint size_length= column->length - portable_sizeof_char_ptr;
old_column_length= _ma_calc_blob_length(size_length, old_column_pos);
- memcpy_fixed((uchar*) &old_column_pos,
- oldrec + column->offset + size_length,
- sizeof(old_column_pos));
+ memcpy(&old_column_pos, oldrec + column->offset + size_length,
+ sizeof(old_column_pos));
if (!new_column_is_empty)
{
new_column_length= _ma_calc_blob_length(size_length, new_column_pos);
- memcpy_fixed((uchar*) &new_column_pos,
- newrec + column->offset + size_length,
- sizeof(old_column_pos));
+ memcpy(&new_column_pos, newrec + column->offset + size_length,
+ sizeof(old_column_pos));
}
break;
}
@@ -7119,7 +7113,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_HA *info, LSN undo_lsn,
&row_pos, undo_lsn, 0))
goto err;
- my_free(record, MYF(0));
+ my_free(record);
DBUG_RETURN(0);
err:
@@ -7127,7 +7121,7 @@ err:
if (info->non_flushable_state)
_ma_bitmap_flushable(info, -1);
_ma_unpin_all_pages_and_finalize_row(info, LSN_IMPOSSIBLE);
- my_free(record, MYF(0));
+ my_free(record);
DBUG_RETURN(1);
}
@@ -7265,7 +7259,7 @@ my_bool _ma_apply_undo_row_update(MARIA_HA *info, LSN undo_lsn,
{
uint size_length= column->length - portable_sizeof_char_ptr;
_ma_store_blob_length(orig_field_pos, size_length, field_length);
- memcpy_fixed(orig_field_pos + size_length, &header, sizeof(header));
+ memcpy(orig_field_pos + size_length, &header, sizeof(header));
header+= field_length;
break;
}
@@ -7294,7 +7288,7 @@ my_bool _ma_apply_undo_row_update(MARIA_HA *info, LSN undo_lsn,
error= 0;
end:
- my_free(current_record, MYF(0));
+ my_free(current_record);
DBUG_RETURN(error);
err:
diff --git a/storage/maria/ma_changed.c b/storage/maria/ma_changed.c
index 4d0964581f6..eb20db5669e 100644
--- a/storage/maria/ma_changed.c
+++ b/storage/maria/ma_changed.c
@@ -25,7 +25,7 @@ int maria_is_changed(MARIA_HA *info)
DBUG_ENTER("maria_is_changed");
if (fast_ma_readinfo(info))
DBUG_RETURN(-1);
- VOID(_ma_writeinfo(info,0));
+ _ma_writeinfo(info, 0);
result=(int) info->data_changed;
info->data_changed=0;
DBUG_PRINT("exit",("result: %d",result));
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 307befab5c7..41944753c98 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -1117,7 +1117,7 @@ static int check_keys_in_record(HA_CHECK *param, MARIA_HA *info, int extend,
if (param->testflag & T_WRITE_LOOP && param->records % WRITE_COUNT == 0)
{
printf("%s\r", llstr(param->records, llbuff));
- VOID(fflush(stdout));
+ fflush(stdout);
}
/* Check if keys match the record */
@@ -1471,9 +1471,9 @@ static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend,
start_recpos= pos;
param->splits++;
- VOID(_ma_pack_get_block_info(info, &info->bit_buff, &block_info,
+ _ma_pack_get_block_info(info, &info->bit_buff, &block_info,
&info->rec_buff, &info->rec_buff_size, -1,
- start_recpos));
+ start_recpos);
pos=block_info.filepos+block_info.rec_len;
if (block_info.rec_len < (uint) share->min_pack_length ||
block_info.rec_len > (uint) share->max_pack_length)
@@ -2054,7 +2054,8 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend)
if (param->testflag & T_WRITE_LOOP)
{
- VOID(fputs(" \r",stdout)); VOID(fflush(stdout));
+ fputs(" \r",stdout);
+ fflush(stdout);
}
if (param->records != share->state.state.records)
{
@@ -2185,11 +2186,11 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend)
llstr(param->max_found_trid, llbuff));
}
}
- my_free(record,MYF(0));
+ my_free(record);
DBUG_RETURN (error);
err:
- my_free(record,MYF(0));
+ my_free(record);
param->testflag|=T_RETRY_WITHOUT_QUICK;
DBUG_RETURN(1);
} /* maria_chk_data_link */
@@ -2678,7 +2679,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
if (param->testflag & T_WRITE_LOOP)
{
- VOID(fputs(" \r",stdout)); VOID(fflush(stdout));
+ fputs(" \r",stdout); fflush(stdout);
}
if (my_chsize(share->kfile.file, share->state.state.key_file_length, 0, MYF(0)))
{
@@ -2708,7 +2709,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
}
}
- VOID(end_io_cache(&sort_info.new_info->rec_cache));
+ end_io_cache(&sort_info.new_info->rec_cache);
info->opt_flag&= ~WRITE_CACHE_USED;
/*
@@ -2779,8 +2780,8 @@ err:
maria_scan_end(sort_info.info);
_ma_reset_state(info);
- VOID(end_io_cache(&param->read_cache));
- VOID(end_io_cache(&sort_info.new_info->rec_cache));
+ end_io_cache(&param->read_cache);
+ end_io_cache(&sort_info.new_info->rec_cache);
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
sort_info.new_info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
/* this below could fail, shouldn't we detect error? */
@@ -2797,8 +2798,8 @@ err:
}
if (new_file >= 0)
{
- VOID(my_close(new_file,MYF(0)));
- VOID(my_delete(param->temp_filename, MYF(MY_WME)));
+ my_close(new_file,MYF(0));
+ my_delete(param->temp_filename, MYF(MY_WME));
}
maria_mark_crashed_on_repair(info);
}
@@ -2807,9 +2808,9 @@ err:
_ma_reenable_logging_for_table(info, FALSE);
restore_table_state_after_repair(info, &backup_share);
- my_free(sort_param.rec_buff, MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sort_param.rec_buff);
+ my_free(sort_param.record);
+ my_free(sort_info.buff);
if (!got_error && (param->testflag & T_UNPACK))
restore_data_file_type(share);
share->state.changed|= (STATE_NOT_OPTIMIZED_KEYS | STATE_NOT_SORTED_PAGES |
@@ -3054,10 +3055,10 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name)
share->r_locks= share->w_locks= share->tot_locks= 0;
(void) _ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
pthread_mutex_lock(&share->intern_lock);
- VOID(my_close(share->kfile.file, MYF(MY_WME)));
+ my_close(share->kfile.file, MYF(MY_WME));
share->kfile.file = -1;
pthread_mutex_unlock(&share->intern_lock);
- VOID(my_close(new_file,MYF(MY_WME)));
+ my_close(new_file, MYF(MY_WME));
if (maria_change_to_newfile(share->index_file_name.str, MARIA_NAME_IEXT,
INDEX_TMP_EXT, sync_dir) ||
_ma_open_keyfile(share))
@@ -3090,9 +3091,9 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name)
DBUG_RETURN(0);
err:
- VOID(my_close(new_file,MYF(MY_WME)));
+ my_close(new_file, MYF(MY_WME));
err2:
- VOID(my_delete(param->temp_filename,MYF(MY_WME)));
+ my_delete(param->temp_filename,MYF(MY_WME));
DBUG_RETURN(-1);
} /* maria_sort_index */
@@ -3525,7 +3526,7 @@ int maria_filecopy(HA_CHECK *param, File to,File from,my_off_t start,
buff=tmp_buff; buff_length=IO_SIZE;
}
- VOID(my_seek(from,start,MY_SEEK_SET,MYF(0)));
+ my_seek(from, start, MY_SEEK_SET,MYF(0));
while (length > buff_length)
{
if (my_read(from, buff, buff_length, MYF(MY_NABP)) ||
@@ -3537,11 +3538,11 @@ int maria_filecopy(HA_CHECK *param, File to,File from,my_off_t start,
my_write(to, buff, (size_t) length,param->myf_rw))
goto err;
if (buff != tmp_buff)
- my_free(buff,MYF(0));
+ my_free(buff);
DBUG_RETURN(0);
err:
if (buff != tmp_buff)
- my_free(buff,MYF(0));
+ my_free(buff);
_ma_check_print_error(param,"Can't copy %s to tempfile, error %d",
type,my_errno);
DBUG_RETURN(1);
@@ -3902,7 +3903,8 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
if (param->testflag & T_WRITE_LOOP)
{
- VOID(fputs(" \r",stdout)); VOID(fflush(stdout));
+ fputs(" \r",stdout);
+ fflush(stdout);
}
if (rep_quick && del+sort_info.dupp != share->state.state.del)
@@ -3961,8 +3963,8 @@ err:
maria_scan_end(sort_info.info);
_ma_reset_state(info);
- VOID(end_io_cache(&sort_info.new_info->rec_cache));
- VOID(end_io_cache(&param->read_cache));
+ end_io_cache(&sort_info.new_info->rec_cache);
+ end_io_cache(&param->read_cache);
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
sort_info.new_info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
if (got_error)
@@ -3977,8 +3979,8 @@ err:
}
if (new_file >= 0)
{
- VOID(my_close(new_file,MYF(0)));
- VOID(my_delete(param->temp_filename, MYF(MY_WME)));
+ my_close(new_file, MYF(0));
+ my_delete(param->temp_filename, MYF(MY_WME));
}
maria_mark_crashed_on_repair(info);
}
@@ -4011,11 +4013,11 @@ err:
_ma_reenable_logging_for_table(info, FALSE);
restore_table_state_after_repair(info, &backup_share);
- my_free(sort_param.rec_buff, MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_info.key_block, MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sort_param.rec_buff);
+ my_free(sort_param.record);
+ my_free(sort_info.key_block);
+ my_free(sort_info.ft_buf);
+ my_free(sort_info.buff);
DBUG_RETURN(got_error);
}
@@ -4480,8 +4482,8 @@ err:
the share by remove_io_thread() or it was not yet started (if the
error happend before creating the thread).
*/
- VOID(end_io_cache(&sort_info.new_info->rec_cache));
- VOID(end_io_cache(&param->read_cache));
+ end_io_cache(&sort_info.new_info->rec_cache);
+ end_io_cache(&param->read_cache);
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
sort_info.new_info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
/*
@@ -4491,7 +4493,7 @@ err:
creating the threads).
*/
if (!rep_quick)
- VOID(end_io_cache(&new_data_cache));
+ end_io_cache(&new_data_cache);
if (!got_error)
{
/* Replace the actual file with the temporary file */
@@ -4515,8 +4517,8 @@ err:
(void)_ma_flush_table_files_before_swap(param, info);
if (new_file >= 0)
{
- VOID(my_close(new_file,MYF(0)));
- VOID(my_delete(param->temp_filename, MYF(MY_WME)));
+ my_close(new_file,MYF(0));
+ my_delete(param->temp_filename, MYF(MY_WME));
if (info->dfile.file == new_file)
info->dfile.file= -1;
}
@@ -4537,10 +4539,10 @@ err:
_ma_reenable_logging_for_table(info, FALSE);
restore_table_state_after_repair(info, &backup_share);
- my_free(sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_param,MYF(MY_ALLOW_ZERO_PTR));
- my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sort_info.ft_buf);
+ my_free(sort_info.key_block);
+ my_free(sort_param);
+ my_free(sort_info.buff);
if (!got_error && (param->testflag & T_UNPACK))
restore_data_file_type(share);
DBUG_RETURN(got_error);
@@ -5319,7 +5321,7 @@ int _ma_sort_write_record(MARIA_SORT_PARAM *sort_param)
{
char llbuff[22];
printf("%s\r", llstr(share->state.state.records,llbuff));
- VOID(fflush(stdout));
+ fflush(stdout);
}
}
DBUG_RETURN(0);
@@ -5937,7 +5939,7 @@ int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename)
set_if_bigger(file_length,tmp_length);
set_if_bigger(file_length,(ulonglong) share.base.max_data_file_length);
- VOID(maria_close(*org_info));
+ maria_close(*org_info);
bzero((char*) &create_info,sizeof(create_info));
create_info.max_rows=max(max_records,share.base.records);
@@ -5993,7 +5995,7 @@ int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename)
}
/* We are modifing */
(*org_info)->s->options&= ~HA_OPTION_READ_ONLY_DATA;
- VOID(_ma_readinfo(*org_info,F_WRLCK,0));
+ _ma_readinfo(*org_info,F_WRLCK,0);
(*org_info)->s->state.state.records= info.state->records;
if (share.state.create_time)
(*org_info)->s->state.create_time=share.state.create_time;
@@ -6146,7 +6148,7 @@ void _ma_update_auto_increment_key(HA_CHECK *param, MARIA_HA *info,
if (my_errno != HA_ERR_END_OF_FILE)
{
maria_extra(info,HA_EXTRA_NO_KEYREAD,0);
- my_free((char*) record, MYF(0));
+ my_free(record);
_ma_check_print_error(param,"%d when reading last record",my_errno);
DBUG_VOID_RETURN;
}
@@ -6163,7 +6165,7 @@ void _ma_update_auto_increment_key(HA_CHECK *param, MARIA_HA *info,
set_if_bigger(share->state.auto_increment, param->auto_increment_value);
}
maria_extra(info,HA_EXTRA_NO_KEYREAD,0);
- my_free((char*) record, MYF(0));
+ my_free(record);
maria_update_state_info(param, info, UPDATE_AUTO_INC);
DBUG_VOID_RETURN;
}
diff --git a/storage/maria/ma_check_standalone.h b/storage/maria/ma_check_standalone.h
index 8cda285bb99..d692b2de94c 100644
--- a/storage/maria/ma_check_standalone.h
+++ b/storage/maria/ma_check_standalone.h
@@ -13,6 +13,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/* almost every standalone maria program will need it */
+void _mi_report_crashed(void *file __attribute__((unused)),
+ const char *message __attribute__((unused)),
+ const char *sfile __attribute__((unused)),
+ uint sline __attribute__((unused)))
+{
+}
+
+/* only those that included myisamchk.h may need and can use the below */
+#ifdef _myisamchk_h
/*
All standalone programs which need to use functions from ma_check.c
(like maria_repair()) must define their version of _ma_killed_ptr()
@@ -46,8 +56,8 @@ void _ma_check_print_info(HA_CHECK *param __attribute__((unused)),
DBUG_PRINT("enter", ("format: %s", fmt));
va_start(args,fmt);
- VOID(vfprintf(stdout, fmt, args));
- VOID(fputc('\n',stdout));
+ vfprintf(stdout, fmt, args);
+ fputc('\n',stdout);
va_end(args);
DBUG_VOID_RETURN;
}
@@ -71,8 +81,8 @@ void _ma_check_print_warning(HA_CHECK *param, const char *fmt,...)
param->warning_printed=1;
va_start(args,fmt);
fprintf(stderr,"%s: warning: ",my_progname_short);
- VOID(vfprintf(stderr, fmt, args));
- VOID(fputc('\n',stderr));
+ vfprintf(stderr, fmt, args);
+ fputc('\n',stderr);
fflush(stderr);
va_end(args);
DBUG_VOID_RETURN;
@@ -96,9 +106,11 @@ void _ma_check_print_error(HA_CHECK *param, const char *fmt,...)
param->error_printed|=1;
va_start(args,fmt);
fprintf(stderr,"%s: error: ",my_progname_short);
- VOID(vfprintf(stderr, fmt, args));
- VOID(fputc('\n',stderr));
+ vfprintf(stderr, fmt, args);
+ fputc('\n',stderr);
fflush(stderr);
va_end(args);
DBUG_VOID_RETURN;
}
+#endif
+
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c
index cf13cee9452..7a0c89b1a15 100644
--- a/storage/maria/ma_checkpoint.c
+++ b/storage/maria/ma_checkpoint.c
@@ -290,7 +290,7 @@ err:
end:
for (i= 0; i < (sizeof(record_pieces)/sizeof(record_pieces[0])); i++)
- my_free(record_pieces[i].str, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(record_pieces[i].str);
pthread_mutex_lock(&LOCK_checkpoint);
checkpoint_in_progress= CHECKPOINT_NONE;
checkpoints_total++;
@@ -428,8 +428,8 @@ void ma_checkpoint_end(void)
if (checkpoint_control.inited)
{
ma_service_thread_control_end(&checkpoint_control);
- my_free((uchar *)dfiles, MYF(MY_ALLOW_ZERO_PTR));
- my_free((uchar *)kfiles, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(dfiles);
+ my_free(kfiles);
dfiles= kfiles= NULL;
}
DBUG_VOID_RETURN;
@@ -1067,7 +1067,7 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
pthread_mutex_destroy(&share->intern_lock);
pthread_mutex_unlock(&share->close_lock);
pthread_mutex_destroy(&share->close_lock);
- my_free((uchar *)share, MYF(0));
+ my_free(share);
}
else
{
@@ -1180,7 +1180,7 @@ err:
{
/* maria_close() left us to free the share */
pthread_mutex_destroy(&share->intern_lock);
- my_free((uchar *)share, MYF(0));
+ my_free(share);
}
else
{
@@ -1190,7 +1190,7 @@ err:
}
pthread_mutex_unlock(&THR_LOCK_maria);
}
- my_free((uchar *)distinct_shares, MYF(MY_ALLOW_ZERO_PTR));
- my_free((uchar *)state_copies, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(distinct_shares);
+ my_free(state_copies);
DBUG_RETURN(error);
}
diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c
index df525d45d14..2da40dcb8f6 100644
--- a/storage/maria/ma_close.c
+++ b/storage/maria/ma_close.c
@@ -64,7 +64,7 @@ int maria_close(register MARIA_HA *info)
flag= !--share->reopen;
maria_open_list=list_delete(maria_open_list,&info->open_list);
- my_free(info->rec_buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(info->rec_buff);
(*share->end)(info);
if (flag)
@@ -119,9 +119,9 @@ int maria_close(register MARIA_HA *info)
{
int i,keys;
keys = share->state.header.keys;
- VOID(rwlock_destroy(&share->mmap_lock));
+ rwlock_destroy(&share->mmap_lock);
for(i=0; i<keys; i++) {
- VOID(rwlock_destroy(&share->keyinfo[i].root_lock));
+ rwlock_destroy(&share->keyinfo[i].root_lock);
}
}
#endif
@@ -164,7 +164,7 @@ int maria_close(register MARIA_HA *info)
history->create_rename_lsn= share->state.create_rename_lsn;
history->state_history= share->state_history;
if (my_hash_insert(&maria_stored_state, (uchar*) history))
- my_free(history, MYF(0));
+ my_free(history);
}
/* Marker for concurrent checkpoint */
share->state_history= 0;
@@ -178,14 +178,14 @@ int maria_close(register MARIA_HA *info)
(void) pthread_mutex_destroy(&share->intern_lock);
(void) pthread_mutex_destroy(&share->close_lock);
(void) pthread_cond_destroy(&share->key_del_cond);
- my_free((uchar *)share, MYF(0));
+ my_free(share);
/*
If share cannot be freed, it's because checkpoint has previously
recorded to include this share in the checkpoint and so is soon going to
look at some of its content (share->in_checkpoint/id/last_version).
*/
}
- my_free(info->ftparser_param, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(info->ftparser_param);
if (info->dfile.file >= 0)
{
/*
@@ -197,7 +197,7 @@ int maria_close(register MARIA_HA *info)
}
delete_dynamic(&info->pinned_pages);
- my_free(info, MYF(0));
+ my_free(info);
if (error)
{
diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c
index 9cf042ed21e..d544e019932 100644
--- a/storage/maria/ma_create.c
+++ b/storage/maria/ma_create.c
@@ -841,7 +841,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
*/
if (_ma_test_if_reopen(filename))
{
- my_printf_error(0, "Aria table '%s' is in use "
+ my_printf_error(HA_ERR_TABLE_EXIST, "Aria table '%s' is in use "
"(most likely by a MERGE table). Try FLUSH TABLES.",
MYF(0), name + dirname_length(name));
my_errno= HA_ERR_TABLE_EXIST;
@@ -966,11 +966,11 @@ int maria_create(const char *name, enum data_file_type datafile_type,
column_array[col_order[i]->column_nr]= i;
if (_ma_columndef_write(file, col_order[i]))
{
- my_free(col_order, MYF(0));
+ my_free(col_order);
goto err;
}
}
- my_free(col_order, MYF(0));
+ my_free(col_order);
}
else
{
@@ -1086,7 +1086,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
if (_ma_update_state_lsns_sub(&share, lsn, trnman_get_min_safe_trid(),
FALSE, TRUE))
goto err;
- my_free(log_data, MYF(0));
+ my_free(log_data);
}
if (!(flags & HA_DONT_TOUCH_DATA))
@@ -1155,7 +1155,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
}
pthread_mutex_unlock(&THR_LOCK_maria);
res= 0;
- my_free((char*) rec_per_key_part,MYF(0));
+ my_free((char*) rec_per_key_part);
errpos=0;
if (my_close(file,MYF(0)))
res= my_errno;
@@ -1168,7 +1168,7 @@ err_no_lock:
save_errno=my_errno;
switch (errpos) {
case 3:
- VOID(my_close(dfile,MYF(0)));
+ my_close(dfile, MYF(0));
/* fall through */
case 2:
if (! (flags & HA_DONT_TOUCH_DATA))
@@ -1177,14 +1177,14 @@ err_no_lock:
sync_dir);
/* fall through */
case 1:
- VOID(my_close(file,MYF(0)));
+ my_close(file, MYF(0));
if (! (flags & HA_DONT_TOUCH_DATA))
my_delete_with_symlink(fn_format(filename,name,"",MARIA_NAME_IEXT,
MY_UNPACK_FILENAME | MY_APPEND_EXT),
sync_dir);
}
- my_free(log_data, MYF(MY_ALLOW_ZERO_PTR));
- my_free((char*) rec_per_key_part, MYF(0));
+ my_free(log_data);
+ my_free(rec_per_key_part);
DBUG_RETURN(my_errno=save_errno); /* return the fatal errno */
}
diff --git a/storage/maria/ma_dbug.c b/storage/maria/ma_dbug.c
index af90a108e2a..c8c928dd097 100644
--- a/storage/maria/ma_dbug.c
+++ b/storage/maria/ma_dbug.c
@@ -36,12 +36,12 @@ void _ma_print_keydata(FILE *stream, register HA_KEYSEG *keyseg,
const uchar *end;
const uchar *key_end= key + length;
- VOID(fputs("Key: \"",stream));
+ fputs("Key: \"",stream);
flag=0;
for (; keyseg->type && key < key_end ;keyseg++)
{
if (flag++)
- VOID(putc('-',stream));
+ putc('-',stream);
end= key+ keyseg->length;
if (keyseg->flag & HA_NULL_PART)
{
@@ -58,7 +58,7 @@ void _ma_print_keydata(FILE *stream, register HA_KEYSEG *keyseg,
case HA_KEYTYPE_BINARY:
if (!(keyseg->flag & HA_SPACE_PACK) && keyseg->length == 1)
{ /* packed binary digit */
- VOID(fprintf(stream,"%d",(uint) *key++));
+ fprintf(stream,"%d",(uint) *key++);
break;
}
/* fall through */
@@ -66,58 +66,58 @@ void _ma_print_keydata(FILE *stream, register HA_KEYSEG *keyseg,
case HA_KEYTYPE_NUM:
if (keyseg->flag & HA_SPACE_PACK)
{
- VOID(fprintf(stream,"%.*s",(int) *key,key+1));
+ fprintf(stream,"%.*s",(int) *key,key+1);
key+= (int) *key+1;
}
else
{
- VOID(fprintf(stream,"%.*s",(int) keyseg->length,key));
+ fprintf(stream,"%.*s",(int) keyseg->length,key);
key=end;
}
break;
case HA_KEYTYPE_INT8:
- VOID(fprintf(stream,"%d",(int) *((const signed char*) key)));
+ fprintf(stream,"%d",(int) *((const signed char*) key));
key=end;
break;
case HA_KEYTYPE_SHORT_INT:
s_1= mi_sint2korr(key);
- VOID(fprintf(stream,"%d",(int) s_1));
+ fprintf(stream,"%d",(int) s_1);
key=end;
break;
case HA_KEYTYPE_USHORT_INT:
{
ushort u_1;
u_1= mi_uint2korr(key);
- VOID(fprintf(stream,"%u",(uint) u_1));
+ fprintf(stream,"%u",(uint) u_1);
key=end;
break;
}
case HA_KEYTYPE_LONG_INT:
l_1=mi_sint4korr(key);
- VOID(fprintf(stream,"%ld",l_1));
+ fprintf(stream,"%ld",l_1);
key=end;
break;
case HA_KEYTYPE_ULONG_INT:
l_1=mi_uint4korr(key);
- VOID(fprintf(stream,"%lu",(ulong) l_1));
+ fprintf(stream,"%lu",(ulong) l_1);
key=end;
break;
case HA_KEYTYPE_INT24:
- VOID(fprintf(stream,"%ld",(long) mi_sint3korr(key)));
+ fprintf(stream,"%ld",(long) mi_sint3korr(key));
key=end;
break;
case HA_KEYTYPE_UINT24:
- VOID(fprintf(stream,"%lu",(ulong) mi_uint3korr(key)));
+ fprintf(stream,"%lu",(ulong) mi_uint3korr(key));
key=end;
break;
case HA_KEYTYPE_FLOAT:
mi_float4get(f_1,key);
- VOID(fprintf(stream,"%g",(double) f_1));
+ fprintf(stream,"%g",(double) f_1);
key=end;
break;
case HA_KEYTYPE_DOUBLE:
mi_float8get(d_1,key);
- VOID(fprintf(stream,"%g",d_1));
+ fprintf(stream,"%g",d_1);
key=end;
break;
#ifdef HAVE_LONG_LONG
@@ -125,7 +125,7 @@ void _ma_print_keydata(FILE *stream, register HA_KEYSEG *keyseg,
{
char buff[21];
longlong10_to_str(mi_sint8korr(key),buff,-10);
- VOID(fprintf(stream,"%s",buff));
+ fprintf(stream,"%s",buff);
key=end;
break;
}
@@ -133,7 +133,7 @@ void _ma_print_keydata(FILE *stream, register HA_KEYSEG *keyseg,
{
char buff[21];
longlong10_to_str(mi_sint8korr(key),buff,10);
- VOID(fprintf(stream,"%s",buff));
+ fprintf(stream,"%s",buff);
key=end;
break;
}
@@ -158,14 +158,14 @@ void _ma_print_keydata(FILE *stream, register HA_KEYSEG *keyseg,
The following command sometimes gives a warning from valgrind.
Not yet sure if the bug is in valgrind, glibc or mysqld
*/
- VOID(fprintf(stream,"%.*s",(int) tmp_length,key));
+ fprintf(stream,"%.*s",(int) tmp_length,key);
key+=tmp_length;
break;
}
default: break; /* This never happens */
}
}
- VOID(fputs("\"\n",stream));
+ fputs("\"\n",stream);
return;
} /* print_key */
diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c
index 5c04f358b14..2c13ddfe5bb 100644
--- a/storage/maria/ma_delete.c
+++ b/storage/maria/ma_delete.c
@@ -117,7 +117,7 @@ int maria_delete(MARIA_HA *info,const uchar *record)
info->state->changed=1;
mi_sizestore(lastpos, info->cur_row.lastpos);
- VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
+ _ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0)
{
@@ -140,7 +140,7 @@ err:
maria_print_error(share, HA_ERR_CRASHED);
maria_mark_crashed(info); /* mark table crashed */
}
- VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
+ _ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
info->update|=HA_STATE_WRITTEN; /* Buffer changed */
allow_break(); /* Allow SIGHUP & SIGINT */
if (save_errno == HA_ERR_KEY_NOT_FOUND)
@@ -170,8 +170,6 @@ my_bool _ma_ck_delete(MARIA_HA *info, MARIA_KEY *key)
MARIA_KEY org_key;
DBUG_ENTER("_ma_ck_delete");
- LINT_INIT_STRUCT(org_key);
-
save_key_data= key->data;
if (share->now_transactional)
{
diff --git a/storage/maria/ma_delete_all.c b/storage/maria/ma_delete_all.c
index 4661ea0ab59..2eb966bd7a7 100644
--- a/storage/maria/ma_delete_all.c
+++ b/storage/maria/ma_delete_all.c
@@ -132,7 +132,7 @@ int maria_delete_all_rows(MARIA_HA *info)
goto err;
}
- VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
+ _ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
#ifdef HAVE_MMAP
/* Map again */
if (share->file_map)
@@ -144,7 +144,7 @@ int maria_delete_all_rows(MARIA_HA *info)
err:
{
int save_errno=my_errno;
- VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
+ _ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
info->update|=HA_STATE_WRITTEN; /* Buffer changed */
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(my_errno=save_errno);
diff --git a/storage/maria/ma_dynrec.c b/storage/maria/ma_dynrec.c
index 57b76b713f4..6668d0e5f3d 100644
--- a/storage/maria/ma_dynrec.c
+++ b/storage/maria/ma_dynrec.c
@@ -41,7 +41,7 @@ static my_bool _ma_cmp_buffer(File file, const uchar *buff, my_off_t filepos,
#undef my_alloca
#undef my_afree
#define my_alloca(A) my_malloc((A),MYF(0))
-#define my_afree(A) my_free((A),MYF(0))
+#define my_afree(A) my_free((A))
#endif
/* Interface function from MARIA_HA */
@@ -109,8 +109,8 @@ void _ma_remap_file(MARIA_HA *info, my_off_t size)
{
if (info->s->file_map)
{
- VOID(my_munmap((char*) info->s->file_map,
- (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN));
+ my_munmap((char*) info->s->file_map,
+ (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN);
_ma_dynmap_file(info, size);
}
}
@@ -981,7 +981,7 @@ uint _ma_rec_pack(MARIA_HA *info, register uchar *to,
char *temp_pos;
size_t tmp_length=length-portable_sizeof_char_ptr;
memcpy(to,from,tmp_length);
- memcpy_fixed(&temp_pos,from+tmp_length,sizeof(char*));
+ memcpy(&temp_pos,from+tmp_length,sizeof(char*));
memcpy(to+tmp_length,temp_pos,(size_t) blob->length);
to+=tmp_length+blob->length;
}
@@ -1315,7 +1315,7 @@ ulong _ma_rec_unpack(register MARIA_HA *info, register uchar *to, uchar *from,
goto err;
memcpy(to, from, (size_t) size_length);
from+=size_length;
- memcpy_fixed(to+size_length,(uchar*) &from,sizeof(char*));
+ memcpy(to+size_length,(uchar*) &from,sizeof(char*));
from+=blob_length;
}
else
@@ -1576,7 +1576,7 @@ my_bool _ma_cmp_dynamic_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
error=_ma_unique_comp(def, record, old_record, def->null_are_equal) != 0;
if (info->s->base.blobs)
{
- my_free(info->rec_buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(info->rec_buff);
info->rec_buff= old_rec_buff;
info->rec_buff_size= old_rec_buff_size;
}
@@ -1920,7 +1920,7 @@ uint _ma_get_block_info(MARIA_BLOCK_INFO *info, File file, my_off_t filepos)
pointer set to the end of the header after this function.
my_pread() may leave the file pointer untouched.
*/
- VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
+ my_seek(file,filepos,MY_SEEK_SET,MYF(0));
if (my_read(file, header, sizeof(info->header),MYF(0)) !=
sizeof(info->header))
goto err;
diff --git a/storage/maria/ma_ft_boolean_search.c b/storage/maria/ma_ft_boolean_search.c
index 0783f679843..10df277510d 100644
--- a/storage/maria/ma_ft_boolean_search.c
+++ b/storage/maria/ma_ft_boolean_search.c
@@ -180,7 +180,7 @@ typedef struct st_my_ftb_param
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, mysql_ft_size_t word_len,
+ const char *word, int word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -227,7 +227,7 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
if (! ftb_param->up_quot) break;
phrase_word= (FT_WORD *)alloc_root(&ftb_param->ftb->mem_root, sizeof(FT_WORD));
tmp_element= (LIST *)alloc_root(&ftb_param->ftb->mem_root, sizeof(LIST));
- phrase_word->pos= (uchar*) word;
+ phrase_word->pos= (uchar*)word;
phrase_word->len= word_len;
tmp_element->data= (void *)phrase_word;
ftb_param->ftbe->phrase= list_add(ftb_param->ftbe->phrase, tmp_element);
@@ -253,7 +253,7 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
if (info->yesno > 0) ftbe->up->ythresh++;
ftb_param->ftbe= ftbe;
ftb_param->depth++;
- ftb_param->up_quot= (uchar*) info->quot;
+ ftb_param->up_quot= (uchar*)info->quot;
break;
case FT_TOKEN_RIGHT_PAREN:
if (ftb_param->ftbe->document)
@@ -282,24 +282,24 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *query, mysql_ft_size_t len)
+ const char *query, int len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
CHARSET_INFO *cs= ftb_param->ftb->charset;
- const uchar **start= &query;
- const uchar *end= query + len;
+ const uchar **start= (const uchar**) &query;
+ uchar *end= (uchar*) query + len;
FT_WORD w;
info.prev= ' ';
info.quot= 0;
while (maria_ft_get_word(cs, start, end, &w, &info))
- param->mysql_add_word(param, w.pos, w.len, &info);
+ param->mysql_add_word(param, (char*)w.pos, w.len, &info);
return(0);
}
-static int _ftb_parse_query(FTB *ftb, uchar *query, size_t len,
+static int _ftb_parse_query(FTB *ftb, uchar *query, uint len,
struct st_mysql_ftparser *parser)
{
MYSQL_FTPARSER_PARAM *param;
@@ -321,7 +321,7 @@ static int _ftb_parse_query(FTB *ftb, uchar *query, size_t len,
param->mysql_add_word= ftb_query_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= query;
+ param->doc= (char*)query;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO;
@@ -540,7 +540,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr,
- uchar *query, size_t query_len,
+ uchar *query, uint query_len,
CHARSET_INFO *cs)
{
FTB *ftb;
@@ -599,7 +599,7 @@ FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr,
return ftb;
err:
free_root(& ftb->mem_root, MYF(0));
- my_free(ftb, MYF(0));
+ my_free(ftb);
return 0;
}
@@ -616,14 +616,14 @@ typedef struct st_my_ftb_phrase_param
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, mysql_ft_size_t word_len,
+ const char *word, int word_len,
MYSQL_FTPARSER_BOOLEAN_INFO
*boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
FT_WORD *w= (FT_WORD *)phrase_param->document->data;
LIST *phrase, *document;
- w->pos= (uchar*) word;
+ w->pos= (uchar*)word;
w->len= word_len;
phrase_param->document= phrase_param->document->prev;
if (phrase_param->phrase_length > phrase_param->document_length)
@@ -649,16 +649,15 @@ static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *document,
- mysql_ft_size_t len)
+ const char *document, int len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
- const uchar *docend= document + len;
- while (maria_ft_simple_get_word(phrase_param->cs, &document,
+ const uchar *docend= (uchar*)document + len;
+ while (maria_ft_simple_get_word(phrase_param->cs, (uchar**)&document,
docend, &word, FALSE))
{
- param->mysql_add_word(param, word.pos, word.len, 0);
+ param->mysql_add_word(param, (char*)word.pos, word.len, 0);
if (phrase_param->match)
break;
}
@@ -681,7 +680,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
-1 is returned if error occurs.
*/
-static int _ftb_check_phrase(FTB *ftb, const uchar *document, size_t len,
+static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
{
MY_FTB_PHRASE_PARAM ftb_param;
@@ -702,7 +701,7 @@ static int _ftb_check_phrase(FTB *ftb, const uchar *document, size_t len,
param->mysql_add_word= ftb_phrase_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= document;
+ param->doc= (char *)document;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
@@ -851,7 +850,7 @@ int maria_ft_boolean_read_next(FT_INFO *ftb, char *record)
{
info->update|= HA_STATE_AKTIV; /* Record is read */
if (ftb->with_scan &&
- maria_ft_boolean_find_relevance(ftb, (uchar *) record, 0)==0)
+ maria_ft_boolean_find_relevance(ftb, (uchar*)record, 0)==0)
continue; /* no match */
my_errno=0;
goto err;
@@ -875,7 +874,7 @@ typedef struct st_my_ftb_find_param
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, mysql_ft_size_t len,
+ const char *word, int len,
MYSQL_FTPARSER_BOOLEAN_INFO
*boolean_info __attribute__((unused)))
{
@@ -937,14 +936,14 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc, mysql_ft_size_t len)
+ const char *doc, int len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
- const uchar *end= doc + len;
+ uchar *end= (uchar*) doc + len;
FT_WORD w;
- while (maria_ft_simple_get_word(ftb->charset, &doc, end, &w, TRUE))
- param->mysql_add_word(param, w.pos, w.len, 0);
+ while (maria_ft_simple_get_word(ftb->charset, (uchar**)&doc, end, &w, TRUE))
+ param->mysql_add_word(param, (char*)w.pos, w.len, 0);
return(0);
}
@@ -1001,7 +1000,7 @@ float maria_ft_boolean_find_relevance(FT_INFO *ftb, uchar *record, uint length)
{
if (!ftsi.pos)
continue;
- param->doc= ftsi.pos;
+ param->doc= (char *)ftsi.pos;
param->length= ftsi.len;
if (unlikely(parser->parse(param)))
return 0;
@@ -1026,7 +1025,7 @@ void maria_ft_boolean_close_search(FT_INFO *ftb)
delete_tree(& ftb->no_dupes);
}
free_root(& ftb->mem_root, MYF(0));
- my_free(ftb, MYF(0));
+ my_free(ftb);
}
diff --git a/storage/maria/ma_ft_nlq_search.c b/storage/maria/ma_ft_nlq_search.c
index 3bb7defcaaf..26fd4fcf5eb 100644
--- a/storage/maria/ma_ft_nlq_search.c
+++ b/storage/maria/ma_ft_nlq_search.c
@@ -203,12 +203,12 @@ 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);
+ return CMP_NUM(b->weight, a->weight);
}
FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
- size_t query_len, uint flags, uchar *record)
+ uint query_len, uint flags, uchar *record)
{
TREE wtree;
ALL_IN_ONE aio;
@@ -363,7 +363,7 @@ float maria_ft_nlq_find_relevance(FT_INFO *handler,
void maria_ft_nlq_close_search(FT_INFO *handler)
{
- my_free(handler, MYF(0));
+ my_free(handler);
}
diff --git a/storage/maria/ma_ft_parser.c b/storage/maria/ma_ft_parser.c
index b35c2227ca2..3dd6fab5214 100644
--- a/storage/maria/ma_ft_parser.c
+++ b/storage/maria/ma_ft_parser.c
@@ -41,7 +41,7 @@ static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat)
{
word->weight=LWS_IN_USE;
docstat->sum+=word->weight;
- memcpy_fixed((docstat->list)++,word,sizeof(FT_WORD));
+ memcpy((docstat->list)++, word, sizeof(FT_WORD));
return 0;
}
@@ -204,11 +204,11 @@ ret:
return param->type;
}
-uchar maria_ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
+uchar maria_ft_simple_get_word(CHARSET_INFO *cs, uchar **start,
const uchar *end, FT_WORD *word,
my_bool skip_stopwords)
{
- const uchar *doc= *start;
+ uchar *doc= *start;
uint mwc, length;
int ctype, mbl;
DBUG_ENTER("maria_ft_simple_get_word");
@@ -261,7 +261,7 @@ void maria_ft_parse_init(TREE *wtree, CHARSET_INFO *cs)
static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, mysql_ft_size_t word_len,
+ const char *word, int word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
__attribute__((unused)))
{
@@ -279,7 +279,7 @@ static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
w.pos= ptr;
}
else
- w.pos= word;
+ w.pos= (uchar*) word;
w.len= word_len;
if (!tree_insert(wtree, &w, 0, wtree->custom_arg))
{
@@ -291,24 +291,24 @@ static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc_arg,
- mysql_ft_size_t doc_len)
+ const char *doc_arg,
+ int doc_len)
{
- const uchar *doc= doc_arg;
- const uchar *end= doc + doc_len;
+ uchar *doc= (uchar*) doc_arg;
+ uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
DBUG_ENTER("maria_ft_parse_internal");
while (maria_ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE))
- if (param->mysql_add_word(param, w.pos, w.len, 0))
+ if (param->mysql_add_word(param, (char*)w.pos, w.len, 0))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
-int maria_ft_parse(TREE *wtree, uchar *doc, size_t doclen,
+int maria_ft_parse(TREE *wtree, uchar *doc, int doclen,
struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
@@ -322,7 +322,7 @@ int maria_ft_parse(TREE *wtree, uchar *doc, size_t doclen,
param->mysql_add_word= maria_ft_add_word;
param->mysql_ftparam= &my_param;
param->cs= wtree->custom_arg;
- param->doc= doc;
+ param->doc= (char*)doc;
param->length= doclen;
param->mode= MYSQL_FTPARSER_SIMPLE_MODE;
DBUG_RETURN(parser->parse(param));
@@ -382,8 +382,8 @@ MYSQL_FTPARSER_PARAM *maria_ftparser_call_initializer(MARIA_HA *info,
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, const uchar *,
- mysql_ft_size_t, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
+ (int (*)(struct st_mysql_ftparser_param *, const char *,
+ int, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
}
diff --git a/storage/maria/ma_ft_update.c b/storage/maria/ma_ft_update.c
index f38990efab9..3e47f09c1fa 100644
--- a/storage/maria/ma_ft_update.c
+++ b/storage/maria/ma_ft_update.c
@@ -83,8 +83,7 @@ uint _ma_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
if (ftsi->seg->flag & HA_BLOB_PART)
{
ftsi->len= _ma_calc_blob_length(ftsi->seg->bit_start,ftsi->pos);
- memcpy_fixed((char*) &ftsi->pos, ftsi->pos+ftsi->seg->bit_start,
- sizeof(char*));
+ memcpy(&ftsi->pos, ftsi->pos+ftsi->seg->bit_start, sizeof(char*));
DBUG_RETURN(1);
}
ftsi->len=ftsi->seg->length;
diff --git a/storage/maria/ma_ftdefs.h b/storage/maria/ma_ftdefs.h
index 4ce4e9e22ba..9ec3d344e8c 100644
--- a/storage/maria/ma_ftdefs.h
+++ b/storage/maria/ma_ftdefs.h
@@ -101,14 +101,14 @@ typedef struct st_maria_ft_word {
double weight;
} FT_WORD;
-int is_stopword(char *word, uint len);
+int is_stopword(const char *word, size_t len);
MARIA_KEY *_ma_ft_make_key(MARIA_HA *, MARIA_KEY *, uint , uchar *, FT_WORD *,
my_off_t);
uchar maria_ft_get_word(CHARSET_INFO *, const uchar **, const uchar *,
FT_WORD *, MYSQL_FTPARSER_BOOLEAN_INFO *);
-uchar maria_ft_simple_get_word(CHARSET_INFO *, const uchar **, const uchar *,
+uchar maria_ft_simple_get_word(CHARSET_INFO *, uchar **, const uchar *,
FT_WORD *, my_bool);
typedef struct _st_maria_ft_seg_iterator {
@@ -122,16 +122,16 @@ void _ma_ft_segiterator_dummy_init(const uchar *, uint, FT_SEG_ITERATOR *);
uint _ma_ft_segiterator(FT_SEG_ITERATOR *);
void maria_ft_parse_init(TREE *, CHARSET_INFO *);
-int maria_ft_parse(TREE *, uchar *, size_t, struct st_mysql_ftparser *parser,
+int maria_ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * maria_ft_linearize(TREE *, MEM_ROOT *);
FT_WORD * _ma_ft_parserecord(MARIA_HA *, uint, const uchar *, MEM_ROOT *);
uint _ma_ft_parse(TREE *, MARIA_HA *, uint, const uchar *,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
-FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, size_t, uint,
+FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, uint, uint,
uchar *);
-FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, size_t,
+FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, uint,
CHARSET_INFO *);
extern const struct _ft_vft _ma_ft_vft_nlq;
diff --git a/storage/maria/ma_info.c b/storage/maria/ma_info.c
index 1bbfa3cbf7e..6392da31298 100644
--- a/storage/maria/ma_info.c
+++ b/storage/maria/ma_info.c
@@ -43,7 +43,7 @@ int maria_status(MARIA_HA *info, register MARIA_INFO *x, uint flag)
if (!(flag & HA_STATUS_NO_LOCK))
{
pthread_mutex_lock(&share->intern_lock);
- VOID(_ma_readinfo(info,F_RDLCK,0));
+ _ma_readinfo(info,F_RDLCK,0);
fast_ma_writeinfo(info);
pthread_mutex_unlock(&share->intern_lock);
}
diff --git a/storage/maria/ma_init.c b/storage/maria/ma_init.c
index 902f06d93e5..34f55bd0bf8 100644
--- a/storage/maria/ma_init.c
+++ b/storage/maria/ma_init.c
@@ -34,9 +34,9 @@ void history_state_free(MARIA_STATE_HISTORY_CLOSED *closed_history)
for (history= closed_history->state_history; history ; history= next)
{
next= history->next;
- my_free(history, MYF(0));
+ my_free(history);
}
- my_free(closed_history, MYF(0));
+ my_free(closed_history);
}
@@ -72,8 +72,8 @@ int maria_init(void)
maria_create_trn_hook= dummy_maria_create_trn_hook;
my_handler_error_register();
}
- hash_init(&maria_stored_state, &my_charset_bin, 32,
- 0, sizeof(LSN), 0, (hash_free_key) history_state_free, 0);
+ my_hash_init(&maria_stored_state, &my_charset_bin, 32,
+ 0, sizeof(LSN), 0, (my_hash_free_key) history_state_free, 0);
DBUG_PRINT("info",("dummy_transaction_object: %p",
&dummy_transaction_object));
return 0;
@@ -110,7 +110,7 @@ void maria_end(void)
end_pagecache(maria_pagecache, TRUE);
ma_control_file_end();
pthread_mutex_destroy(&THR_LOCK_maria);
- hash_free(&maria_stored_state);
+ my_hash_free(&maria_stored_state);
}
}
diff --git a/storage/maria/ma_key.c b/storage/maria/ma_key.c
index ac23bf5fef6..0e1891fb249 100644
--- a/storage/maria/ma_key.c
+++ b/storage/maria/ma_key.c
@@ -269,7 +269,7 @@ MARIA_KEY *_ma_make_key(MARIA_HA *info, MARIA_KEY *int_key, uint keynr,
{
uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos);
uchar *blob_pos;
- memcpy_fixed(&blob_pos, pos+keyseg->bit_start,sizeof(char*));
+ memcpy(&blob_pos, pos+keyseg->bit_start,sizeof(char*));
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, blob_pos, length, char_length);
store_key_length_inc(key,char_length);
diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c
index 6bb308e5959..534acc9ddfa 100644
--- a/storage/maria/ma_locking.c
+++ b/storage/maria/ma_locking.c
@@ -163,7 +163,7 @@ int maria_lock_database(MARIA_HA *info, int lock_type)
}
}
#endif
- VOID(_ma_test_if_changed(info));
+ _ma_test_if_changed(info);
share->r_locks++;
share->tot_locks++;
info->lock_type=lock_type;
@@ -211,7 +211,7 @@ int maria_lock_database(MARIA_HA *info, int lock_type)
}
}
#endif /* defined(MARIA_EXTERNAL_LOCKING) */
- VOID(_ma_test_if_changed(info));
+ _ma_test_if_changed(info);
info->lock_type=lock_type;
info->invalidator=share->invalidator;
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index dc99554a08d..f6495e8e5ff 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -1044,7 +1044,7 @@ static TRANSLOG_FILE *get_current_logfile()
DBUG_RETURN(file);
}
-uchar NEAR maria_trans_file_magic[]=
+uchar maria_trans_file_magic[]=
{ (uchar) 254, (uchar) 254, (uchar) 11, '\001', 'M', 'A', 'R', 'I', 'A',
'L', 'O', 'G' };
#define LOG_HEADER_DATA_SIZE (sizeof(maria_trans_file_magic) + \
@@ -1461,7 +1461,7 @@ LSN translog_get_file_max_lsn_stored(uint32 file)
{
LOGHANDLER_FILE_INFO info;
File fd;
- LINT_INIT_STRUCT(info);
+
fd= open_logfile_by_number_no_cache(file);
if ((fd < 0) ||
(translog_read_file_header(&info, fd) | my_close(fd, MYF(MY_WME))))
@@ -1514,9 +1514,9 @@ static my_bool translog_buffer_init(struct st_translog_buffer *buffer, int num)
/* list of waiting buffer ready threads */
buffer->waiting_flush= 0;
/*
- Buffers locked by fallowing mutex. As far as buffers create logical
+ Buffers locked by the following mutex. As far as buffers create logical
circle (after last buffer goes first) it trigger false alarm of deadlock
- detect system, so we remove check of deadlock for this buffers. In deed
+ detect system, so we remove check of deadlock for this buffers. Indeed
all mutex locks concentrated around current buffer except flushing
thread (but it is only one thread). One thread can't take more then
2 buffer locks at once. So deadlock is impossible here.
@@ -1526,10 +1526,8 @@ static my_bool translog_buffer_init(struct st_translog_buffer *buffer, int num)
only one of eight buffers from deadlock detection hardly can hide other
possible problems which include this mutexes.
*/
- if (my_pthread_mutex_init(&buffer->mutex, MY_MUTEX_INIT_FAST,
- "translog_buffer->mutex",
- (num == TRANSLOG_BUFFERS_NO - 2 ?
- MYF_NO_DEADLOCK_DETECTION : 0)) ||
+
+ if (pthread_mutex_init(&buffer->mutex, MY_MUTEX_INIT_FAST) ||
pthread_cond_init(&buffer->prev_sent_to_disk_cond, 0))
DBUG_RETURN(1);
buffer->is_closing_buffer= 0;
@@ -1565,7 +1563,7 @@ static my_bool translog_close_log_file(TRANSLOG_FILE *file)
translog_syncs++;
}
rc|= my_close(file->handler.file, MYF(MY_WME));
- my_free(file, MYF(0));
+ my_free(file);
return test(rc);
}
@@ -3810,7 +3808,7 @@ my_bool translog_init_with_table(const char *directory,
*dynamic_element(&log_descriptor.open_files, j,
TRANSLOG_FILE **);
my_close(el->handler.file, MYF(MY_WME));
- my_free(el, MYF(0));
+ my_free(el);
}
if (file)
{
@@ -3970,7 +3968,6 @@ my_bool translog_init_with_table(const char *directory,
if (!old_log_was_recovered && old_flags == flags)
{
LOGHANDLER_FILE_INFO info;
- LINT_INIT_STRUCT(info);
/*
Accessing &log_descriptor.open_files without mutex is safe
@@ -4300,7 +4297,7 @@ void translog_destroy()
my_close(log_descriptor.directory_fd, MYF(MY_WME));
my_atomic_rwlock_destroy(&LOCK_id_to_share);
if (id_to_share != NULL)
- my_free((id_to_share + 1), MYF(MY_WME));
+ my_free(id_to_share + 1);
DBUG_VOID_RETURN;
}
@@ -6467,7 +6464,7 @@ void translog_free_record_header(TRANSLOG_HEADER_BUFFER *buff)
DBUG_ENTER("translog_free_record_header");
if (buff->groups_no != 0)
{
- my_free(buff->groups, MYF(0));
+ my_free(buff->groups);
buff->groups_no= 0;
}
DBUG_VOID_RETURN;
@@ -6990,7 +6987,7 @@ translog_variable_length_header(uchar *page, translog_size_t page_offset,
DBUG_RETURN(buffer_length);
exit_and_free:
- my_free(buff->groups, MYF(0));
+ my_free(buff->groups);
buff->groups_no= 0; /* prevent try to use of buff->groups */
DBUG_RETURN(rc);
}
@@ -8914,9 +8911,8 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- VOID(printf("%s Ver 1.0 for %s on %s\n",
- my_progname_short, SYSTEM_TYPE, MACHINE_TYPE));
- NETWARE_SET_SCREEN_MODE(1);
+ printf("%s Ver 1.0 for %s on %s\n",
+ my_progname_short, SYSTEM_TYPE, MACHINE_TYPE);
}
@@ -8928,7 +8924,7 @@ static void usage(void)
puts("and you are welcome to modify and redistribute it under the GPL license\n");
puts("Dump content of aria log pages.");
- VOID(printf("\nUsage: %s -f file OPTIONS\n", my_progname_short));
+ printf("\nUsage: %s -f file OPTIONS\n", my_progname_short);
my_print_help(my_long_options);
print_defaults("my", load_default_groups);
my_print_variables(my_long_options);
@@ -8980,7 +8976,7 @@ static void dump_header_page(uchar *buff)
{
LOGHANDLER_FILE_INFO desc;
char strbuff[21];
- LINT_INIT_STRUCT(desc);
+
translog_interpret_file_header(&desc, buff);
printf(" This can be header page:\n"
" Timestamp: %s\n"
@@ -9313,4 +9309,7 @@ err:
free_defaults(default_argv);
exit(1);
}
+
+#include "ma_check_standalone.h"
#endif
+
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 63e1801a39a..606959c56a0 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -219,11 +219,11 @@ err:
case 6:
(*share->end)(&info);
delete_dynamic(&info.pinned_pages);
- my_free(m_info, MYF(0));
+ my_free(m_info);
/* fall through */
case 5:
if (data_file < 0)
- VOID(my_close(info.dfile.file, MYF(0)));
+ my_close(info.dfile.file, MYF(0));
break;
}
my_errno=save_errno;
@@ -806,7 +806,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
(keys ? MARIA_INDEX_BLOCK_MARGIN *
share->block_size * keys : 0));
share->block_size= share->base.block_size;
- my_free(disk_cache, MYF(0));
+ my_free(disk_cache);
_ma_setup_functions(share);
if ((*share->once_init)(share, info.dfile.file))
goto err;
@@ -815,7 +815,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
/* Setup initial state that is visible for all */
MARIA_STATE_HISTORY_CLOSED *history;
if ((history= (MARIA_STATE_HISTORY_CLOSED *)
- hash_search(&maria_stored_state,
+ my_hash_search(&maria_stored_state,
(uchar*) &share->state.create_rename_lsn, 0)))
{
/*
@@ -825,7 +825,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share->state_history=
_ma_remove_not_visible_states(history->state_history, 0, 0);
history->state_history= 0;
- (void) hash_delete(&maria_stored_state, (uchar*) history);
+ (void) my_hash_delete(&maria_stored_state, (uchar*) history);
}
else
{
@@ -845,8 +845,8 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
pthread_cond_init(&share->key_del_cond, 0);
pthread_mutex_init(&share->close_lock, MY_MUTEX_INIT_FAST);
for (i=0; i<keys; i++)
- VOID(my_rwlock_init(&share->keyinfo[i].root_lock, NULL));
- VOID(my_rwlock_init(&share->mmap_lock, NULL));
+ my_rwlock_init(&share->keyinfo[i].root_lock, NULL);
+ my_rwlock_init(&share->mmap_lock, NULL);
share->row_is_visible= _ma_row_visible_always;
share->lock.get_status= _ma_reset_update_flag;
@@ -950,19 +950,19 @@ err:
switch (errpos) {
case 5:
if (data_file >= 0)
- VOID(my_close(data_file, MYF(0)));
+ my_close(data_file, MYF(0));
if (old_info)
break; /* Don't remove open table */
(*share->once_end)(share);
/* fall through */
case 4:
- my_free(share,MYF(0));
+ my_free(share);
/* fall through */
case 3:
- my_free(disk_cache, MYF(0));
+ my_free(disk_cache);
/* fall through */
case 1:
- VOID(my_close(kfile,MYF(0)));
+ my_close(kfile,MYF(0));
/* fall through */
case 0:
default:
@@ -1283,7 +1283,7 @@ uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite)
size_t res;
DBUG_ENTER("_ma_state_info_write_sub");
- memcpy_fixed(ptr,&state->header,sizeof(state->header));
+ memcpy(ptr,&state->header,sizeof(state->header));
ptr+=sizeof(state->header);
/* open_count must be first because of _ma_mark_file_changed ! */
@@ -1353,7 +1353,7 @@ uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite)
static uchar *_ma_state_info_read(uchar *ptr, MARIA_STATE_INFO *state)
{
uint i,keys,key_parts;
- memcpy_fixed(&state->header,ptr, sizeof(state->header));
+ memcpy(&state->header,ptr, sizeof(state->header));
ptr+= sizeof(state->header);
keys= (uint) state->header.keys;
key_parts= mi_uint2korr(state->header.key_parts);
diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c
index 4df00d9bb88..00433426cb7 100644
--- a/storage/maria/ma_packrec.c
+++ b/storage/maria/ma_packrec.c
@@ -156,8 +156,8 @@ my_bool _ma_once_end_pack_row(MARIA_SHARE *share)
{
if (share->decode_trees)
{
- my_free(share->decode_trees,MYF(0));
- my_free(share->decode_tables,MYF(0));
+ my_free(share->decode_trees);
+ my_free(share->decode_tables);
}
return 0;
}
@@ -332,9 +332,9 @@ static my_bool _ma_read_pack_info(MARIA_SHARE *share, File file,
err3:
my_errno=HA_ERR_WRONG_IN_RECORD;
err2:
- my_free(share->decode_tables, MYF(0));
+ my_free(share->decode_tables);
err1:
- my_free(share->decode_trees, MYF(0));
+ my_free(share->decode_trees);
err0:
DBUG_RETURN(1);
}
@@ -1097,8 +1097,7 @@ static void uf_blob(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
decode_bytes(rec, bit_buff, bit_buff->blob_pos,
bit_buff->blob_pos + length);
_ma_store_blob_length(to, pack_length, length);
- memcpy_fixed((uchar*) to+pack_length,(uchar*) &bit_buff->blob_pos,
- sizeof(uchar*));
+ memcpy(to+pack_length, &bit_buff->blob_pos, sizeof(uchar*));
bit_buff->blob_pos+=length;
}
}
@@ -1421,7 +1420,7 @@ uint _ma_pack_get_block_info(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff,
We can't use my_pread() here because _ma_read_rnd_pack_record assumes
position is ok
*/
- VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
+ my_seek(file,filepos,MY_SEEK_SET,MYF(0));
if (my_read(file, header,ref_length,MYF(MY_NABP)))
return BLOCK_FATAL_ERROR;
DBUG_DUMP("header", header, ref_length);
@@ -1565,8 +1564,8 @@ my_bool _ma_memmap_file(MARIA_HA *info)
void _ma_unmap_file(MARIA_HA *info)
{
- VOID(my_munmap((char*) info->s->file_map,
- (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN));
+ my_munmap((char*) info->s->file_map,
+ (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN);
}
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 441310a60ea..566131ec77b 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -129,8 +129,6 @@ my_bool my_disable_flush_pagecache_blocks= 0;
#define COND_FOR_WRLOCK 2 /* queue of write lock */
#define COND_SIZE 3 /* number of COND_* queues */
-typedef pthread_cond_t KEYCACHE_CONDVAR;
-
/* descriptor of the page in the page cache block buffer */
struct st_pagecache_page
{
@@ -305,7 +303,7 @@ struct st_pagecache_block_link
PAGECACHE_PIN_INFO *pin_list;
PAGECACHE_LOCK_INFO *lock_list;
#endif
- KEYCACHE_CONDVAR *condvar; /* condition variable for 'no readers' event */
+ mysql_cond_t *condvar; /* condition variable for 'no readers' event */
uchar *buffer; /* buffer for the block page */
pthread_t write_locker;
@@ -728,8 +726,9 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem,
pagecache->disk_blocks= -1;
if (! pagecache->inited)
{
- if (pthread_mutex_init(&pagecache->cache_lock, MY_MUTEX_INIT_FAST) ||
- hash_init(&pagecache->files_in_flush, &my_charset_bin, 32,
+ if (mysql_mutex_init(ma_key_mutex_PAGECACHE_cache_lock,
+ &pagecache->cache_lock, MY_MUTEX_INIT_FAST) ||
+ my_hash_init(&pagecache->files_in_flush, &my_charset_bin, 32,
offsetof(struct st_file_in_flush, file),
sizeof(((struct st_file_in_flush *)NULL)->file),
NULL, NULL, 0))
@@ -789,7 +788,7 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem,
if ((pagecache->block_root=
(PAGECACHE_BLOCK_LINK*) my_malloc((size_t) length, MYF(0))))
break;
- my_large_free(pagecache->block_mem, MYF(0));
+ my_large_free(pagecache->block_mem);
pagecache->block_mem= 0;
}
blocks= blocks / 4*3;
@@ -858,12 +857,12 @@ err:
pagecache->blocks= 0;
if (pagecache->block_mem)
{
- my_large_free(pagecache->block_mem, MYF(0));
+ my_large_free(pagecache->block_mem);
pagecache->block_mem= NULL;
}
if (pagecache->block_root)
{
- my_free(pagecache->block_root, MYF(0));
+ my_free(pagecache->block_root);
pagecache->block_root= NULL;
}
my_errno= error;
@@ -962,7 +961,7 @@ ulong resize_pagecache(PAGECACHE *pagecache,
DBUG_RETURN(pagecache->disk_blocks);
}
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
#ifdef THREAD
wqueue= &pagecache->resize_queue;
@@ -971,7 +970,7 @@ ulong resize_pagecache(PAGECACHE *pagecache,
while (wqueue->last_thread->next != thread)
{
- pagecache_pthread_cond_wait(&thread->suspend, &pagecache->cache_lock);
+ mysql_cond_wait(&thread->suspend, &pagecache->cache_lock);
}
#endif
@@ -991,7 +990,7 @@ ulong resize_pagecache(PAGECACHE *pagecache,
{
KEYCACHE_DBUG_PRINT("resize_pagecache: wait",
("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend, &pagecache->cache_lock);
+ mysql_cond_wait(&thread->suspend, &pagecache->cache_lock);
}
#else
KEYCACHE_DBUG_ASSERT(pagecache->cnt_for_resize_op == 0);
@@ -1011,10 +1010,10 @@ finish:
{
KEYCACHE_DBUG_PRINT("resize_pagecache: signal",
("thread %ld", wqueue->last_thread->next->id));
- pagecache_pthread_cond_signal(&wqueue->last_thread->next->suspend);
+ mysql_cond_signal(&wqueue->last_thread->next->suspend);
}
#endif
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_RETURN(blocks);
}
#endif /* 0 */
@@ -1042,7 +1041,7 @@ static inline void dec_counter_for_resize_op(PAGECACHE *pagecache)
{
KEYCACHE_DBUG_PRINT("dec_counter_for_resize_op: signal",
("thread %ld", last_thread->next->id));
- pagecache_pthread_cond_signal(&last_thread->next->suspend);
+ mysql_cond_signal(&last_thread->next->suspend);
}
#else
pagecache->cnt_for_resize_op--;
@@ -1072,14 +1071,14 @@ void change_pagecache_param(PAGECACHE *pagecache, uint division_limit,
{
DBUG_ENTER("change_pagecache_param");
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
if (division_limit)
pagecache->min_warm_blocks= (pagecache->disk_blocks *
division_limit / 100 + 1);
if (age_threshold)
pagecache->age_threshold= (pagecache->disk_blocks *
age_threshold / 100);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_VOID_RETURN;
}
@@ -1108,9 +1107,9 @@ void end_pagecache(PAGECACHE *pagecache, my_bool cleanup)
{
if (pagecache->block_mem)
{
- my_large_free(pagecache->block_mem, MYF(0));
+ my_large_free(pagecache->block_mem);
pagecache->block_mem= NULL;
- my_free(pagecache->block_root, MYF(0));
+ my_free(pagecache->block_root);
pagecache->block_root= NULL;
}
pagecache->disk_blocks= -1;
@@ -1129,8 +1128,8 @@ void end_pagecache(PAGECACHE *pagecache, my_bool cleanup)
if (cleanup)
{
- hash_free(&pagecache->files_in_flush);
- pthread_mutex_destroy(&pagecache->cache_lock);
+ my_hash_free(&pagecache->files_in_flush);
+ mysql_mutex_destroy(&pagecache->cache_lock);
pagecache->inited= pagecache->can_be_used= 0;
PAGECACHE_DEBUG_CLOSE;
}
@@ -1269,7 +1268,7 @@ static void link_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block,
if ((PAGECACHE_HASH_LINK *) thread->opt_info == hash_link)
{
KEYCACHE_DBUG_PRINT("link_block: signal", ("thread: %ld", thread->id));
- pagecache_pthread_cond_signal(&thread->suspend);
+ mysql_cond_signal(&thread->suspend);
wqueue_unlink_from_queue(&pagecache->waiting_for_block, thread);
block->requests++;
}
@@ -1488,7 +1487,7 @@ static inline void remove_reader(PAGECACHE_BLOCK_LINK *block)
DBUG_ASSERT(block->hash_link->requests > 0);
#ifdef THREAD
if (! --block->hash_link->requests && block->condvar)
- pagecache_pthread_cond_signal(block->condvar);
+ mysql_cond_signal(block->condvar);
#else
--block->hash_link->requests;
#endif
@@ -1513,7 +1512,7 @@ static inline void wait_for_readers(PAGECACHE *pagecache
("suspend thread: %ld block: %u",
thread->id, PCBLOCK_NUMBER(pagecache, block)));
block->condvar= &thread->suspend;
- pagecache_pthread_cond_wait(&thread->suspend, &pagecache->cache_lock);
+ mysql_cond_wait(&thread->suspend, &pagecache->cache_lock);
block->condvar= NULL;
}
#else
@@ -1578,7 +1577,7 @@ static void unlink_hash(PAGECACHE *pagecache, PAGECACHE_HASH_LINK *hash_link)
page->pageno == hash_link->pageno)
{
KEYCACHE_DBUG_PRINT("unlink_hash: signal", ("thread %ld", thread->id));
- pagecache_pthread_cond_signal(&thread->suspend);
+ mysql_cond_signal(&thread->suspend);
wqueue_unlink_from_queue(&pagecache->waiting_for_hash_link, thread);
}
}
@@ -1713,9 +1712,8 @@ restart:
thread->opt_info= (void *) &page;
wqueue_link_into_queue(&pagecache->waiting_for_hash_link, thread);
KEYCACHE_DBUG_PRINT("get_hash_link: wait",
- ("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend,
- &pagecache->cache_lock);
+ ("suspend thread %ld", thread->id));
+ mysql_cond_wait(&thread->suspend, &pagecache->cache_lock);
thread->opt_info= NULL;
#else
KEYCACHE_DBUG_ASSERT(0);
@@ -1847,8 +1845,7 @@ restart:
{
KEYCACHE_DBUG_PRINT("find_block: wait",
("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend,
- &pagecache->cache_lock);
+ mysql_cond_wait(&thread->suspend, &pagecache->cache_lock);
}
while(thread->next);
#else
@@ -1903,8 +1900,7 @@ restart:
{
KEYCACHE_DBUG_PRINT("find_block: wait",
("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend,
- &pagecache->cache_lock);
+ mysql_cond_wait(&thread->suspend, &pagecache->cache_lock);
}
while(thread->next);
#else
@@ -1988,8 +1984,7 @@ restart:
{
KEYCACHE_DBUG_PRINT("find_block: wait",
("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend,
- &pagecache->cache_lock);
+ mysql_cond_wait(&thread->suspend, &pagecache->cache_lock);
}
while (thread->next);
thread->opt_info= NULL;
@@ -2037,7 +2032,7 @@ restart:
KEYCACHE_DBUG_PRINT("find_block", ("block is dirty"));
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
/*
The call is thread safe because only the current
thread might change the block->hash_link value
@@ -2049,7 +2044,7 @@ restart:
block->hash_link->pageno,
block->type,
pagecache->readwrite_flags);
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
pagecache->global_cache_write++;
}
@@ -2175,7 +2170,7 @@ static void remove_pin(PAGECACHE_BLOCK_LINK *block, my_bool any
PAGECACHE_PIN_INFO *info= info_find(block->pin_list, my_thread_var, any);
DBUG_ASSERT(info != 0);
info_unlink(info);
- my_free(info, MYF(0));
+ my_free(info);
}
#endif
DBUG_VOID_RETURN;
@@ -2197,7 +2192,7 @@ static void info_remove_lock(PAGECACHE_BLOCK_LINK *block)
my_thread_var, FALSE);
DBUG_ASSERT(info != 0);
info_unlink((PAGECACHE_PIN_INFO *)info);
- my_free(info, MYF(0));
+ my_free(info);
}
static void info_change_lock(PAGECACHE_BLOCK_LINK *block, my_bool wl)
{
@@ -2246,8 +2241,7 @@ static my_bool pagecache_wait_lock(PAGECACHE *pagecache,
{
KEYCACHE_DBUG_PRINT("get_wrlock: wait",
("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend,
- &pagecache->cache_lock);
+ mysql_cond_wait(&thread->suspend, &pagecache->cache_lock);
}
while(thread->next);
#else
@@ -2612,7 +2606,7 @@ static void read_block(PAGECACHE *pagecache,
pagecache->global_cache_read++;
/* Page is not in buffer yet, is to be read from disk */
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
/*
Here other threads may step in and register as secondary readers.
They will register in block->wqueue[COND_FOR_REQUESTED].
@@ -2621,7 +2615,7 @@ static void read_block(PAGECACHE *pagecache,
block->buffer,
block->hash_link->pageno,
pagecache->readwrite_flags);
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
if (error)
{
block->status|= PCBLOCK_ERROR;
@@ -2665,8 +2659,7 @@ static void read_block(PAGECACHE *pagecache,
{
DBUG_PRINT("read_block: wait",
("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend,
- &pagecache->cache_lock);
+ mysql_cond_wait(&thread->suspend, &pagecache->cache_lock);
}
while (thread->next);
#else
@@ -2763,7 +2756,7 @@ void pagecache_unlock(PAGECACHE *pagecache,
DBUG_ASSERT(lock != PAGECACHE_LOCK_READ);
DBUG_ASSERT(lock != PAGECACHE_LOCK_WRITE);
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
/*
As soon as we keep lock cache can be used, and we have lock because want
to unlock.
@@ -2823,7 +2816,7 @@ void pagecache_unlock(PAGECACHE *pagecache,
dec_counter_for_resize_op(pagecache);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_VOID_RETURN;
}
@@ -2852,7 +2845,7 @@ void pagecache_unpin(PAGECACHE *pagecache,
DBUG_ENTER("pagecache_unpin");
DBUG_PRINT("enter", ("fd: %u page: %lu",
(uint) file->file, (ulong) pageno));
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
/*
As soon as we keep lock cache can be used, and we have lock bacause want
aunlock.
@@ -2890,7 +2883,7 @@ void pagecache_unpin(PAGECACHE *pagecache,
dec_counter_for_resize_op(pagecache);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_VOID_RETURN;
}
@@ -2941,13 +2934,13 @@ void pagecache_unlock_by_link(PAGECACHE *pagecache,
DBUG_ASSERT(pin != PAGECACHE_PIN_LEFT_UNPINNED);
DBUG_ASSERT(lock != PAGECACHE_LOCK_READ);
DBUG_ASSERT(lock != PAGECACHE_LOCK_WRITE);
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
if (pin == PAGECACHE_PIN_LEFT_UNPINNED &&
lock == PAGECACHE_LOCK_READ_UNLOCK)
{
if (make_lock_and_pin(pagecache, block, lock, pin, FALSE))
DBUG_ASSERT(0); /* should not happend */
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_VOID_RETURN;
}
@@ -3016,7 +3009,7 @@ void pagecache_unlock_by_link(PAGECACHE *pagecache,
dec_counter_for_resize_op(pagecache);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_VOID_RETURN;
}
@@ -3045,7 +3038,7 @@ void pagecache_unpin_by_link(PAGECACHE *pagecache,
(uint) block->hash_link->file.file,
(ulong) block->hash_link->pageno));
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
/*
As soon as we keep lock cache can be used, and we have lock because want
unlock.
@@ -3078,7 +3071,7 @@ void pagecache_unpin_by_link(PAGECACHE *pagecache,
dec_counter_for_resize_op(pagecache);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_VOID_RETURN;
}
@@ -3292,10 +3285,10 @@ restart:
uint status;
int page_st;
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
if (!pagecache->can_be_used)
{
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
goto no_key_cache;
}
@@ -3347,7 +3340,7 @@ restart:
*/
if (reg_request)
unreg_request(pagecache, block, 1);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_PRINT("info", ("restarting..."));
goto restart;
}
@@ -3371,15 +3364,15 @@ restart:
if (!(status & PCBLOCK_ERROR))
{
#if !defined(SERIALIZED_READ_FROM_CACHE)
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
#endif
DBUG_ASSERT((pagecache->block_size & 511) == 0);
/* Copy data from the cache buffer */
- bmove512(buff, block->buffer, pagecache->block_size);
+ memcpy(buff, block->buffer, pagecache->block_size);
#if !defined(SERIALIZED_READ_FROM_CACHE)
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
#endif
}
else
@@ -3407,7 +3400,7 @@ restart:
dec_counter_for_resize_op(pagecache);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
if (status & PCBLOCK_ERROR)
{
@@ -3458,7 +3451,7 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache,
KEYCACHE_DBUG_PRINT("find_block", ("block is dirty"));
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
/*
The call is thread safe because only the current
thread might change the block->hash_link value
@@ -3470,7 +3463,7 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache,
block->hash_link->pageno,
block->type,
pagecache->readwrite_flags);
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
pagecache->global_cache_write++;
if (error)
@@ -3539,7 +3532,7 @@ my_bool pagecache_delete_by_link(PAGECACHE *pagecache,
if (pagecache->can_be_used)
{
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
if (!pagecache->can_be_used)
goto end;
@@ -3565,7 +3558,7 @@ my_bool pagecache_delete_by_link(PAGECACHE *pagecache,
error= pagecache_delete_internal(pagecache, block, block->hash_link,
flush);
end:
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
}
DBUG_RETURN(error);
@@ -3656,7 +3649,7 @@ restart:
reg1 PAGECACHE_BLOCK_LINK *block;
PAGECACHE_HASH_LINK **unused_start, *page_link;
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
if (!pagecache->can_be_used)
goto end;
@@ -3665,7 +3658,7 @@ restart:
if (!page_link)
{
DBUG_PRINT("info", ("There is no such page in the cache"));
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_RETURN(0);
}
block= page_link->block;
@@ -3691,7 +3684,7 @@ restart:
*/
if (pin == PAGECACHE_PIN)
unreg_request(pagecache, block, 1);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_PRINT("info", ("restarting..."));
goto restart;
}
@@ -3701,7 +3694,7 @@ restart:
error= pagecache_delete_internal(pagecache, block, page_link, flush);
end:
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
}
DBUG_RETURN(error);
@@ -3848,10 +3841,10 @@ restart:
int page_st;
my_bool need_page_ready_signal= FALSE;
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
if (!pagecache->can_be_used)
{
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
goto no_key_cache;
}
@@ -3868,7 +3861,7 @@ restart:
DBUG_ASSERT(write_mode != PAGECACHE_WRITE_DONE);
/* It happens only for requests submitted during resize operation */
dec_counter_for_resize_op(pagecache);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
/* Write to the disk key cache is in resize at the moment*/
goto no_key_cache;
}
@@ -3912,7 +3905,7 @@ restart:
*/
if (reg_request)
unreg_request(pagecache, block, 1);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_PRINT("info", ("restarting..."));
goto restart;
}
@@ -3927,10 +3920,7 @@ restart:
else
{
/* Copy data from buff */
- if (!(size & 511))
- bmove512(block->buffer + offset, buff, size);
- else
- memcpy(block->buffer + offset, buff, size);
+ memcpy(block->buffer + offset, buff, size);
block->status= PCBLOCK_READ;
/*
The read_callback can change the page content (removing page
@@ -3963,10 +3953,7 @@ restart:
if (! (block->status & PCBLOCK_CHANGED))
link_to_changed_list(pagecache, block);
- if (!(size & 511))
- bmove512(block->buffer + offset, buff, size);
- else
- memcpy(block->buffer + offset, buff, size);
+ memcpy(block->buffer + offset, buff, size);
block->status|= PCBLOCK_READ;
/* Page is correct again if we made a full write in it */
if (size == pagecache->block_size)
@@ -4018,7 +4005,7 @@ restart:
dec_counter_for_resize_op(pagecache);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
goto end;
}
@@ -4175,14 +4162,14 @@ static int flush_cached_blocks(PAGECACHE *pagecache,
*first_errno= 0;
/* Don't lock the cache during the flush */
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
/*
As all blocks referred in 'cache' are marked by PCBLOCK_IN_FLUSH
we are guaranteed that no thread will change them
*/
qsort((uchar*) cache, count, sizeof(*cache), (qsort_cmp) cmp_sec_link);
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
for (; cache != end; cache++)
{
PAGECACHE_BLOCK_LINK *block= *cache;
@@ -4223,7 +4210,7 @@ static int flush_cached_blocks(PAGECACHE *pagecache,
DBUG_PRINT("info", ("block: %u (0x%lx) to be flushed",
PCBLOCK_NUMBER(pagecache, block), (ulong)block));
PCBLOCK_INFO(block);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_PRINT("info", ("block: %u (0x%lx) pins: %u",
PCBLOCK_NUMBER(pagecache, block), (ulong)block,
block->pins));
@@ -4242,7 +4229,7 @@ static int flush_cached_blocks(PAGECACHE *pagecache,
block->hash_link->pageno,
block->type,
pagecache->readwrite_flags);
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
if (make_lock_and_pin(pagecache, block,
PAGECACHE_LOCK_READ_UNLOCK,
@@ -4367,8 +4354,8 @@ static int flush_pagecache_blocks_int(PAGECACHE *pagecache,
us_flusher.flush_queue.last_thread= NULL;
us_flusher.first_in_switch= FALSE;
while ((other_flusher= (struct st_file_in_flush *)
- hash_search(&pagecache->files_in_flush, (uchar *)&file->file,
- sizeof(file->file))))
+ my_hash_search(&pagecache->files_in_flush, (uchar *)&file->file,
+ sizeof(file->file))))
{
/*
File is in flush already: wait, unless FLUSH_KEEP_LAZY. "Flusher"
@@ -4387,7 +4374,7 @@ static int flush_pagecache_blocks_int(PAGECACHE *pagecache,
{
KEYCACHE_DBUG_PRINT("flush_pagecache_blocks_int: wait1",
("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend,
+ mysql_cond_wait(&thread->suspend,
&pagecache->cache_lock);
}
while (thread->next);
@@ -4401,17 +4388,17 @@ static int flush_pagecache_blocks_int(PAGECACHE *pagecache,
are going to remove themselves from the hash, and thus memory will
appear again. However, this memory may be stolen by yet another thread
(for a purpose unrelated to page cache), before we retry
- hash_insert(). So the loop may run for long. Only if the thread was
+ my_hash_insert(). So the loop may run for long. Only if the thread was
killed do we abort the loop, returning 1 (error) which can cause the
table to be marked as corrupted (cf maria_chk_size(), maria_close())
and thus require a table check.
*/
DBUG_ASSERT(0);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
if (my_thread_var->abort)
DBUG_RETURN(1); /* End if aborted by user */
sleep(10);
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
}
#endif
@@ -4547,7 +4534,7 @@ restart:
{
KEYCACHE_DBUG_PRINT("flush_pagecache_blocks_int: wait2",
("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend,
+ mysql_cond_wait(&thread->suspend,
&pagecache->cache_lock);
}
while (thread->next);
@@ -4594,7 +4581,7 @@ restart:
}
#ifdef THREAD
/* wake up others waiting to flush this file */
- hash_delete(&pagecache->files_in_flush, (uchar *)&us_flusher);
+ my_hash_delete(&pagecache->files_in_flush, (uchar *)&us_flusher);
if (us_flusher.flush_queue.last_thread)
wqueue_release_queue(&us_flusher.flush_queue);
#endif
@@ -4605,7 +4592,7 @@ restart:
test_key_cache(pagecache, "end of flush_pagecache_blocks", 0););
#endif
if (cache != cache_buff)
- my_free(cache, MYF(0));
+ my_free(cache);
if (rc != 0)
{
if (last_errno)
@@ -4647,11 +4634,11 @@ int flush_pagecache_blocks_with_filter(PAGECACHE *pagecache,
if (pagecache->disk_blocks <= 0)
DBUG_RETURN(0);
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
inc_counter_for_resize_op(pagecache);
res= flush_pagecache_blocks_int(pagecache, file, type, filter, filter_arg);
dec_counter_for_resize_op(pagecache);
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
DBUG_RETURN(res);
}
@@ -4728,14 +4715,14 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
We lock the entire cache but will be quick, just reading/writing a few MBs
of memory at most.
*/
- pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+ mysql_mutex_lock(&pagecache->cache_lock);
#ifdef THREAD
for (;;)
{
struct st_file_in_flush *other_flusher;
for (file_hash= 0;
(other_flusher= (struct st_file_in_flush *)
- hash_element(&pagecache->files_in_flush, file_hash)) != NULL &&
+ my_hash_element(&pagecache->files_in_flush, file_hash)) != NULL &&
!other_flusher->first_in_switch;
file_hash++)
{}
@@ -4758,7 +4745,7 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
{
KEYCACHE_DBUG_PRINT("pagecache_collect_changed_blocks_with_lsn: wait",
("suspend thread %ld", thread->id));
- pagecache_pthread_cond_wait(&thread->suspend,
+ mysql_cond_wait(&thread->suspend,
&pagecache->cache_lock);
}
while (thread->next);
@@ -4837,7 +4824,7 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
}
}
end:
- pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+ mysql_mutex_unlock(&pagecache->cache_lock);
*min_rec_lsn= minimum_rec_lsn;
DBUG_RETURN(error);
diff --git a/storage/maria/ma_pagecache.h b/storage/maria/ma_pagecache.h
index 821728ef374..648f93d5c74 100644
--- a/storage/maria/ma_pagecache.h
+++ b/storage/maria/ma_pagecache.h
@@ -137,10 +137,10 @@ typedef struct st_pagecache
PAGECACHE_HASH_LINK *free_hash_list;/* list of free hash links */
PAGECACHE_BLOCK_LINK *free_block_list;/* list of free blocks */
PAGECACHE_BLOCK_LINK *block_root;/* memory for block links */
- uchar HUGE_PTR *block_mem; /* memory for block buffers */
+ uchar *block_mem; /* memory for block buffers */
PAGECACHE_BLOCK_LINK *used_last;/* ptr to the last block of the LRU chain */
PAGECACHE_BLOCK_LINK *used_ins;/* ptr to the insertion block in LRU chain */
- pthread_mutex_t cache_lock; /* to lock access to the cache structure */
+ mysql_mutex_t cache_lock; /* to lock access to the cache structure */
WQUEUE resize_queue; /* threads waiting during resize operation */
WQUEUE waiting_for_hash_link;/* waiting for a free hash link */
WQUEUE waiting_for_block; /* requests waiting for a free block */
diff --git a/storage/maria/ma_preload.c b/storage/maria/ma_preload.c
index 6dfb4e437b6..10cabca9cfc 100644
--- a/storage/maria/ma_preload.c
+++ b/storage/maria/ma_preload.c
@@ -107,10 +107,10 @@ int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves)
LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, FALSE, FALSE);
}
- my_free(buff, MYF(0));
+ my_free(buff);
DBUG_RETURN(0);
err:
- my_free(buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(buff);
DBUG_RETURN(my_errno= errno);
}
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 7a7286e26f9..b473bb14995 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -55,7 +55,7 @@ static my_bool in_redo_phase;
static my_bool trns_created;
static ulong skipped_undo_phase;
static ulonglong now; /**< for tracking execution time of phases */
-static int (*save_error_handler_hook)(uint, const char *,myf);
+static void (*save_error_handler_hook)(uint, const char *,myf);
static uint recovery_warnings; /**< count of warnings */
static uint recovery_found_crashed_tables;
@@ -163,7 +163,7 @@ static enum recovery_message_type
/* Hook to ensure we get nicer output if we get an error */
-int maria_recover_error_handler_hook(uint error, const char *str,
+void maria_recover_error_handler_hook(uint error, const char *str,
myf flags)
{
if (procent_printed)
@@ -172,7 +172,7 @@ int maria_recover_error_handler_hook(uint error, const char *str,
fputc('\n', stderr);
fflush(stderr);
}
- return (*save_error_handler_hook)(error, str, flags);
+ (*save_error_handler_hook)(error, str, flags);
}
/* Define this if you want gdb to break in some interesting situations */
@@ -467,15 +467,15 @@ err2:
}
end:
error_handler_hook= save_error_handler_hook;
- hash_free(&all_dirty_pages);
+ my_hash_free(&all_dirty_pages);
bzero(&all_dirty_pages, sizeof(all_dirty_pages));
- my_free(dirty_pages_pool, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(dirty_pages_pool);
dirty_pages_pool= NULL;
- my_free(all_tables, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(all_tables);
all_tables= NULL;
- my_free(all_active_trans, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(all_active_trans);
all_active_trans= NULL;
- my_free(log_record_buffer.str, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(log_record_buffer.str);
log_record_buffer.str= NULL;
log_record_buffer.length= 0;
ma_checkpoint_end();
@@ -2737,13 +2737,13 @@ static uint end_of_redo_phase(my_bool prepare_for_undo_phase)
char llbuf[22];
LSN addr;
- hash_free(&all_dirty_pages);
+ my_hash_free(&all_dirty_pages);
/*
hash_free() can be called multiple times probably, but be safe if that
changes
*/
bzero(&all_dirty_pages, sizeof(all_dirty_pages));
- my_free(dirty_pages_pool, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(dirty_pages_pool);
dirty_pages_pool= NULL;
llstr(max_long_trid, llbuf);
@@ -2822,7 +2822,7 @@ static uint end_of_redo_phase(my_bool prepare_for_undo_phase)
#endif
}
- my_free(all_active_trans, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(all_active_trans);
all_active_trans= NULL;
/*
@@ -3247,10 +3247,10 @@ static LSN parse_checkpoint_record(LSN lsn)
ptr+= 8;
tprint(tracef, "%lu dirty pages\n", (ulong) nb_dirty_pages);
- if (hash_init(&all_dirty_pages, &my_charset_bin, (ulong)nb_dirty_pages,
- offsetof(struct st_dirty_page, file_and_page_id),
- sizeof(((struct st_dirty_page *)NULL)->file_and_page_id),
- NULL, NULL, 0))
+ if (my_hash_init(&all_dirty_pages, &my_charset_bin, (ulong)nb_dirty_pages,
+ offsetof(struct st_dirty_page, file_and_page_id),
+ sizeof(((struct st_dirty_page *)NULL)->file_and_page_id),
+ NULL, NULL, 0))
return LSN_ERROR;
dirty_pages_pool=
(struct st_dirty_page *)my_malloc((size_t)nb_dirty_pages *
diff --git a/storage/maria/ma_recovery_util.c b/storage/maria/ma_recovery_util.c
index 19e61daf4ef..53f3c2f94b1 100644
--- a/storage/maria/ma_recovery_util.c
+++ b/storage/maria/ma_recovery_util.c
@@ -132,7 +132,7 @@ my_bool _ma_redo_not_needed_for_page(uint16 shortid, LSN lsn,
uint64 file_and_page_id=
(((uint64)((index << 16) | shortid)) << 40) | page;
struct st_dirty_page *dirty_page= (struct st_dirty_page *)
- hash_search(&all_dirty_pages,
+ my_hash_search(&all_dirty_pages,
(uchar *)&file_and_page_id, sizeof(file_and_page_id));
DBUG_PRINT("info", ("in dirty pages list: %d", dirty_page != NULL));
if ((dirty_page == NULL) ||
diff --git a/storage/maria/ma_rsame.c b/storage/maria/ma_rsame.c
index 4bdbfd526ba..9ddd487a8a3 100644
--- a/storage/maria/ma_rsame.c
+++ b/storage/maria/ma_rsame.c
@@ -63,8 +63,8 @@ int maria_rsame(MARIA_HA *info, uchar *record, int inx)
info->cur_row.trid);
if (info->s->lock_key_trees)
rw_rdlock(&keyinfo->root_lock);
- VOID(_ma_search(info, &info->last_key, SEARCH_SAME,
- info->s->state.key_root[inx]));
+ _ma_search(info, &info->last_key, SEARCH_SAME,
+ info->s->state.key_root[inx]);
if (info->s->lock_key_trees)
rw_unlock(&keyinfo->root_lock);
}
diff --git a/storage/maria/ma_rt_index.c b/storage/maria/ma_rt_index.c
index 62474dbbad8..8feac7711e2 100644
--- a/storage/maria/ma_rt_index.c
+++ b/storage/maria/ma_rt_index.c
@@ -1200,7 +1200,7 @@ my_bool maria_rtree_real_delete(MARIA_HA *info, MARIA_KEY *key,
}
}
my_afree(page_buf);
- my_free(ReinsertList.pages, MYF(0));
+ my_free(ReinsertList.pages);
}
/* check for redundant root (not leaf, 1 child) and eliminate */
diff --git a/storage/maria/ma_rt_test.c b/storage/maria/ma_rt_test.c
index af54e6b27be..4c0ffcf72b1 100644
--- a/storage/maria/ma_rt_test.c
+++ b/storage/maria/ma_rt_test.c
@@ -684,6 +684,8 @@ static void usage()
my_print_variables(my_long_options);
}
+#include "ma_check_standalone.h"
+
#else
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
{
diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c
index 9f1e8e2554b..9e5513f388b 100644
--- a/storage/maria/ma_search.c
+++ b/storage/maria/ma_search.c
@@ -73,7 +73,7 @@ int _ma_search(register MARIA_HA *info, MARIA_KEY *key, uint32 nextflag,
{
if (nextflag & SEARCH_SAVE_BUFF)
{
- bmove512(info->keyread_buff, page_buff, info->s->block_size);
+ memcpy(info->keyread_buff, page_buff, info->s->block_size);
/* Save position for a possible read next / previous */
info->int_keypos= info->keyread_buff + info->keypos_offset;
diff --git a/storage/maria/ma_sort.c b/storage/maria/ma_sort.c
index f7f79f90cf0..c994f19d309 100644
--- a/storage/maria/ma_sort.c
+++ b/storage/maria/ma_sort.c
@@ -43,7 +43,7 @@
Pointers of functions for store and read keys from temp file
*/
-extern void print_error _VARARGS((const char *fmt,...));
+extern void print_error(const char *fmt,...);
/* Functions defined in this file */
@@ -166,7 +166,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer,
maxbuffer/2))
{
- my_free(sort_keys,MYF(0));
+ my_free(sort_keys);
sort_keys= 0;
}
else
@@ -252,7 +252,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
error =0;
err:
- my_free(sort_keys, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sort_keys);
delete_dynamic(&buffpek);
close_cached_file(&tempfile);
close_cached_file(&tempfile_for_exceptions);
@@ -391,7 +391,7 @@ pthread_handler_t _ma_thr_find_all_keys(void *arg)
if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
maxbuffer, maxbuffer/2))
{
- my_free(sort_keys, MYF(0));
+ my_free(sort_keys);
sort_keys= (uchar **) NULL; /* for err: label */
}
else
@@ -463,7 +463,7 @@ pthread_handler_t _ma_thr_find_all_keys(void *arg)
err:
DBUG_PRINT("error", ("got some error"));
sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */
- my_free(sort_keys,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sort_keys);
sort_param->sort_keys=0;
delete_dynamic(& sort_param->buffpek);
close_cached_file(&sort_param->tempfile);
@@ -516,7 +516,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
if (!sinfo->sort_keys)
{
got_error=1;
- my_free(sinfo->rec_buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sinfo->rec_buff);
continue;
}
if (!got_error)
@@ -541,8 +541,8 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
sinfo->notnull : NULL,
(ulonglong) share->state.state.records);
}
- my_free(sinfo->sort_keys,MYF(0));
- my_free(sinfo->rec_buff, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sinfo->sort_keys);
+ my_free(sinfo->rec_buff);
sinfo->sort_keys=0;
}
@@ -654,7 +654,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
}
}
}
- my_free(mergebuf,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mergebuf);
DBUG_RETURN(got_error);
}
#endif /* THREAD */
@@ -908,7 +908,7 @@ static int write_merge_key(MARIA_SORT_PARAM *info __attribute__((unused)),
If to_file == 0 then use info->key_write
*/
-static int NEAR_F
+static int
merge_buffers(MARIA_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
IO_CACHE *to_file, uchar **sort_keys, BUFFPEK *lastbuff,
BUFFPEK *Fb, BUFFPEK *Tb)
@@ -982,7 +982,7 @@ merge_buffers(MARIA_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
uchar *base= buffpek->base;
uint max_keys=buffpek->max_keys;
- VOID(queue_remove_top(&queue));
+ queue_remove_top(&queue);
/* Put room used by buffer to use in other buffer */
for (refpek= (BUFFPEK**) &queue_top(&queue);
@@ -1052,7 +1052,7 @@ err:
/* Do a merge to output-file (save only positions) */
-static int NEAR_F
+static int
merge_index(MARIA_SORT_PARAM *info, uint keys, uchar **sort_keys,
BUFFPEK *buffpek, int maxbuffer, IO_CACHE *tempfile)
{
@@ -1070,7 +1070,7 @@ static int flush_maria_ft_buf(MARIA_SORT_PARAM *info)
if (info->sort_info->ft_buf)
{
err=_ma_sort_ft_buf_flush(info);
- my_free(info->sort_info->ft_buf, MYF(0));
+ my_free(info->sort_info->ft_buf);
info->sort_info->ft_buf=0;
}
return err;
diff --git a/storage/maria/ma_sp_key.c b/storage/maria/ma_sp_key.c
index 22944a5db0a..e64dd2c6f59 100644
--- a/storage/maria/ma_sp_key.c
+++ b/storage/maria/ma_sp_key.c
@@ -57,7 +57,7 @@ MARIA_KEY *_ma_sp_make_key(MARIA_HA *info, MARIA_KEY *ret_key, uint keynr,
ret_key->data= key;
dlen = _ma_calc_blob_length(keyseg->bit_start, pos);
- memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*));
+ memcpy(&dptr, pos + keyseg->bit_start, sizeof(char*));
if (!dptr)
{
my_errno= HA_ERR_NULL_IN_SPATIAL;
diff --git a/storage/maria/ma_sp_test.c b/storage/maria/ma_sp_test.c
index b8c00753acb..1aa16e0d5e1 100644
--- a/storage/maria/ma_sp_test.c
+++ b/storage/maria/ma_sp_test.c
@@ -335,7 +335,7 @@ static void print_record(uchar * record, my_off_t offs,const char * tail)
len=sint4korr(pos);
pos+=4;
printf(" len=%d ",len);
- memcpy_fixed(&ptr,pos,sizeof(char*));
+ memcpy(&ptr,pos,sizeof(char*));
if (ptr)
maria_rtree_PrintWKB((uchar*) ptr,SPDIMS);
else
@@ -368,7 +368,7 @@ static void create_point(uchar *record,uint rownr)
pos+=4;
ptr=blob_key;
- memcpy_fixed(pos,&ptr,sizeof(char*));
+ memcpy(pos,&ptr,sizeof(char*));
}
#endif
@@ -397,7 +397,7 @@ static void create_linestring(uchar *record,uint rownr)
pos+=4;
ptr=blob_key;
- memcpy_fixed(pos,&ptr,sizeof(char*));
+ memcpy(pos,&ptr,sizeof(char*));
}
@@ -560,6 +560,8 @@ static void maria_rtree_PrintWKB(uchar *wkb, uint n_dims)
}
}
+#include "ma_check_standalone.h"
+
#else
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
{
diff --git a/storage/maria/ma_state.c b/storage/maria/ma_state.c
index ca94d58264b..49ba5da6460 100644
--- a/storage/maria/ma_state.c
+++ b/storage/maria/ma_state.c
@@ -170,7 +170,7 @@ MARIA_STATE_HISTORY
{
DBUG_PRINT("info", ("removing history->trid: %lu next: %lu",
(ulong) history->trid, (ulong) last_trid));
- my_free(history, MYF(0));
+ my_free(history);
continue;
}
*parent= history;
@@ -184,7 +184,7 @@ MARIA_STATE_HISTORY
/* There is only one state left. Delete this if it's visible for all */
if (last_trid < trnman_get_min_trid())
{
- my_free(org_history, MYF(0));
+ my_free(org_history);
org_history= 0;
}
}
@@ -248,7 +248,7 @@ void _ma_reset_state(MARIA_HA *info)
for (history= history->next ; history ; history= next)
{
next= history->next;
- my_free(history, MYF(0));
+ my_free(history);
}
share->state_history->next= 0;
share->state_history->trid= 0; /* Visibile for all */
@@ -346,11 +346,11 @@ void _ma_update_status_with_lock(MARIA_HA *info)
if (info->state == &info->state_save)
{
locked= 1;
- pthread_mutex_lock(&info->s->lock.mutex);
+ mysql_mutex_lock(&info->s->lock.mutex);
}
(*info->s->lock.update_status)(info);
if (locked)
- pthread_mutex_unlock(&info->s->lock.mutex);
+ mysql_mutex_unlock(&info->s->lock.mutex);
}
@@ -477,7 +477,7 @@ my_bool _ma_trnman_end_trans_hook(TRN *trn, my_bool commit,
/* purecov: begin inspected */
error= 1;
pthread_mutex_unlock(&share->intern_lock);
- my_free(tables, MYF(0));
+ my_free(tables);
continue;
/* purecov: end */
}
@@ -526,7 +526,7 @@ my_bool _ma_trnman_end_trans_hook(TRN *trn, my_bool commit,
pthread_mutex_unlock(&share->intern_lock);
#endif
}
- my_free(tables, MYF(0));
+ my_free(tables);
}
trn->used_tables= 0;
DBUG_RETURN(error);
@@ -561,7 +561,7 @@ void _ma_remove_table_from_trnman(MARIA_SHARE *share, TRN *trn)
*prev= tables->next;
share->in_trans--;
DBUG_PRINT("info", ("in_trans: %d", share->in_trans));
- my_free(tables, MYF(0));
+ my_free(tables);
break;
}
prev= &tables->next;
@@ -744,7 +744,7 @@ void _ma_reset_history(MARIA_SHARE *share)
for (; history; history= next)
{
next= history->next;
- my_free(history, MYF(0));
+ my_free(history);
}
DBUG_VOID_RETURN;
}
diff --git a/storage/maria/ma_static.c b/storage/maria/ma_static.c
index 917385f9568..8c572b45547 100644
--- a/storage/maria/ma_static.c
+++ b/storage/maria/ma_static.c
@@ -107,3 +107,25 @@ static int always_valid(const char *filename __attribute__((unused)))
}
int (*maria_test_invalid_symlink)(const char *filename)= always_valid;
+
+#ifdef HAVE_PSI_INTERFACE
+PSI_mutex_key ma_key_mutex_PAGECACHE_cache_lock;
+
+static PSI_mutex_info all_mutexes[]=
+{
+ { &ma_key_mutex_PAGECACHE_cache_lock, "PAGECACHE::cache_lock", 0}
+};
+
+void init_aria_psi_keys()
+{
+ const char* category= "aria";
+ int count;
+
+ if (PSI_server == NULL)
+ return;
+
+ count= array_elements(all_mutexes);
+ PSI_server->register_mutex(category, all_mutexes, count);
+}
+#endif /* HAVE_PSI_INTERFACE */
+
diff --git a/storage/maria/ma_statrec.c b/storage/maria/ma_statrec.c
index 0aa3a3acbc1..9e01e5d062a 100644
--- a/storage/maria/ma_statrec.c
+++ b/storage/maria/ma_statrec.c
@@ -284,7 +284,7 @@ int _ma_read_rnd_static_record(MARIA_HA *info, uchar *buf,
info->s->base.pack_reclength - info->s->base.reclength);
}
if (locked)
- VOID(_ma_writeinfo(info,0)); /* Unlock keyfile */
+ _ma_writeinfo(info,0); /* Unlock keyfile */
if (!error)
{
if (!buf[0])
diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c
index affa3a71634..90c9b4a9c7f 100644
--- a/storage/maria/ma_test1.c
+++ b/storage/maria/ma_test1.c
@@ -226,7 +226,7 @@ static int run_test(const char *filename)
{
if (testflag)
break;
- VOID(maria_close(file));
+ maria_close(file);
exit(0);
}
j=i%25 +1;
@@ -314,7 +314,7 @@ static int run_test(const char *filename)
found=0;
while ((error= maria_scan(file,read_record)) == 0)
{
- if (--update_count == 0) { VOID(maria_close(file)) ; exit(0) ; }
+ if (--update_count == 0) { maria_close(file); exit(0) ; }
memcpy(record,read_record,rec_length);
update_record(record);
if (maria_update(file,read_record,record))
@@ -596,7 +596,7 @@ static void create_record(uchar *record,uint rownr)
tmp=strlen((char*) blob_key);
int4store(pos,tmp);
ptr=blob_key;
- memcpy_fixed(pos+4,&ptr,sizeof(char*));
+ memcpy(pos+4,&ptr,sizeof(char*));
pos+=recinfo[0].length;
}
else if (recinfo[0].type == FIELD_VARCHAR)
@@ -624,7 +624,7 @@ static void create_record(uchar *record,uint rownr)
tmp=strlen((char*) blob_record);
int4store(pos,tmp);
ptr=blob_record;
- memcpy_fixed(pos+4,&ptr,sizeof(char*));
+ memcpy(pos+4,&ptr,sizeof(char*));
}
else if (recinfo[1].type == FIELD_VARCHAR)
{
@@ -653,10 +653,10 @@ static void update_record(uchar *record)
uchar *column,*ptr;
int length;
length=uint4korr(pos); /* Long blob */
- memcpy_fixed(&column,pos+4,sizeof(char*));
+ memcpy(&column,pos+4,sizeof(char*));
memcpy(blob_key,column,length); /* Move old key */
ptr=blob_key;
- memcpy_fixed(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */
+ memcpy(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
default_charset_info->cset->casedn(default_charset_info,
(char*) blob_key, length,
@@ -686,13 +686,13 @@ static void update_record(uchar *record)
uchar *column;
int length;
length=uint4korr(pos);
- memcpy_fixed(&column,pos+4,sizeof(char*));
+ memcpy(&column,pos+4,sizeof(char*));
memcpy(blob_record,column,length);
bfill(blob_record+length,20,'.'); /* Make it larger */
length+=20;
int4store(pos,length);
column=blob_record;
- memcpy_fixed(pos+4,&column,sizeof(char*));
+ memcpy(pos+4,&column,sizeof(char*));
}
else if (recinfo[1].type == FIELD_VARCHAR)
{
@@ -897,3 +897,6 @@ static void usage()
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
+
+#include "ma_check_standalone.h"
+
diff --git a/storage/maria/ma_test2.c b/storage/maria/ma_test2.c
index 9e2f32f767b..25684bdb61c 100644
--- a/storage/maria/ma_test2.c
+++ b/storage/maria/ma_test2.c
@@ -887,7 +887,7 @@ int main(int argc, char *argv[])
{
ulong blob_length,pos;
uchar *ptr;
- memcpy_fixed(&ptr, read_record+blob_pos+4, sizeof(ptr));
+ memcpy(&ptr, read_record+blob_pos+4, sizeof(ptr));
blob_length= uint4korr(read_record+blob_pos);
for (pos=0 ; pos < blob_length ; pos++)
{
@@ -1015,7 +1015,7 @@ reads: %10lu\n",
(ulong) maria_pagecache->global_cache_read);
}
maria_end();
- my_free(blob_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(blob_buffer);
my_end(silent ? MY_CHECK_ERROR : MY_CHECK_ERROR | MY_GIVE_INFO);
return(0);
err:
@@ -1024,7 +1024,7 @@ err:
{
if (maria_commit(file))
goto err;
- VOID(maria_close(file));
+ maria_close(file);
}
maria_end();
return(1);
@@ -1221,7 +1221,7 @@ static void put_blob_in_record(uchar *blob_pos, char **blob_buffer,
for (i=0 ; i < length ; i++)
(*blob_buffer)[i]=(char) (length+i);
int4store(blob_pos,length);
- memcpy_fixed(blob_pos+4,(char*) blob_buffer,sizeof(char*));
+ memcpy(blob_pos+4, blob_buffer, sizeof(char*));
*blob_length= length;
}
else
@@ -1244,3 +1244,6 @@ static void copy_key(MARIA_HA *info,uint inx,uchar *rec,uchar *key_buff)
}
return;
}
+
+#include "ma_check_standalone.h"
+
diff --git a/storage/maria/ma_test3.c b/storage/maria/ma_test3.c
index 040d6fa78c2..d2ce68fc063 100644
--- a/storage/maria/ma_test3.c
+++ b/storage/maria/ma_test3.c
@@ -15,7 +15,7 @@
/* Test av locking */
-#if !(defined (__NETWARE_) || defined (_WIN32)) /*no fork() in Windows*/
+#ifndef _WIN32 /*no fork() in Windows*/
#include "maria.h"
#include <sys/types.h>
@@ -114,7 +114,7 @@ int main(int argc,char **argv)
sleep(1);
return 0;
}
- VOID(rnd(1));
+ rnd(1);
}
for (i=0 ; i < forks ; i++)
@@ -460,7 +460,7 @@ int test_update(MARIA_HA *file,int id,int lock_type)
}
}
}
- memcpy_fixed(new_record.id,record.id,sizeof(record.id));
+ memcpy(new_record.id,record.id,sizeof(record.id));
tmp=rnd(20000)+40000;
int4store(new_record.nr,tmp);
if (!maria_update(file,record.id,new_record.id))
@@ -488,14 +488,17 @@ int test_update(MARIA_HA *file,int id,int lock_type)
return 0;
}
-#else /* __NETWARE__ || __WIN__ */
+#include "ma_check_standalone.h"
+
+#else /* _WIN32 */
#include <stdio.h>
int main()
{
- fprintf(stderr,"this test has not been ported to Netware or Windows\n");
+ fprintf(stderr,"this test has not been ported to Windows\n");
return 0;
}
-#endif /* __NETWARE__|| __WIN__ */
+#endif /* _WIN32 */
+
diff --git a/storage/maria/ma_unique.c b/storage/maria/ma_unique.c
index a90578c2162..d9f8306488e 100644
--- a/storage/maria/ma_unique.c
+++ b/storage/maria/ma_unique.c
@@ -123,7 +123,7 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record)
else if (keyseg->flag & HA_BLOB_PART)
{
uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos);
- memcpy_fixed((uchar*) &pos,pos+keyseg->bit_start,sizeof(char*));
+ memcpy(&pos,pos+keyseg->bit_start,sizeof(char*));
if (!length || length > tmp_length)
length=tmp_length; /* The whole blob */
}
@@ -218,8 +218,8 @@ my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const uchar *a, const uchar *b,
set_if_smaller(a_length, keyseg->length);
set_if_smaller(b_length, keyseg->length);
}
- memcpy_fixed((uchar*) &pos_a,pos_a+keyseg->bit_start,sizeof(char*));
- memcpy_fixed((uchar*) &pos_b,pos_b+keyseg->bit_start,sizeof(char*));
+ memcpy(&pos_a, pos_a+keyseg->bit_start, sizeof(char*));
+ memcpy(&pos_b, pos_b+keyseg->bit_start, sizeof(char*));
}
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 ||
type == HA_KEYTYPE_VARTEXT2)
diff --git a/storage/maria/ma_update.c b/storage/maria/ma_update.c
index 7b9e006ec43..31459d8587a 100644
--- a/storage/maria/ma_update.c
+++ b/storage/maria/ma_update.c
@@ -185,7 +185,7 @@ int maria_update(register MARIA_HA *info, const uchar *oldrec, uchar *newrec)
ma_update() must always pass !0 value as operation, since even if
there is no index change there could be data change.
*/
- VOID(_ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE));
+ _ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0)
{
@@ -242,7 +242,7 @@ err:
key_changed);
err_end:
- VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
+ _ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
allow_break(); /* Allow SIGHUP & SIGINT */
if (save_errno == HA_ERR_KEY_NOT_FOUND)
{
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index 02eeec754ee..9af17e14978 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -294,7 +294,7 @@ int maria_write(MARIA_HA *info, uchar *record)
info->state->changed= 1;
info->cur_row.lastpos= filepos;
- VOID(_ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE));
+ _ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE);
if (info->invalidator != 0)
{
DBUG_PRINT("info", ("invalidator... '%s' (update)",
@@ -399,7 +399,7 @@ err2:
if (!save_errno)
save_errno= HA_ERR_INTERNAL_ERROR; /* Should never happen */
DBUG_PRINT("error", ("got error: %d", save_errno));
- VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
+ _ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(my_errno=save_errno);
} /* maria_write */
@@ -444,7 +444,7 @@ static my_bool _ma_ck_write_btree(MARIA_HA *info, MARIA_KEY *key)
if (!error)
error= _ma_ft_convert_to_ft2(info, key);
delete_dynamic(info->ft1_to_ft2);
- my_free(info->ft1_to_ft2, MYF(0));
+ my_free(info->ft1_to_ft2);
info->ft1_to_ft2=0;
}
DBUG_RETURN(error);
@@ -469,7 +469,6 @@ static my_bool _ma_ck_write_btree_with_log(MARIA_HA *info, MARIA_KEY *key,
MARIA_KEY org_key;
DBUG_ENTER("_ma_ck_write_btree_with_log");
- LINT_INIT_STRUCT(org_key);
if (share->now_transactional)
{
/* Save original value as the key may change */
@@ -1789,7 +1788,7 @@ void maria_end_bulk_insert(MARIA_HA *info)
delete_tree(&info->bulk_insert[i]);
}
}
- my_free(info->bulk_insert, MYF(0));
+ my_free(info->bulk_insert);
info->bulk_insert= 0;
}
DBUG_VOID_RETURN;
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 4e19d5878ea..8de969b9b07 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -27,7 +27,6 @@
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
-SET_STACK_SIZE(9000) /* Minimum stack size for program */
#ifndef USE_RAID
#define my_raid_create(A,B,C,D,E,F,G) my_create(A,B,C,G)
@@ -150,8 +149,8 @@ int main(int argc, char **argv)
int new_error=maria_chk(&check_param, *(argv++));
if ((check_param.testflag & T_REP_ANY) != T_REP)
check_param.testflag&= ~T_REP;
- VOID(fflush(stdout));
- VOID(fflush(stderr));
+ fflush(stdout);
+ fflush(stderr);
if ((check_param.error_printed | check_param.warning_printed) &&
(check_param.testflag & T_FORCE_CREATE) &&
(!(check_param.testflag & (T_REP | T_REP_BY_SORT | T_SORT_RECORDS |
@@ -163,8 +162,8 @@ int main(int argc, char **argv)
check_param.testflag&= ~T_EXTEND; /* Not needed */
error|=maria_chk(&check_param, argv[-1]);
check_param.testflag= old_testflag;
- VOID(fflush(stdout));
- VOID(fflush(stderr));
+ fflush(stdout);
+ fflush(stderr);
}
else
error|=new_error;
@@ -172,7 +171,7 @@ int main(int argc, char **argv)
check_param.testflag & T_INFO))
{
puts("\n---------\n");
- VOID(fflush(stdout));
+ fflush(stdout);
}
}
end:
@@ -421,13 +420,10 @@ static struct my_option my_long_options[] =
};
-#include <help_start.h>
-
static void print_version(void)
{
printf("%s Ver 1.0 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
- NETWARE_SET_SCREEN_MODE(1);
}
@@ -564,8 +560,6 @@ Recover (repair)/ options (When using '--recover' or '--safe-recover'):\n\
my_print_variables(my_long_options);
}
-#include <help_end.h>
-
const char *maria_stats_method_names[] = {"nulls_unequal", "nulls_equal",
"nulls_ignored", NullS};
TYPELIB maria_stats_method_typelib= {
@@ -874,9 +868,8 @@ static void get_options(register int *argc,register char ***argv)
if ((check_param.testflag & T_UNPACK) &&
(check_param.testflag & (T_QUICK | T_SORT_RECORDS)))
{
- VOID(fprintf(stderr,
- "%s: --unpack can't be used with --quick or --sort-records\n",
- my_progname_short));
+ fprintf(stderr, "%s: --unpack can't be used with --quick or --sort-records\n",
+ my_progname_short);
exit(1);
}
if ((check_param.testflag & T_READONLY) &&
@@ -884,9 +877,8 @@ static void get_options(register int *argc,register char ***argv)
(T_REP_ANY | T_STATISTICS | T_AUTO_INC |
T_SORT_RECORDS | T_SORT_INDEX | T_FORCE_CREATE)))
{
- VOID(fprintf(stderr,
- "%s: Can't use --readonly when repairing or sorting\n",
- my_progname_short));
+ fprintf(stderr, "%s: Can't use --readonly when repairing or sorting\n",
+ my_progname_short);
exit(1);
}
@@ -1065,9 +1057,8 @@ static int maria_chk(HA_CHECK *param, char *filename)
param->language= set_collation->number;
if (maria_recreate_table(param, &info,filename))
{
- VOID(fprintf(stderr,
- "Aria table '%s' is not fixed because of errors\n",
- filename));
+ fprintf(stderr, "Aria table '%s' is not fixed because of errors\n",
+ filename);
return(-1);
}
recreate=1;
@@ -1209,7 +1200,7 @@ static int maria_chk(HA_CHECK *param, char *filename)
#ifndef TO_BE_REMOVED
if (param->out_flag & O_NEW_DATA)
{ /* Change temp file to org file */
- VOID(my_close(info->dfile.file, MYF(MY_WME))); /* Close new file */
+ my_close(info->dfile.file, MYF(MY_WME)); /* Close new file */
error|=maria_change_to_newfile(filename,MARIA_NAME_DEXT,DATA_TMP_EXT,
MYF(0));
if (_ma_open_datafile(info,info->s, NullS, -1))
@@ -1286,20 +1277,20 @@ static int maria_chk(HA_CHECK *param, char *filename)
if ((!rep_quick && !error) ||
!(param->testflag & (T_FAST | T_FORCE_CREATE)))
{
- VOID(init_io_cache(&param->read_cache,datafile,
+ init_io_cache(&param->read_cache,datafile,
(uint) param->read_buffer_length,
READ_CACHE,
(param->start_check_pos ?
param->start_check_pos :
share->pack.header_length),
1,
- MYF(MY_WME)));
+ MYF(MY_WME));
maria_lock_memory(param);
if ((info->s->data_file_type != STATIC_RECORD) ||
(param->testflag & (T_EXTEND | T_MEDIUM)))
error|=maria_chk_data_link(param, info,
test(param->testflag & T_EXTEND));
- VOID(end_io_cache(&param->read_cache));
+ end_io_cache(&param->read_cache);
}
if (!error)
{
@@ -1368,31 +1359,31 @@ end2:
llstr(param->max_found_trid, buff));
}
- VOID(fflush(stdout)); VOID(fflush(stderr));
+ fflush(stdout);
+ fflush(stderr);
if (param->error_printed)
{
if (param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX))
{
- VOID(fprintf(stderr,
- "Aria table '%s' is not fixed because of errors\n",
- filename));
+ fprintf(stderr, "Aria table '%s' is not fixed because of errors\n",
+ filename);
if (param->testflag & T_REP_ANY)
- VOID(fprintf(stderr,
- "Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag\n"));
+ fprintf(stderr, "Try fixing it by using the --safe-recover (-o), "
+ "the --force (-f) option or by not using the --quick (-q) "
+ "flag\n");
}
else if (!(param->error_printed & 2) &&
!(param->testflag & T_FORCE_CREATE))
- VOID(fprintf(stderr,
- "Aria table '%s' is corrupted\nFix it using switch \"-r\" or \"-o\"\n",
- filename));
+ fprintf(stderr, "Aria table '%s' is corrupted\nFix it using switch "
+ "\"-r\" or \"-o\"\n", filename);
}
else if (param->warning_printed &&
! (param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX |
T_FORCE_CREATE)))
- VOID(fprintf(stderr, "Aria table '%s' is usable but should be fixed\n",
- filename));
- VOID(fflush(stderr));
+ fprintf(stderr, "Aria table '%s' is usable but should be fixed\n",
+ filename);
+ fflush(stderr);
DBUG_RETURN(error);
} /* maria_chk */
@@ -1528,7 +1519,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
printf("Recordlength: %16d\n",(int) share->base.pack_reclength);
if (! maria_is_all_keys_active(share->state.key_map, share->base.keys))
{
- longlong2str(share->state.key_map,buff,2,1);
+ longlong2str(share->state.key_map,buff,2);
printf("Using only keys '%s' of %d possibly keys\n",
buff, share->base.keys);
}
@@ -1536,7 +1527,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
printf("Key Start Len Index Type");
if (param->testflag & T_VERBOSE)
printf(" Rec/key Root Blocksize");
- VOID(putchar('\n'));
+ putchar('\n');
for (key=keyseg_nr=0, keyinfo= &share->keyinfo[0] ;
key < share->base.keys;
@@ -1575,7 +1566,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
printf("%9.0f %12s %10d",
share->state.rec_per_key_part[keyseg_nr++],
buff,keyinfo->block_length);
- VOID(putchar('\n'));
+ putchar('\n');
while ((++keyseg)->type != HA_KEYTYPE_END)
{
pos=buff;
@@ -1594,7 +1585,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
(long) keyseg->start+1,keyseg->length,buff);
if (param->testflag & T_VERBOSE)
printf("%11.0f", share->state.rec_per_key_part[keyseg_nr++]);
- VOID(putchar('\n'));
+ putchar('\n');
}
keyseg++;
}
@@ -1632,7 +1623,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
printf("\nField Start Length Nullpos Nullbit Type");
if (share->options & HA_OPTION_COMPRESS_RECORD)
printf(" Huff tree Bits");
- VOID(putchar('\n'));
+ putchar('\n');
for (field=0 ; field < share->base.fields ; field++)
{
@@ -1672,7 +1663,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
(uint) (share->columndef[field].huff_tree-share->decode_trees)+1,
share->columndef[field].huff_tree->quick_table_bits);
}
- VOID(putchar('\n'));
+ putchar('\n');
}
if (share->data_file_type == BLOCK_RECORD)
{
@@ -1839,7 +1830,7 @@ static int maria_sort_records(HA_CHECK *param,
goto err;
}
- VOID(my_close(info->dfile.file, MYF(MY_WME)));
+ my_close(info->dfile.file, MYF(MY_WME));
param->out_flag|=O_NEW_DATA; /* Data in new file */
info->dfile.file= new_file; /* Use new datafile */
_ma_set_data_pagecache_callbacks(&info->dfile, info->s);
@@ -1855,14 +1846,15 @@ static int maria_sort_records(HA_CHECK *param,
if (param->testflag & T_WRITE_LOOP)
{
- VOID(fputs(" \r",stdout)); VOID(fflush(stdout));
+ fputs(" \r",stdout);
+ fflush(stdout);
}
got_error=0;
err:
if (got_error && new_file >= 0)
{
- VOID(end_io_cache(&info->rec_cache));
+ end_io_cache(&info->rec_cache);
(void) my_close(new_file,MYF(MY_WME));
(void) my_delete(param->temp_filename, MYF(MY_WME));
}
@@ -1870,10 +1862,10 @@ err:
{
my_afree(temp_buff);
}
- my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(sort_param.record);
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
- VOID(end_io_cache(&info->rec_cache));
- my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
+ end_io_cache(&info->rec_cache);
+ my_free(sort_info.buff);
sort_info.buff=0;
share->state.sortkey=sort_key;
DBUG_RETURN(got_error);
@@ -1919,7 +1911,6 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param,
endpos= ma_page->buff + used_length;
for ( ;; )
{
- _sanity(__FILE__,__LINE__);
if (nod_flag)
{
next_page= _ma_kpos(nod_flag, keypos);
@@ -1937,7 +1928,6 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param,
new_file, update_index))
goto err;
}
- _sanity(__FILE__,__LINE__);
if (keypos >= endpos ||
!(*keyinfo->get_key)(&tmp_key, page_flag, nod_flag, &keypos))
break;
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index ba97684b1aa..e1ebde515dd 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -1188,11 +1188,11 @@ int _ma_flush_table_files(MARIA_HA *info, uint flush_data_or_index,
See ma_check_standalone.h .
*/
int _ma_killed_ptr(HA_CHECK *param);
-void _ma_check_print_error _VARARGS((HA_CHECK *param, const char *fmt, ...))
+void _ma_check_print_error(HA_CHECK *param, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 2, 3);
-void _ma_check_print_warning _VARARGS((HA_CHECK *param, const char *fmt, ...))
+void _ma_check_print_warning(HA_CHECK *param, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 2, 3);
-void _ma_check_print_info _VARARGS((HA_CHECK *param, const char *fmt, ...))
+void _ma_check_print_info(HA_CHECK *param, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 2, 3);
my_bool write_log_record_for_repair(const HA_CHECK *param, MARIA_HA *info);
C_MODE_END
@@ -1265,3 +1265,18 @@ extern PAGECACHE *maria_log_pagecache;
extern void ma_set_index_cond_func(MARIA_HA *info, index_cond_func_t func,
void *func_arg);
int ma_check_index_cond(register MARIA_HA *info, uint keynr, uchar *record);
+
+#ifdef HAVE_PSI_INTERFACE
+extern PSI_mutex_key ma_key_mutex_PAGECACHE_cache_lock;
+
+//extern PSI_rwlock_key mi_key_rwlock_MYISAM_SHARE_key_root_lock;
+
+//extern PSI_cond_key mi_key_cond_MI_SORT_INFO_cond;
+
+//extern PSI_file_key mi_key_file_datatmp;
+
+//extern PSI_thread_key mi_key_thread_find_all_keys;
+
+void init_aria_psi_keys();
+#endif /* HAVE_PSI_INTERFACE */
+
diff --git a/storage/maria/maria_ftdump.c b/storage/maria/maria_ftdump.c
index 870d07fa96e..92e57fa9a1e 100644
--- a/storage/maria/maria_ftdump.c
+++ b/storage/maria/maria_ftdump.c
@@ -259,18 +259,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
return 0;
}
-#include <help_start.h>
static void usage()
{
printf("Use: aria_ft_dump <table_name> <index_num>\n");
my_print_help(my_long_options);
my_print_variables(my_long_options);
- NETWARE_SET_SCREEN_MODE(1);
exit(1);
}
-#include <help_end.h>
static void complain(int val) /* Kinda assert :-) */
{
@@ -280,3 +277,6 @@ static void complain(int val) /* Kinda assert :-) */
exit(1);
}
}
+
+#include "ma_check_standalone.h"
+
diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c
index 1d2d3995bd8..351a2014059 100644
--- a/storage/maria/maria_pack.c
+++ b/storage/maria/maria_pack.c
@@ -239,8 +239,8 @@ int main(int argc, char **argv)
}
if (ok && isamchk_neaded && !silent)
puts("Remember to run aria_chk -rq on compressed tables");
- VOID(fflush(stdout));
- VOID(fflush(stderr));
+ fflush(stdout);
+ fflush(stderr);
free_defaults(default_argv);
maria_end();
my_end(verbose ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
@@ -289,13 +289,10 @@ static struct my_option my_long_options[] =
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-#include <help_start.h>
static void print_version(void)
{
- VOID(printf("%s Ver 1.0 for %s on %s\n",
- my_progname, SYSTEM_TYPE, MACHINE_TYPE));
- NETWARE_SET_SCREEN_MODE(1);
+ printf("%s Ver 1.0 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
@@ -312,13 +309,12 @@ static void usage(void)
puts("You should give the .MAI file as the filename argument.");
puts("To unpack a packed table, run aria_chk -u on the table");
- VOID(printf("\nUsage: %s [OPTIONS] filename...\n", my_progname));
+ printf("\nUsage: %s [OPTIONS] filename...\n", my_progname);
my_print_help(my_long_options);
print_defaults("my", load_default_groups);
my_print_variables(my_long_options);
}
-#include <help_end.h>
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
@@ -410,7 +406,7 @@ static MARIA_HA *open_maria_file(char *name,int mode)
(opt_wait ? HA_OPEN_WAIT_IF_LOCKED :
HA_OPEN_ABORT_IF_LOCKED))))
{
- VOID(fprintf(stderr, "%s gave error %d on open\n", name, my_errno));
+ fprintf(stderr, "%s gave error %d on open\n", name, my_errno);
DBUG_RETURN(0);
}
share=isam_file->s;
@@ -418,8 +414,8 @@ static MARIA_HA *open_maria_file(char *name,int mode)
{
if (!force_pack)
{
- VOID(fprintf(stderr, "%s is already compressed\n", name));
- VOID(maria_close(isam_file));
+ fprintf(stderr, "%s is already compressed\n", name);
+ maria_close(isam_file);
DBUG_RETURN(0);
}
if (verbose)
@@ -430,11 +426,11 @@ static MARIA_HA *open_maria_file(char *name,int mode)
(share->state.state.records <= 1 ||
share->state.state.data_file_length < 1024))
{
- VOID(fprintf(stderr, "%s is too small to compress\n", name));
- VOID(maria_close(isam_file));
+ fprintf(stderr, "%s is too small to compress\n", name);
+ maria_close(isam_file);
DBUG_RETURN(0);
}
- VOID(maria_lock_database(isam_file,F_WRLCK));
+ maria_lock_database(isam_file,F_WRLCK);
maria_ignore_trids(isam_file);
DBUG_RETURN(isam_file);
}
@@ -477,12 +473,12 @@ static my_bool open_maria_files(PACK_MRG_INFO *mrg,char **names,uint count)
return 0;
diff_file:
- VOID(fprintf(stderr, "%s: Tables '%s' and '%s' are not identical\n",
- my_progname, names[j], names[j+1]));
+ fprintf(stderr, "%s: Tables '%s' and '%s' are not identical\n",
+ my_progname, names[j], names[j+1]);
error:
while (i--)
maria_close(mrg->file[i]);
- my_free(mrg->file, MYF(0));
+ my_free(mrg->file);
return 1;
}
@@ -510,11 +506,9 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
/* Create temporary or join file */
if (backup)
- VOID(fn_format(org_name,isam_file->s->open_file_name.str,
- "",MARIA_NAME_DEXT, 2));
+ fn_format(org_name,isam_file->s->open_file_name.str, "",MARIA_NAME_DEXT, 2);
else
- VOID(fn_format(org_name,isam_file->s->open_file_name.str,
- "",MARIA_NAME_DEXT, 2+4+16));
+ fn_format(org_name,isam_file->s->open_file_name.str, "",MARIA_NAME_DEXT, 2+4+16);
if (init_pagecache(maria_pagecache, MARIA_MIN_PAGE_CACHE_SIZE, 0, 0,
maria_block_size, MY_WME) == 0)
@@ -529,7 +523,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
uint length;
uchar *buff;
strmov(org_name,result_table); /* Fix error messages */
- VOID(fn_format(new_name,result_table,"",MARIA_NAME_IEXT,2));
+ fn_format(new_name,result_table,"",MARIA_NAME_IEXT,2);
if ((join_maria_file=my_create(new_name,0,tmpfile_createflag,MYF(MY_WME)))
< 0)
goto err;
@@ -540,16 +534,16 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
my_write(join_maria_file,buff,length,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)))
{
- my_free(buff,MYF(0));
+ my_free(buff);
goto err;
}
- my_free(buff,MYF(0));
- VOID(fn_format(new_name,result_table,"",MARIA_NAME_DEXT,2));
+ my_free(buff);
+ fn_format(new_name,result_table,"",MARIA_NAME_DEXT,2);
}
else if (!tmp_dir[0])
- VOID(make_new_name(new_name,org_name));
+ make_new_name(new_name,org_name);
else
- VOID(fn_format(new_name,org_name,tmp_dir,DATA_TMP_EXT,1+2+4));
+ fn_format(new_name,org_name,tmp_dir,DATA_TMP_EXT,1+2+4);
if (!test_only &&
(new_file=my_create(new_name,0,tmpfile_createflag,MYF(MY_WME))) < 0)
goto err;
@@ -565,22 +559,21 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
(ulong) mrg->records));
if (write_loop || verbose)
{
- VOID(printf("Compressing %s: (%lu records)\n",
- result_table ? new_name : org_name, (ulong) mrg->records));
+ printf("Compressing %s: (%lu records)\n",
+ result_table ? new_name : org_name, (ulong) mrg->records);
}
trees=fields=share->base.fields;
huff_counts=init_huff_count(isam_file,mrg->records);
- QUICK_SAFEMALLOC;
/*
Read the whole data file(s) for statistics.
*/
DBUG_PRINT("info", ("- Calculating statistics"));
if (write_loop || verbose)
- VOID(printf("- Calculating statistics\n"));
+ printf("- Calculating statistics\n");
if (get_statistic(mrg,huff_counts))
goto err;
- NORMAL_SAFEMALLOC;
+
old_length=0;
for (i=0; i < mrg->count ; i++)
old_length+= (mrg->file[i]->s->state.state.data_file_length -
@@ -627,7 +620,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
*/
file_buffer.pos_in_file=HEAD_LENGTH;
if (! test_only)
- VOID(my_seek(new_file,file_buffer.pos_in_file,MY_SEEK_SET,MYF(0)));
+ my_seek(new_file,file_buffer.pos_in_file,MY_SEEK_SET,MYF(0));
/*
Write field infos: field type, pack type, length bits, tree number.
@@ -653,7 +646,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
*/
DBUG_PRINT("info", ("- Compressing file"));
if (write_loop || verbose)
- VOID(printf("- Compressing file\n"));
+ printf("- Compressing file\n");
error=compress_maria_file(mrg,huff_counts);
new_length=file_buffer.pos_in_file;
if (!error && !test_only)
@@ -680,9 +673,9 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
mrg->min_pack_length, mrg->max_pack_length,
(ulong) (mrg->records ? (new_length/mrg->records) : 0)));
if (verbose && mrg->records)
- VOID(printf("Min record length: %6d Max length: %6d "
+ printf("Min record length: %6d Max length: %6d "
"Mean total length: %6ld\n", mrg->min_pack_length,
- mrg->max_pack_length, (ulong) (new_length/mrg->records)));
+ mrg->max_pack_length, (ulong) (new_length/mrg->records));
/* Close source and target file. */
if (!test_only)
@@ -720,9 +713,9 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
error=my_rename(new_name,org_name,MYF(MY_WME));
if (!error)
{
- VOID(my_copystat(temp_name,org_name,MYF(MY_COPYTIME)));
+ my_copystat(temp_name,org_name,MYF(MY_COPYTIME));
if (tmp_dir[0])
- VOID(my_delete(new_name,MYF(MY_WME)));
+ my_delete(new_name,MYF(MY_WME));
}
}
}
@@ -733,7 +726,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
error=my_copy(new_name,org_name,
MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_COPYTIME));
if (!error)
- VOID(my_delete(new_name,MYF(MY_WME)));
+ my_delete(new_name,MYF(MY_WME));
}
else
error=my_redel(org_name,new_name,MYF(MY_WME | MY_COPYTIME));
@@ -747,16 +740,16 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
error|=my_close(join_maria_file,MYF(MY_WME));
if (error)
{
- VOID(fprintf(stderr, "Aborting: %s is not compressed\n", org_name));
- VOID(my_delete(new_name,MYF(MY_WME)));
+ fprintf(stderr, "Aborting: %s is not compressed\n", org_name);
+ my_delete(new_name,MYF(MY_WME));
DBUG_RETURN(-1);
}
if (write_loop || verbose)
{
if (old_length)
- VOID(printf("%.4g%% \n",
+ printf("%.4g%% \n",
(((longlong) (old_length - new_length)) * 100.0 /
- (longlong) old_length)));
+ (longlong) old_length));
else
puts("Empty file saved in compressed format");
}
@@ -766,11 +759,11 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
end_pagecache(maria_pagecache, 1);
free_counts_and_tree_and_queue(huff_trees,trees,huff_counts,fields);
if (new_file >= 0)
- VOID(my_close(new_file,MYF(0)));
+ my_close(new_file,MYF(0));
if (join_maria_file >= 0)
- VOID(my_close(join_maria_file,MYF(0)));
+ my_close(join_maria_file,MYF(0));
mrg_close(mrg);
- VOID(fprintf(stderr, "Aborted: %s is not compressed\n", org_name));
+ fprintf(stderr, "Aborted: %s is not compressed\n", org_name);
DBUG_RETURN(-1);
}
@@ -828,11 +821,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
for (i=0 ; i < trees ; i++)
{
if (huff_trees[i].element_buffer)
- my_free(huff_trees[i].element_buffer,MYF(0));
+ my_free(huff_trees[i].element_buffer);
if (huff_trees[i].code)
- my_free(huff_trees[i].code,MYF(0));
+ my_free(huff_trees[i].code);
}
- my_free(huff_trees,MYF(0));
+ my_free(huff_trees);
}
if (huff_counts)
{
@@ -840,11 +833,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees,
{
if (huff_counts[i].tree_buff)
{
- my_free(huff_counts[i].tree_buff,MYF(0));
+ my_free(huff_counts[i].tree_buff);
delete_tree(&huff_counts[i].int_tree);
}
}
- my_free(huff_counts, MYF(0));
+ my_free(huff_counts);
}
delete_queue(&queue); /* This is safe to free */
return;
@@ -940,7 +933,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
count->int_tree.elements_in_tree > 1))
{
delete_tree(&count->int_tree);
- my_free(count->tree_buff,MYF(0));
+ my_free(count->tree_buff);
count->tree_buff=0;
}
else
@@ -1019,7 +1012,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
{
uint field_length=count->field_length -portable_sizeof_char_ptr;
ulong blob_length= _ma_calc_blob_length(field_length, start_pos);
- memcpy_fixed((char*) &pos, start_pos+field_length,sizeof(char*));
+ memcpy(&pos, start_pos+field_length,sizeof(char*));
end_pos=pos+blob_length;
tot_blob_length+=blob_length;
set_if_bigger(count->max_length,blob_length);
@@ -1078,13 +1071,13 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
record_count++;
if (write_loop && record_count % WRITE_COUNT == 0)
{
- VOID(printf("%lu\r", (ulong) record_count));
- VOID(fflush(stdout));
+ printf("%lu\r", (ulong) record_count);
+ fflush(stdout);
}
}
else if (error != HA_ERR_RECORD_DELETED)
{
- VOID(fprintf(stderr, "Got error %d while reading rows\n", error));
+ fprintf(stderr, "Got error %d while reading rows\n", error);
break;
}
@@ -1092,8 +1085,8 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
}
if (write_loop)
{
- VOID(printf(" \r"));
- VOID(fflush(stdout));
+ printf(" \r");
+ fflush(stdout);
}
/*
@@ -1105,8 +1098,8 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
DBUG_PRINT("info", ("Found the following number of incidents "
"of the uchar codes:"));
if (verbose >= 2)
- VOID(printf("Found the following number of incidents "
- "of the uchar codes:\n"));
+ printf("Found the following number of incidents "
+ "of the uchar codes:\n");
for (count= huff_counts ; count < end_count; count++)
{
uint idx;
@@ -1115,16 +1108,16 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
DBUG_PRINT("info", ("column: %3u", (uint) (count - huff_counts + 1)));
if (verbose >= 2)
- VOID(printf("column: %3u\n", (uint) (count - huff_counts + 1)));
+ printf("column: %3u\n", (uint) (count - huff_counts + 1));
if (count->tree_buff)
{
DBUG_PRINT("info", ("number of distinct values: %u",
(uint) ((count->tree_pos - count->tree_buff) /
count->field_length)));
if (verbose >= 2)
- VOID(printf("number of distinct values: %u\n",
+ printf("number of distinct values: %u\n",
(uint) ((count->tree_pos - count->tree_buff) /
- count->field_length)));
+ count->field_length));
}
total_count= 0;
for (idx= 0; idx < 256; idx++)
@@ -1135,16 +1128,16 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
DBUG_PRINT("info", ("counts[0x%02x]: %12s", idx,
llstr((longlong) count->counts[idx], llbuf)));
if (verbose >= 2)
- VOID(printf("counts[0x%02x]: %12s\n", idx,
- llstr((longlong) count->counts[idx], llbuf)));
+ printf("counts[0x%02x]: %12s\n", idx,
+ llstr((longlong) count->counts[idx], llbuf));
}
}
DBUG_PRINT("info", ("total: %12s", llstr((longlong) total_count,
llbuf)));
if ((verbose >= 2) && total_count)
{
- VOID(printf("total: %12s\n",
- llstr((longlong) total_count, llbuf)));
+ printf("total: %12s\n",
+ llstr((longlong) total_count, llbuf));
}
}
@@ -1337,12 +1330,12 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
}
else
{
- my_free(huff_counts->tree_buff,MYF(0));
+ my_free(huff_counts->tree_buff);
delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff=0;
}
if (tree.element_buffer)
- my_free(tree.element_buffer,MYF(0));
+ my_free(tree.element_buffer);
}
if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS)
space_fields++;
@@ -1361,7 +1354,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
field_count[FIELD_INTERVALL],
field_count[FIELD_ZERO]));
if (verbose)
- VOID(printf("\nnormal: %3d empty-space: %3d "
+ printf("\nnormal: %3d empty-space: %3d "
"empty-zero: %3d empty-fill: %3d\n"
"pre-space: %3d end-space: %3d "
"intervall-fields: %3d zero: %3d\n",
@@ -1370,7 +1363,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
field_count[FIELD_SKIP_PRESPACE],
field_count[FIELD_SKIP_ENDSPACE],
field_count[FIELD_INTERVALL],
- field_count[FIELD_ZERO]));
+ field_count[FIELD_ZERO]);
DBUG_VOID_RETURN;
}
@@ -1460,8 +1453,8 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees)
if (make_huff_tree(huff_tree+tree,huff_counts+tree))
{
while (tree--)
- my_free(huff_tree[tree].element_buffer,MYF(0));
- my_free(huff_tree,MYF(0));
+ my_free(huff_tree[tree].element_buffer);
+ my_free(huff_tree);
DBUG_RETURN(0);
}
}
@@ -1861,9 +1854,8 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees)
i->tree->tree_pack_length+j->tree->tree_pack_length+
ALLOWED_JOIN_DIFF)
{
- memcpy_fixed((uchar*) i->counts,(uchar*) count.counts,
- sizeof(count.counts[0])*256);
- my_free((uchar*) j->tree->element_buffer,MYF(0));
+ memcpy(i->counts,(uchar*) count.counts, sizeof(count.counts[0])*256);
+ my_free(j->tree->element_buffer);
j->tree->element_buffer=0;
j->tree=i->tree;
bmove((uchar*) i->counts,(uchar*) count.counts,
@@ -1878,7 +1870,7 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees)
DBUG_PRINT("info", ("Original trees: %d After join: %d",
trees, tree_number));
if (verbose)
- VOID(printf("Original trees: %d After join: %d\n", trees, tree_number));
+ printf("Original trees: %d After join: %d\n", trees, tree_number);
return tree_number; /* Return trees left */
}
@@ -2012,7 +2004,7 @@ static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees,
uchar *buff= (uchar*) file_buffer.pos;
bzero(buff,HEAD_LENGTH);
- memcpy_fixed(buff,maria_pack_file_magic,4);
+ memcpy(buff,maria_pack_file_magic,4);
int4store(buff+4,head_length);
int4store(buff+8, mrg->min_pack_length);
int4store(buff+12,mrg->max_pack_length);
@@ -2024,7 +2016,7 @@ static int write_header(PACK_MRG_INFO *mrg,uint head_length,uint trees,
buff[27]= (uchar) maria_get_pointer_length((ulonglong) filelength,2);
if (test_only)
return 0;
- VOID(my_seek(file_buffer.file,0L,MY_SEEK_SET,MYF(0)));
+ my_seek(file_buffer.file,0L,MY_SEEK_SET,MYF(0));
return my_write(file_buffer.file,(const uchar *) file_buffer.pos,HEAD_LENGTH,
MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL)) != 0;
}
@@ -2057,24 +2049,24 @@ static void write_field_info(HUFF_COUNTS *counts, uint fields, uint trees)
DBUG_PRINT("info", (" "));
if (verbose >= 2)
{
- VOID(printf("\n"));
- VOID(printf("column types:\n"));
- VOID(printf("FIELD_NORMAL 0\n"));
- VOID(printf("FIELD_SKIP_ENDSPACE 1\n"));
- VOID(printf("FIELD_SKIP_PRESPACE 2\n"));
- VOID(printf("FIELD_SKIP_ZERO 3\n"));
- VOID(printf("FIELD_BLOB 4\n"));
- VOID(printf("FIELD_CONSTANT 5\n"));
- VOID(printf("FIELD_INTERVALL 6\n"));
- VOID(printf("FIELD_ZERO 7\n"));
- VOID(printf("FIELD_VARCHAR 8\n"));
- VOID(printf("FIELD_CHECK 9\n"));
- VOID(printf("\n"));
- VOID(printf("pack type as a set of flags:\n"));
- VOID(printf("PACK_TYPE_SELECTED 1\n"));
- VOID(printf("PACK_TYPE_SPACE_FIELDS 2\n"));
- VOID(printf("PACK_TYPE_ZERO_FILL 4\n"));
- VOID(printf("\n"));
+ printf("\n");
+ printf("column types:\n");
+ printf("FIELD_NORMAL 0\n");
+ printf("FIELD_SKIP_ENDSPACE 1\n");
+ printf("FIELD_SKIP_PRESPACE 2\n");
+ printf("FIELD_SKIP_ZERO 3\n");
+ printf("FIELD_BLOB 4\n");
+ printf("FIELD_CONSTANT 5\n");
+ printf("FIELD_INTERVALL 6\n");
+ printf("FIELD_ZERO 7\n");
+ printf("FIELD_VARCHAR 8\n");
+ printf("FIELD_CHECK 9\n");
+ printf("\n");
+ printf("pack type as a set of flags:\n");
+ printf("PACK_TYPE_SELECTED 1\n");
+ printf("PACK_TYPE_SPACE_FIELDS 2\n");
+ printf("PACK_TYPE_ZERO_FILL 4\n");
+ printf("\n");
}
for (i=0 ; i++ < fields ; counts++)
{
@@ -2091,10 +2083,10 @@ static void write_field_info(HUFF_COUNTS *counts, uint fields, uint trees)
counts->max_zero_fill, counts->length_bits,
counts->tree->tree_number, counts->field_length));
if (verbose >= 2)
- VOID(printf("column: %3u type: %2u pack: %2u zero: %4u lbits: %2u "
+ printf("column: %3u type: %2u pack: %2u zero: %4u lbits: %2u "
"tree: %2u length: %4u\n", i , counts->field_type,
counts->pack_type, counts->max_zero_fill, counts->length_bits,
- counts->tree->tree_number, counts->field_length));
+ counts->tree->tree_number, counts->field_length);
}
flush_bits();
return;
@@ -2129,7 +2121,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
DBUG_PRINT("info", (" "));
if (verbose >= 2)
- VOID(printf("\n"));
+ printf("\n");
tree_no= 0;
intervall_length=0;
for (elements=0; trees-- ; huff_tree++)
@@ -2140,7 +2132,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
tree_no++;
DBUG_PRINT("info", (" "));
if (verbose >= 3)
- VOID(printf("\n"));
+ printf("\n");
/* Count the total number of elements (byte codes or column values). */
elements+=huff_tree->elements;
huff_tree->max_offset=2;
@@ -2159,8 +2151,8 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
*/
if (huff_tree->max_offset >= IS_OFFSET)
{ /* This should be impossible */
- VOID(fprintf(stderr, "Tree offset got too big: %d, aborted\n",
- huff_tree->max_offset));
+ fprintf(stderr, "Tree offset got too big: %d, aborted\n",
+ huff_tree->max_offset);
my_afree(packed_tree);
return 0;
}
@@ -2199,19 +2191,19 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
"bufflen" : "min_chr", huff_tree->counts->tree_buff ?
int_length : huff_tree->min_chr, huff_tree->height));
if (verbose >= 2)
- VOID(printf("tree: %2u elements: %4u char_bits: %2u offset_bits: %2u "
+ printf("tree: %2u elements: %4u char_bits: %2u offset_bits: %2u "
"%s: %5u codelen: %2u\n", tree_no, huff_tree->elements,
huff_tree->char_bits, huff_tree->offset_bits,
huff_tree->counts->tree_buff ? "bufflen" : "min_chr",
huff_tree->counts->tree_buff ? int_length :
- huff_tree->min_chr, huff_tree->height));
+ huff_tree->min_chr, huff_tree->height);
/* Check that the code tree length matches the element count. */
length=(uint) (offset-packed_tree);
if (length != huff_tree->elements*2-2)
{
- VOID(fprintf(stderr, "error: Huff-tree-length: %d != calc_length: %d\n",
- length, huff_tree->elements * 2 - 2));
+ fprintf(stderr, "error: Huff-tree-length: %d != calc_length: %d\n",
+ length, huff_tree->elements * 2 - 2);
errors++;
break;
}
@@ -2228,10 +2220,10 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
" -> " : "", (packed_tree[i] & IS_OFFSET) ?
packed_tree[i] - IS_OFFSET + i : packed_tree[i]));
if (verbose >= 3)
- VOID(printf("tree[0x%04x]: %s0x%04x\n",
+ printf("tree[0x%04x]: %s0x%04x\n",
i, (packed_tree[i] & IS_OFFSET) ? " -> " : "",
(packed_tree[i] & IS_OFFSET) ?
- packed_tree[i] - IS_OFFSET + i : packed_tree[i]));
+ packed_tree[i] - IS_OFFSET + i : packed_tree[i]);
}
flush_bits();
@@ -2253,9 +2245,9 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
bindigits(huff_tree->code[i],
huff_tree->code_len[i])));
if (verbose >= 3)
- VOID(printf("code[0x%04x]: 0x%s bits: %2u bin: %s\n", i,
+ printf("code[0x%04x]: 0x%s bits: %2u bin: %s\n", i,
hexdigits(huff_tree->code[i]), huff_tree->code_len[i],
- bindigits(huff_tree->code[i], huff_tree->code_len[i])));
+ bindigits(huff_tree->code[i], huff_tree->code_len[i]));
/* Check that the encode table decodes correctly. */
code= 0;
@@ -2268,9 +2260,9 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
{
if (! len)
{
- VOID(fflush(stdout));
- VOID(fprintf(stderr, "error: code 0x%s with %u bits not found\n",
- hexdigits(huff_tree->code[i]), huff_tree->code_len[i]));
+ fflush(stdout);
+ fprintf(stderr, "error: code 0x%s with %u bits not found\n",
+ hexdigits(huff_tree->code[i]), huff_tree->code_len[i]);
errors++;
break;
}
@@ -2279,18 +2271,17 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
bits++;
if (bits > 8 * sizeof(code))
{
- VOID(fflush(stdout));
- VOID(fprintf(stderr, "error: Huffman code too long: %u/%u\n",
- bits, (uint) (8 * sizeof(code))));
+ fflush(stdout);
+ fprintf(stderr, "error: Huffman code too long: %u/%u\n",
+ bits, (uint) (8 * sizeof(code)));
errors++;
break;
}
idx+= (uint) code & 1;
if (idx >= length)
{
- VOID(fflush(stdout));
- VOID(fprintf(stderr, "error: illegal tree offset: %u/%u\n",
- idx, length));
+ fflush(stdout);
+ fprintf(stderr, "error: illegal tree offset: %u/%u\n", idx, length);
errors++;
break;
}
@@ -2305,9 +2296,9 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
DBUG_EXECUTE_IF("forcechkerr4", packed_tree[idx]++;);
if (packed_tree[idx] != i)
{
- VOID(fflush(stdout));
- VOID(fprintf(stderr, "error: decoded value 0x%04x should be: 0x%04x\n",
- packed_tree[idx], i));
+ fflush(stdout);
+ fprintf(stderr, "error: decoded value 0x%04x should be: 0x%04x\n",
+ packed_tree[idx], i);
errors++;
break;
}
@@ -2324,19 +2315,19 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
DBUG_PRINT("info", ("column_values[0x%04x]: 0x%02x",
i, (uchar) huff_tree->counts->tree_buff[i]));
if (verbose >= 3)
- VOID(printf("column_values[0x%04x]: 0x%02x\n",
- i, (uchar) huff_tree->counts->tree_buff[i]));
+ printf("column_values[0x%04x]: 0x%02x\n",
+ i, (uchar) huff_tree->counts->tree_buff[i]);
}
}
flush_bits();
}
DBUG_PRINT("info", (" "));
if (verbose >= 2)
- VOID(printf("\n"));
+ printf("\n");
my_afree(packed_tree);
if (errors)
{
- VOID(fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n"));
+ fprintf(stderr, "Error: Generated decode trees are corrupt. Stop.\n");
return 0;
}
return elements;
@@ -2680,8 +2671,7 @@ static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
DBUG_PRINT("fields", ("FIELD_BLOB %lu bytes, bits: %2u",
blob_length, count->length_bits));
write_bits(blob_length,count->length_bits);
- memcpy_fixed(&blob,end_pos-portable_sizeof_char_ptr,
- sizeof(char*));
+ memcpy(&blob,end_pos-portable_sizeof_char_ptr, sizeof(char*));
blob_end=blob+blob_length;
/* Encode the blob bytes. */
for ( ; blob < blob_end ; blob++)
@@ -2770,8 +2760,8 @@ static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
record_count++;
if (write_loop && record_count % WRITE_COUNT == 0)
{
- VOID(printf("%lu\r", (ulong) record_count));
- VOID(fflush(stdout));
+ printf("%lu\r", (ulong) record_count);
+ fflush(stdout);
}
}
else if (error != HA_ERR_RECORD_DELETED)
@@ -2781,11 +2771,10 @@ static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
error=0;
else
{
- VOID(fprintf(stderr, "%s: Got error %d reading records\n",
- my_progname, error));
+ fprintf(stderr, "%s: Got error %d reading records\n", my_progname, error);
}
if (verbose >= 2)
- VOID(printf("wrote %s records.\n", llstr((longlong) record_count, llbuf)));
+ printf("wrote %s records.\n", llstr((longlong) record_count, llbuf));
my_afree(record);
mrg->ref_length=max_pack_length;
@@ -2880,7 +2869,7 @@ static int flush_buffer(ulong neaded_length)
static void end_file_buffer(void)
{
- my_free(file_buffer.buffer, MYF(0));
+ my_free(file_buffer.buffer);
}
/* output `bits` low bits of `value' */
@@ -2914,7 +2903,7 @@ static void write_bits(register ulonglong value, register uint bits)
if (bits != 8 * sizeof(value))
value&= (((ulonglong) 1) << bits) - 1;
if (file_buffer.pos >= file_buffer.end)
- VOID(flush_buffer(~ (ulong) 0));
+ flush_buffer(~ (ulong) 0);
file_buffer.bits=(int) (BITS_SAVED - bits);
file_buffer.bitbucket= value << (BITS_SAVED - bits);
}
@@ -2937,7 +2926,7 @@ static void flush_bits(void)
*file_buffer.pos++= (uchar) (bit_buffer >> bits);
}
if (file_buffer.pos >= file_buffer.end)
- VOID(flush_buffer(~ (ulong) 0));
+ flush_buffer(~ (ulong) 0);
file_buffer.bits= BITS_SAVED;
file_buffer.bitbucket= 0;
}
@@ -2993,7 +2982,7 @@ static int save_state(MARIA_HA *isam_file,PACK_MRG_INFO *mrg,
share->changed=1; /* Force write of header */
share->state.open_count=0;
share->global_changed=0;
- VOID(my_chsize(share->kfile.file, share->base.keystart, 0, MYF(0)));
+ my_chsize(share->kfile.file, share->base.keystart, 0, MYF(0));
if (share->base.keys)
isamchk_neaded=1;
DBUG_RETURN(_ma_state_info_write_sub(share->kfile.file,
@@ -3103,7 +3092,7 @@ static int mrg_close(PACK_MRG_INFO *mrg)
for (i=0 ; i < mrg->count ; i++)
error|=maria_close(mrg->file[i]);
if (mrg->free_file)
- my_free(mrg->file, MYF(0));
+ my_free(mrg->file);
DBUG_RETURN(error);
}
@@ -3166,7 +3155,7 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count)
*/
if (huff_counts->tree_buff)
{
- my_free(huff_counts->tree_buff, MYF(0));
+ my_free(huff_counts->tree_buff);
delete_tree(&huff_counts->int_tree);
huff_counts->tree_buff= NULL;
DBUG_PRINT("fakebigcodes", ("freed distinct column values"));
@@ -3232,3 +3221,6 @@ static int fakecmp(my_off_t **count1, my_off_t **count2)
(**count1 > **count2) ? -1 : 0);
}
#endif
+
+#include "ma_check_standalone.h"
+
diff --git a/storage/maria/maria_read_log.c b/storage/maria/maria_read_log.c
index de45eb0bcb6..6f273b11ce8 100644
--- a/storage/maria/maria_read_log.c
+++ b/storage/maria/maria_read_log.c
@@ -232,13 +232,11 @@ static struct my_option my_long_options[] =
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-#include <help_start.h>
static void print_version(void)
{
- VOID(printf("%s Ver 1.3 for %s on %s\n",
- my_progname_short, SYSTEM_TYPE, MACHINE_TYPE));
- NETWARE_SET_SCREEN_MODE(1);
+ printf("%s Ver 1.3 for %s on %s\n",
+ my_progname_short, SYSTEM_TYPE, MACHINE_TYPE);
}
@@ -257,14 +255,13 @@ static void usage(void)
"files created during normal execution. This should be ok, except for\n"
"test scripts that tries to compare files before and after recovery.");
#endif
- VOID(printf("\nUsage: %s OPTIONS\n", my_progname_short));
+ printf("\nUsage: %s OPTIONS\n", my_progname_short);
puts("You need to use one of -d or -a");
my_print_help(my_long_options);
print_defaults("my", load_default_groups);
my_print_variables(my_long_options);
}
-#include <help_end.h>
static my_bool
get_one_option(int optid __attribute__((unused)),
@@ -306,3 +303,4 @@ static void get_options(int *argc,char ***argv)
exit(1);
maria_tmpdir= &maria_chk_tmpdir;
}
+
diff --git a/storage/maria/plug.in b/storage/maria/plug.in
index 008d82250c8..00b974c356a 100644
--- a/storage/maria/plug.in
+++ b/storage/maria/plug.in
@@ -14,6 +14,6 @@ AC_ARG_WITH(aria-tmp-tables,
if test "$with_aria_tmp_tables" = "yes"
then
- AC_DEFINE([USE_MARIA_FOR_TMP_TABLES], [1], [Aria is used for internal temporary tables])
+ AC_DEFINE([USE_ARIA_FOR_TMP_TABLES], [1], [Aria is used for internal temporary tables])
fi
])
diff --git a/storage/maria/tablockman.c b/storage/maria/tablockman.c
index 1bb8889aaa7..8e664b261e9 100644
--- a/storage/maria/tablockman.c
+++ b/storage/maria/tablockman.c
@@ -225,12 +225,10 @@ struct st_table_lock {
uchar lock_type;
};
-#define hash_insert my_hash_insert /* for consistency :) */
-
static inline
TABLE_LOCK *find_by_loid(LOCKED_TABLE *table, uint16 loid)
{
- return (TABLE_LOCK *)hash_search(& table->latest_locks,
+ return (TABLE_LOCK *)my_hash_search(& table->latest_locks,
(uchar *)& loid, sizeof(loid));
}
@@ -485,8 +483,8 @@ tablockman_getlock(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo,
/* update the latest_locks hash */
if (old)
- hash_delete(& table->latest_locks, (uchar *)old);
- hash_insert(& table->latest_locks, (uchar *)new);
+ my_hash_delete(& table->latest_locks, (uchar *)old);
+ my_hash_insert(& table->latest_locks, (uchar *)new);
new->upgraded_from= old;
@@ -569,7 +567,7 @@ void tablockman_release_locks(TABLOCKMAN *lm, TABLE_LOCK_OWNER *lo)
/* TODO ? group locks by table to reduce the number of mutex locks */
pthread_mutex_lock(mutex);
- hash_delete(& cur->table->latest_locks, (uchar *)cur);
+ my_hash_delete(& cur->table->latest_locks, (uchar *)cur);
if (cur->prev)
cur->prev->next= cur->next;
@@ -616,7 +614,7 @@ void tablockman_destroy(TABLOCKMAN *lm)
{
TABLE_LOCK *tmp= lm->pool;
lm->pool= tmp->next;
- my_free((void *)tmp, MYF(0));
+ my_free(tmp);
}
pthread_mutex_destroy(& lm->pool_mutex);
}
@@ -632,7 +630,7 @@ void tablockman_init_locked_table(LOCKED_TABLE *lt, int initial_hash_size)
{
bzero(lt, sizeof(*lt));
pthread_mutex_init(& lt->mutex, MY_MUTEX_INIT_FAST);
- hash_init(& lt->latest_locks, & my_charset_bin, initial_hash_size,
+ my_hash_init(& lt->latest_locks, & my_charset_bin, initial_hash_size,
offsetof(TABLE_LOCK, loid),
sizeof(((TABLE_LOCK*)0)->loid), 0, 0, 0);
}
@@ -647,7 +645,7 @@ void tablockman_destroy_locked_table(LOCKED_TABLE *lt)
for (i= 0; i<LOCK_TYPES; i++)
DBUG_ASSERT(lt->active_locks[i] == 0);
- hash_free(& lt->latest_locks);
+ my_hash_free(& lt->latest_locks);
pthread_mutex_destroy(& lt->mutex);
}
diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c
index 05330baed76..4a0088a2617 100644
--- a/storage/maria/trnman.c
+++ b/storage/maria/trnman.c
@@ -217,14 +217,14 @@ void trnman_destroy()
pool= pool->next;
DBUG_ASSERT(trn->wt == NULL);
pthread_mutex_destroy(&trn->state_lock);
- my_free((void *)trn, MYF(0));
+ my_free(trn);
}
lf_hash_destroy(&trid_to_trn);
DBUG_PRINT("info", ("pthread_mutex_destroy LOCK_trn_list"));
pthread_mutex_destroy(&LOCK_trn_list);
my_atomic_rwlock_destroy(&LOCK_short_trid_to_trn);
my_atomic_rwlock_destroy(&LOCK_pool);
- my_free((void *)(short_trid_to_active_trn+1), MYF(0));
+ my_free(short_trid_to_active_trn+1);
short_trid_to_active_trn= NULL;
DBUG_VOID_RETURN;
diff --git a/storage/maria/unittest/ma_control_file-t.c b/storage/maria/unittest/ma_control_file-t.c
index 164ea284f31..aad1a6978b2 100644
--- a/storage/maria/unittest/ma_control_file-t.c
+++ b/storage/maria/unittest/ma_control_file-t.c
@@ -93,16 +93,16 @@ static void get_options(int argc, char *argv[]);
/* Used to ignore error messages from ma_control_file_open() */
-static int my_ignore_message(uint error __attribute__((unused)),
+static void my_ignore_message(uint error __attribute__((unused)),
const char *str __attribute__((unused)),
myf MyFlags __attribute__((unused)))
{
DBUG_ENTER("my_message_no_curses");
DBUG_PRINT("enter",("message: %s",str));
- DBUG_RETURN(0);
+ DBUG_VOID_RETURN;
}
-int (*default_error_handler_hook)(uint my_err, const char *str,
+void (*default_error_handler_hook)(uint my_err, const char *str,
myf MyFlags) = 0;
@@ -590,3 +590,5 @@ static void usage(void)
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_pagecache_consist.c b/storage/maria/unittest/ma_pagecache_consist.c
index 7dbdba433c6..d9b814e92f1 100644
--- a/storage/maria/unittest/ma_pagecache_consist.c
+++ b/storage/maria/unittest/ma_pagecache_consist.c
@@ -299,7 +299,7 @@ static void *test_thread_reader(void *arg)
pthread_mutex_lock(&LOCK_thread_count);
ok(1, "reader%d: done", param);
thread_count--;
- VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
my_thread_end();
@@ -322,7 +322,7 @@ static void *test_thread_writer(void *arg)
pthread_mutex_lock(&LOCK_thread_count);
ok(1, "writer%d: done", param);
thread_count--;
- VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
my_thread_end();
@@ -402,7 +402,7 @@ int main(int argc __attribute__((unused)),
}
#ifdef HAVE_THR_SETCONCURRENCY
- VOID(thr_setconcurrency(2));
+ thr_setconcurrency(2);
#endif
if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0,
@@ -496,3 +496,5 @@ int main(int argc __attribute__((unused)),
return exit_status();
}
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_pagecache_rwconsist.c b/storage/maria/unittest/ma_pagecache_rwconsist.c
index a1a22b5e18d..88ecbe864e8 100644
--- a/storage/maria/unittest/ma_pagecache_rwconsist.c
+++ b/storage/maria/unittest/ma_pagecache_rwconsist.c
@@ -170,7 +170,7 @@ static void *test_thread_reader(void *arg)
pthread_mutex_lock(&LOCK_thread_count);
ok(1, "reader%d: done", param);
thread_count--;
- VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
my_thread_end();
@@ -192,7 +192,7 @@ static void *test_thread_writer(void *arg)
pthread_mutex_lock(&LOCK_thread_count);
ok(1, "writer%d: done", param);
thread_count--;
- VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
my_thread_end();
@@ -272,7 +272,7 @@ int main(int argc __attribute__((unused)),
}
#ifdef HAVE_THR_SETCONCURRENCY
- VOID(thr_setconcurrency(2));
+ thr_setconcurrency(2);
#endif
if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0,
@@ -360,3 +360,5 @@ int main(int argc __attribute__((unused)),
return exit_status();
}
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_pagecache_rwconsist2.c b/storage/maria/unittest/ma_pagecache_rwconsist2.c
index 34183a2d0ab..e63d45ceb3a 100644
--- a/storage/maria/unittest/ma_pagecache_rwconsist2.c
+++ b/storage/maria/unittest/ma_pagecache_rwconsist2.c
@@ -166,7 +166,7 @@ static void *test_thread_reader(void *arg)
pthread_mutex_lock(&LOCK_thread_count);
ok(1, "reader%d: done", param);
thread_count--;
- VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
my_thread_end();
@@ -188,7 +188,7 @@ static void *test_thread_writer(void *arg)
pthread_mutex_lock(&LOCK_thread_count);
ok(1, "writer%d: done", param);
thread_count--;
- VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
my_thread_end();
@@ -268,7 +268,7 @@ int main(int argc __attribute__((unused)),
}
#ifdef HAVE_THR_SETCONCURRENCY
- VOID(thr_setconcurrency(2));
+ thr_setconcurrency(2);
#endif
if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0,
@@ -356,3 +356,5 @@ int main(int argc __attribute__((unused)),
return exit_status();
}
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_pagecache_single.c b/storage/maria/unittest/ma_pagecache_single.c
index 32e588e165a..3291346a8b5 100644
--- a/storage/maria/unittest/ma_pagecache_single.c
+++ b/storage/maria/unittest/ma_pagecache_single.c
@@ -671,9 +671,9 @@ int simple_big_test()
reset_file(&file1, file1_name);
err:
- my_free(buffw, 0);
- my_free(buffr, 0);
- my_free(desc, 0);
+ my_free(buffw);
+ my_free(buffr);
+ my_free(desc);
DBUG_RETURN(res);
}
@@ -711,7 +711,7 @@ static void *test_thread(void *arg)
DBUG_PRINT("info", ("Thread %s ended\n", my_thread_name()));
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
- VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
my_thread_end();
@@ -798,7 +798,7 @@ int main(int argc __attribute__((unused)),
}
#ifdef HAVE_THR_SETCONCURRENCY
- VOID(thr_setconcurrency(2));
+ thr_setconcurrency(2);
#endif
if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0,
@@ -851,3 +851,5 @@ int main(int argc __attribute__((unused)),
}
return exit_status();
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_loghandler-t.c b/storage/maria/unittest/ma_test_loghandler-t.c
index ffac9b04839..2de06914412 100644
--- a/storage/maria/unittest/ma_test_loghandler-t.c
+++ b/storage/maria/unittest/ma_test_loghandler-t.c
@@ -659,3 +659,5 @@ err:
return(test(exit_status()));
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
index 06d9a00c04c..e941d860adb 100644
--- a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
@@ -158,3 +158,5 @@ int main(int argc __attribute__((unused)), char *argv[])
exit(1);
exit(0);
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c
index 64f486b8cf1..924daac5f3c 100644
--- a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c
@@ -154,3 +154,5 @@ int main(int argc __attribute__((unused)), char *argv[])
exit(1);
exit(0);
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
index 7ba7ce3176d..44c174ee1b0 100644
--- a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
@@ -178,7 +178,7 @@ static void usage(void)
puts("and you are welcome to modify and redistribute it under the GPL license\n");
puts("Unit test of maria engine");
- VOID(printf("\nUsage: %s [OPTIONS]\n", my_progname_short));
+ printf("\nUsage: %s [OPTIONS]\n", my_progname_short);
my_print_help(my_long_options);
print_defaults("my", load_default_groups);
my_print_variables(my_long_options);
@@ -744,3 +744,5 @@ err:
return (test(exit_status()));
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_loghandler_multithread-t.c b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
index 354f5d12e08..1e9120e655f 100644
--- a/storage/maria/unittest/ma_test_loghandler_multithread-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
@@ -219,7 +219,7 @@ static void *test_thread_writer(void *arg)
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
ok(1, "writer finished"); /* just to show progress */
- VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are
ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
@@ -246,7 +246,7 @@ static void *test_thread_flusher(void *arg)
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
ok(1, "flusher finished"); /* just to show progress */
- VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are
+ pthread_cond_signal(&COND_thread_count); /* Tell main we are
ready */
pthread_mutex_unlock(&LOCK_thread_count);
free((uchar*) arg);
@@ -334,7 +334,7 @@ int main(int argc __attribute__((unused)),
}
#ifdef HAVE_THR_SETCONCURRENCY
- VOID(thr_setconcurrency(2));
+ thr_setconcurrency(2);
#endif
my_thread_global_init();
@@ -554,3 +554,5 @@ err:
return(exit_status());
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_loghandler_noflush-t.c b/storage/maria/unittest/ma_test_loghandler_noflush-t.c
index 973dfd03bcf..2994ead8c3a 100644
--- a/storage/maria/unittest/ma_test_loghandler_noflush-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_noflush-t.c
@@ -144,3 +144,5 @@ err:
exit(rc);
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_loghandler_nologs-t.c b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
index 34508d1d751..32ada1e58bd 100644
--- a/storage/maria/unittest/ma_test_loghandler_nologs-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
@@ -193,3 +193,5 @@ int main(int argc __attribute__((unused)), char *argv[])
exit(1);
exit(0);
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
index 1644aa4885c..5b115b426b7 100644
--- a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
@@ -198,3 +198,5 @@ int main(int argc __attribute__((unused)), char *argv[])
exit(0);
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/ma_test_loghandler_purge-t.c b/storage/maria/unittest/ma_test_loghandler_purge-t.c
index d37b45bc3ca..e7b604eb172 100644
--- a/storage/maria/unittest/ma_test_loghandler_purge-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_purge-t.c
@@ -190,3 +190,5 @@ int main(int argc __attribute__((unused)), char *argv[])
exit(1);
exit(0);
}
+
+#include "../ma_check_standalone.h"
diff --git a/storage/maria/unittest/test_file.c b/storage/maria/unittest/test_file.c
index 5f7e3939592..567f4ef8b94 100644
--- a/storage/maria/unittest/test_file.c
+++ b/storage/maria/unittest/test_file.c
@@ -113,6 +113,6 @@ int test_file(PAGECACHE_FILE file, char *file_name,
}
err:
- my_free(buffr, 0);
+ my_free(buffr);
return res;
}
diff --git a/storage/maria/unittest/trnman-t.c b/storage/maria/unittest/trnman-t.c
index 43cf982a7f2..5d27fe39d14 100644
--- a/storage/maria/unittest/trnman-t.c
+++ b/storage/maria/unittest/trnman-t.c
@@ -99,7 +99,7 @@ void run_test(const char *test, pthread_handler handler, int n, int m)
pthread_join(threads[i], 0);
now= my_getsystime()-now;
ok(litmus == 0, "Tested %s in %g secs (%d)", test, ((double)now)/1e7, litmus);
- my_free((void*)threads, MYF(0));
+ my_free(threads);
}
#define ok_read_from(T1, T2, RES) \
@@ -173,3 +173,4 @@ int main(int argc __attribute__((unused)), char **argv)
return exit_status();
}
+#include "../ma_check_standalone.h"