Simplify boolean expressions

Remove "? true : false" which is not needed for boolean expressions.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-09-29 08:21:14 +02:00
parent abe40f17c9
commit 63f87cac90
4 changed files with 7 additions and 8 deletions

View File

@ -616,7 +616,7 @@ inline ELIST2_LINK *ELIST2_ITERATOR::extract() {
}
}
// Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
ex_current_was_cycle_pt = (current == cycle_pt) ? true : false;
ex_current_was_cycle_pt = (current == cycle_pt);
extracted_link = current;
extracted_link->next = nullptr; //for safety
extracted_link->prev = nullptr; //for safety

View File

@ -253,8 +253,7 @@ void Dict::append_choices(
WERD_CHOICE *best_choice,
int *attempts_left,
void *more_args) {
int word_ending =
(char_choice_index == char_choices.length() - 1) ? true : false;
int word_ending = (char_choice_index == char_choices.length() - 1);
// Deal with fragments.
CHAR_FRAGMENT_INFO char_frag_info;

View File

@ -65,8 +65,8 @@ class REGION_OCC:public ELIST_LINK
};
ELISTIZEH (REGION_OCC)
#define RANGE_IN_BAND( band_max, band_min, range_max, range_min ) \
( ((range_min) >= (band_min)) && ((range_max) < (band_max)) ) ? true : false
#define RANGE_IN_BAND(band_max, band_min, range_max, range_min) \
(((range_min) >= (band_min)) && ((range_max) < (band_max)))
/************************************************************************
Adapted from the following procedure so that it can be used in the bands
class in an include file...
@ -84,8 +84,8 @@ int16_t range_min]
return FALSE;
}
***********************************************************************/
#define RANGE_OVERLAPS_BAND( band_max, band_min, range_max, range_min ) \
( ((range_max) >= (band_min)) && ((range_min) < (band_max)) ) ? true : false
#define RANGE_OVERLAPS_BAND(band_max, band_min, range_max, range_min) \
(((range_max) >= (band_min)) && ((range_min) < (band_max)))
/************************************************************************
Adapted from the following procedure so that it can be used in the bands
class in an include file...

View File

@ -591,7 +591,7 @@ void LineFinder::GetLineMasks(int resolution, Pix* src_pix,
int clStatus = OpenclDevice::initMorphCLAllocations(pixGetWpl(src_pix),
pixGetHeight(src_pix),
src_pix);
bool getpixclosed = pix_music_mask != nullptr ? true : false;
bool getpixclosed = pix_music_mask != nullptr;
OpenclDevice::pixGetLinesCL(nullptr, src_pix, pix_vline, pix_hline,
&pix_closed, getpixclosed, closing_brick,
closing_brick, max_line_width, max_line_width,