Code improvements over 2010-07-02T06:58:13Z!gabrielmorin@gmail.com due to last rev.

With the unused variable now being a warning some work-arounds
introduced in 2010-07-02T06:58:13Z!gabrielmorin@gmail.com are no longer needed. Other improvements
remove the temporary variable by directly testing the function result
in the assert.
This commit is contained in:
Mark de Wever 2010-07-11 16:50:47 +00:00
parent a43df5ac05
commit 003e02cbc5
3 changed files with 7 additions and 17 deletions

View file

@ -198,8 +198,7 @@ void thorizontal_list::set_visible_area(const SDL_Rect& area)
twidget* thorizontal_list::find_at(
const tpoint& coordinate, const bool must_be_active)
{
twindow* window = get_window();
assert(window); (void) window /* avoids unused parameter warning */;
assert(get_window());
for(size_t i = 0; i < get_item_count(); ++i) {
@ -221,8 +220,7 @@ twidget* thorizontal_list::find_at(
const twidget* thorizontal_list::find_at(const tpoint& coordinate,
const bool must_be_active) const
{
const twindow* window = get_window();
assert(window); (void) window /* avoids unused parameter warning */;
assert(get_window());
for(size_t i = 0; i < get_item_count(); ++i) {
@ -393,8 +391,7 @@ void tvertical_list::set_visible_area(const SDL_Rect& area)
twidget* tvertical_list::find_at(
const tpoint& coordinate, const bool must_be_active)
{
twindow* window = get_window();
assert(window); (void) window /* avoids unused parameter warning */;
assert(get_window());
for(size_t i = 0; i < get_item_count(); ++i) {
@ -417,8 +414,7 @@ twidget* tvertical_list::find_at(
const twidget* tvertical_list::find_at(const tpoint& coordinate,
const bool must_be_active) const
{
const twindow* window = get_window();
assert(window); (void) window /* avoids unused parameter warning */;
assert(get_window());
for(size_t i = 0; i < get_item_count(); ++i) {
@ -555,8 +551,7 @@ void tindependant::set_origin(const tpoint& origin)
twidget* tindependant::find_at(const tpoint& coordinate
, const bool must_be_active)
{
const twindow* window = get_window();
assert(window); (void) window /* avoids unused parameter warning */;
assert(get_window());
const int selected_item = get_selected_item();
if(selected_item < 0) {
@ -570,8 +565,7 @@ twidget* tindependant::find_at(const tpoint& coordinate
const twidget* tindependant::find_at(const tpoint& coordinate
, const bool must_be_active) const
{
const twindow* window = get_window();
assert(window); (void) window /* avoids unused parameter warning */;
assert(get_window());
const int selected_item = get_selected_item();
if(selected_item < 0) {
@ -681,7 +675,7 @@ void tshow::init(tgrid* grid
, const std::map<std::string /* widget id */, string_map>& data
, void (*callback)(twidget*))
{
assert(!callback); (void) callback /* avoids unused parameter warning */;
assert(!callback);
typedef std::pair<std::string, string_map> hack;
foreach(const hack& item, data) {

View file

@ -2102,7 +2102,6 @@ class map_command_handler
}
}
virtual void assert_existence(const std::string& cmd) {
(void) cmd; //prevents unused parameter warning in release build
assert(command_map_.count(cmd));
}
virtual void register_alias(const std::string& to_cmd,

View file

@ -128,20 +128,17 @@ static lg::log_domain log_config("config");
sig_atomic_t config_reload = 0;
static void reload_config(int signal) {
(void) signal; //avoids usused parameter warning
assert(signal == SIGHUP);
config_reload = 1;
}
static void exit_sigint(int signal) {
(void) signal; //avoids usused parameter warning
assert(signal == SIGINT);
LOG_SERVER << "SIGINT caught, exiting without cleanup immediately.\n";
exit(128 + SIGINT);
}
static void exit_sigterm(int signal) {
(void) signal; //avoids usused parameter warning
assert(signal == SIGTERM);
LOG_SERVER << "SIGTERM caught, exiting without cleanup immediately.\n";
exit(128 + SIGTERM);