diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-11-24 16:54:59 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-11-24 16:54:59 +0300 |
commit | 4cff617c2541279a53b92acbd4e4d8716dc54873 (patch) | |
tree | 887f74eb880e4d9ff8b76ff93b221f7e6ec7fbe8 /sql/sql_base.cc | |
parent | 26cd9abe4fcc058004ad8e656ff5b6713c0118f4 (diff) | |
download | mariadb-git-4cff617c2541279a53b92acbd4e4d8716dc54873.tar.gz |
Backport of:
----------------------------------------------------------------------
ChangeSet@1.2571, 2008-04-08 12:30:06+02:00, vvaintroub@wva. +122 -0
Bug#32082 : definition of VOID in my_global.h conflicts with Windows
SDK headers
VOID macro is now removed. Its usage is replaced with void cast.
In some cases, where cast does not make much sense (pthread_*, printf,
hash_delete, my_seek), cast is ommited.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 2c0ba87262a..52e203f1130 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -438,7 +438,7 @@ found: oldest_unused_share->next) { pthread_mutex_lock(&oldest_unused_share->mutex); - VOID(my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share)); + my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share); } DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u", @@ -714,7 +714,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) TABLE_LIST table_list; DBUG_ENTER("list_open_tables"); - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); bzero((char*) &table_list,sizeof(table_list)); start_list= &open_list; open_list=0; @@ -767,7 +767,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) start_list= &(*start_list)->next; *start_list=0; } - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(open_list); } @@ -787,7 +787,7 @@ void intern_close_table(TABLE *table) free_io_cache(table); delete table->triggers; if (table->file) // Not true if name lock - VOID(closefrm(table, 1)); // close file + (void) closefrm(table, 1); // close file DBUG_VOID_RETURN; } @@ -864,7 +864,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock, DBUG_ASSERT(thd || (!wait_for_refresh && !tables)); if (!have_lock) - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); if (!tables) { refresh_version++; // Force close of open tables @@ -874,14 +874,14 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock, if (my_hash_delete(&open_cache,(uchar*) unused_tables)) printf("Warning: Couldn't delete open table from hash\n"); #else - VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); + (void) my_hash_delete(&open_cache,(uchar*) unused_tables); #endif } /* Free table shares */ while (oldest_unused_share->next) { pthread_mutex_lock(&oldest_unused_share->mutex); - VOID(my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share)); + (void) my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share); } DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu", refresh_version)); @@ -1019,7 +1019,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock, } } if (!have_lock) - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); if (wait_for_refresh) { pthread_mutex_lock(&thd->mysys_var->mutex); @@ -1049,7 +1049,7 @@ bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh, bzero(&tmp, sizeof(TABLE_LIST)); if (!have_lock) - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); for (idx= 0; idx < table_def_cache.records; idx++) { @@ -1082,7 +1082,7 @@ bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh, result= close_cached_tables(thd, tables, TRUE, FALSE, FALSE); if (!have_lock) - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); if (if_wait_for_refresh) { @@ -1199,7 +1199,7 @@ static void close_open_tables(THD *thd) safe_mutex_assert_not_owner(&LOCK_open); - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); DBUG_PRINT("info", ("thd->open_tables: 0x%lx", (long) thd->open_tables)); @@ -1209,7 +1209,7 @@ static void close_open_tables(THD *thd) /* Free tables to hold down open files */ while (open_cache.records > table_cache_size && unused_tables) - VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */ + my_hash_delete(&open_cache,(uchar*) unused_tables); /* purecov: tested */ check_unused(); if (found_old_table) { @@ -1217,7 +1217,7 @@ static void close_open_tables(THD *thd) broadcast_refresh(); } - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); } @@ -1395,7 +1395,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr) if (table->needs_reopen_or_name_lock() || thd->version != refresh_version || !table->db_stat) { - VOID(my_hash_delete(&open_cache,(uchar*) table)); + my_hash_delete(&open_cache,(uchar*) table); found_old_table=1; } else @@ -2099,7 +2099,7 @@ void unlink_open_table(THD *thd, TABLE *find, bool unlock) /* Remove table from open_tables list. */ *prev= list->next; /* Close table. */ - VOID(my_hash_delete(&open_cache,(uchar*) list)); // Close table + my_hash_delete(&open_cache,(uchar*) list); // Close table } else { @@ -2141,14 +2141,14 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name, else { handlerton *table_type= table->s->db_type(); - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); /* unlink_open_table() also tells threads waiting for refresh or close that something has happened. */ unlink_open_table(thd, table, FALSE); quick_rm_table(table_type, db_name, table_name, 0); - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); } } @@ -2403,24 +2403,24 @@ bool lock_table_name_if_not_cached(THD *thd, const char *db, DBUG_ENTER("lock_table_name_if_not_cached"); key_length= (uint)(strmov(strmov(key, db) + 1, table_name) - key) + 1; - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); if (my_hash_search(&open_cache, (uchar *)key, key_length)) { - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_PRINT("info", ("Table is cached, name-lock is not obtained")); *table= 0; DBUG_RETURN(FALSE); } if (!(*table= table_cache_insert_placeholder(thd, key, key_length))) { - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(TRUE); } (*table)->open_placeholder= 1; (*table)->next= thd->open_tables; thd->open_tables= *table; - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(FALSE); } @@ -2677,15 +2677,15 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, */ TABLE tab; table= &tab; - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); if (!open_unireg_entry(thd, table, table_list, alias, key, key_length, mem_root, 0)) { DBUG_ASSERT(table_list->view != 0); - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(0); // VIEW } - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); } } /* @@ -2718,7 +2718,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, on disk. */ - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); /* If it's the first table from a list of tables used in a query, @@ -2736,7 +2736,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, /* Someone did a refresh while thread was opening tables */ if (refresh) *refresh=1; - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(0); } @@ -2802,7 +2802,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, /* Avoid self-deadlocks by detecting self-dependencies. */ if (table->open_placeholder && table->in_use == thd) { - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); my_error(ER_UPDATE_TABLE_USED, MYF(0), table->s->table_name.str); DBUG_RETURN(0); } @@ -2843,7 +2843,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, } else { - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); } /* There is a refresh in progress for this table. @@ -2876,7 +2876,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, DBUG_PRINT("tcache", ("opening new table")); /* Free cache if too big */ while (open_cache.records > table_cache_size && unused_tables) - VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */ + my_hash_delete(&open_cache,(uchar*) unused_tables); /* purecov: tested */ if (table_list->create) { @@ -2884,7 +2884,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, if (check_if_table_exists(thd, table_list, &exists)) { - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(NULL); } @@ -2895,7 +2895,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, */ if (!(table= table_cache_insert_placeholder(thd, key, key_length))) { - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(NULL); } /* @@ -2906,7 +2906,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, table->open_placeholder= 1; table->next= thd->open_tables; thd->open_tables= table; - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(table); } /* Table exists. Let us try to open it. */ @@ -2915,7 +2915,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, /* make a new table */ if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME)))) { - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(NULL); } @@ -2924,7 +2924,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, if (error > 0) { my_free((uchar*)table, MYF(0)); - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(NULL); } if (table_list->view || error < 0) @@ -2937,18 +2937,18 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, table_list->view= (LEX*)1; my_free((uchar*)table, MYF(0)); - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(0); // VIEW } DBUG_PRINT("info", ("inserting table '%s'.'%s' 0x%lx into the cache", table->s->db.str, table->s->table_name.str, (long) table)); - VOID(my_hash_insert(&open_cache,(uchar*) table)); + (void) my_hash_insert(&open_cache,(uchar*) table); } check_unused(); // Debugging call - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); if (refresh) { table->next=thd->open_tables; /* Link into simple list */ @@ -3087,13 +3087,13 @@ bool reopen_table(TABLE *table) fix_merge_after_open(table->child_l, table->child_last_l, tmp.child_l, tmp.child_last_l)) { - VOID(closefrm(&tmp, 1)); // close file, free everything + (void) closefrm(&tmp, 1); // close file, free everything goto end; } delete table->triggers; if (table->file) - VOID(closefrm(table, 1)); // close file, free everything + (void) closefrm(table, 1); // close file, free everything *table= tmp; table->default_column_bitmaps(); @@ -3334,7 +3334,7 @@ bool reopen_tables(THD *thd, bool get_locks, bool mark_share_as_old) */ if (table->child_l || table->parent) detach_merge_children(table, TRUE); - VOID(my_hash_delete(&open_cache,(uchar*) table)); + my_hash_delete(&open_cache,(uchar*) table); error=1; } else @@ -3363,7 +3363,7 @@ bool reopen_tables(THD *thd, bool get_locks, bool mark_share_as_old) { while (err_tables) { - VOID(my_hash_delete(&open_cache, (uchar*) err_tables)); + my_hash_delete(&open_cache, (uchar*) err_tables); err_tables= err_tables->next; } } @@ -3645,7 +3645,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name) else { /* We already have a name lock, remove copy */ - VOID(my_hash_delete(&open_cache,(uchar*) table)); + my_hash_delete(&open_cache,(uchar*) table); } } else @@ -4252,7 +4252,7 @@ void detach_merge_children(TABLE *table, bool clear_refs) */ if ((first_detach= parent->children_attached)) { - VOID(parent->file->extra(HA_EXTRA_DETACH_CHILDREN)); + (void) parent->file->extra(HA_EXTRA_DETACH_CHILDREN); parent->children_attached= FALSE; DBUG_PRINT("myrg", ("detached parent: '%s'.'%s' 0x%lx", parent->s->db.str, parent->s->table_name.str, (long) parent)); @@ -8354,7 +8354,7 @@ my_bool mysql_rm_tmp_tables(void) So we hide error messages which happnes during deleting of these files(MYF(0)). */ - VOID(my_delete(filePath, MYF(0))); + (void) my_delete(filePath, MYF(0)); } } my_dirend(dirp); @@ -8396,7 +8396,7 @@ void remove_db_from_cache(const char *db) } } while (unused_tables && !unused_tables->s->version) - VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); + my_hash_delete(&open_cache,(uchar*) unused_tables); } @@ -8520,7 +8520,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, } } while (unused_tables && !unused_tables->s->version) - VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); + my_hash_delete(&open_cache,(uchar*) unused_tables); DBUG_PRINT("info", ("Removing table from table_def_cache")); /* Remove table from table definition cache if it's not in use */ @@ -8533,7 +8533,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, if (share->ref_count == 0) { pthread_mutex_lock(&share->mutex); - VOID(my_hash_delete(&table_def_cache, (uchar*) share)); + my_hash_delete(&table_def_cache, (uchar*) share); } } @@ -8710,12 +8710,12 @@ int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt) DBUG_ENTER("abort_and_upgrade_locks"); lpt->old_lock_type= lpt->table->reginfo.lock_type; - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); /* If MERGE child, forward lock handling to parent. */ mysql_lock_abort(lpt->thd, lpt->table->parent ? lpt->table->parent : lpt->table, TRUE); - VOID(remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, flags)); - VOID(pthread_mutex_unlock(&LOCK_open)); + (void) remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, flags); + pthread_mutex_unlock(&LOCK_open); DBUG_RETURN(0); } @@ -8737,10 +8737,10 @@ int abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt) /* purecov: begin deadcode */ void close_open_tables_and_downgrade(ALTER_PARTITION_PARAM_TYPE *lpt) { - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, RTFC_WAIT_OTHER_THREAD_FLAG); - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); /* If MERGE child, forward lock handling to parent. */ mysql_lock_downgrade_write(lpt->thd, lpt->table->parent ? lpt->table->parent : lpt->table, lpt->old_lock_type); @@ -8779,7 +8779,7 @@ void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table DBUG_ENTER("mysql_wait_completed_table"); key_length=(uint) (strmov(strmov(key,lpt->db)+1,lpt->table_name)-key)+1; - VOID(pthread_mutex_lock(&LOCK_open)); + pthread_mutex_lock(&LOCK_open); HASH_SEARCH_STATE state; for (table= (TABLE*) my_hash_first(&open_cache,(uchar*) key,key_length, &state) ; @@ -8837,7 +8837,7 @@ void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table */ mysql_lock_abort(lpt->thd, my_table->parent ? my_table->parent : my_table, FALSE); - VOID(pthread_mutex_unlock(&LOCK_open)); + pthread_mutex_unlock(&LOCK_open); DBUG_VOID_RETURN; } |