Skip to content

Commit

Permalink
Simplify boolean expressions
Browse files Browse the repository at this point in the history
Remove "? true : false" which is not needed for boolean expressions.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Sep 29, 2018
1 parent abe40f1 commit 63f87ca
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ccutil/elst2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/dict/permdawg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/textord/blkocc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand All @@ -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...
Expand Down
2 changes: 1 addition & 1 deletion src/textord/linefind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 63f87ca

Please sign in to comment.