cast to bool optimization

This commit is contained in:
Ianos Gnatiuc
2005-10-25 06:11:09 +00:00
parent f602e0d3e3
commit 97ffdeef9d
37 changed files with 71 additions and 70 deletions

View File

@@ -224,10 +224,10 @@ void AreaList::ReadGoldLast() {
(*ap)->Msgn.count = entry.msgncount;
(*ap)->unread = entry.unread;
(*ap)->marks = entry.marks;
(*ap)->isscanned = (entry.flags & 1) ? true : false;
(*ap)->isvalidchg = (entry.flags & 2) ? true : false;
(*ap)->isscanned = make_bool(entry.flags & 1);
(*ap)->isvalidchg = make_bool(entry.flags & 2);
(*ap)->UpdateAreadata();
(*ap)->isunreadchg = (entry.flags & 4) ? true : false;
(*ap)->isunreadchg = make_bool(entry.flags & 4);
(*ap)->Mark.Load(fp);
(*ap)->PMrk.Load(fp);

View File

@@ -38,7 +38,7 @@ extern char* val;
void CfgHighlighturls() {
CFG->highlighturls = GetYesno(val) ? true : false;
CFG->highlighturls = make_bool(GetYesno(val));
}
// ------------------------------------------------------------------
@@ -218,7 +218,7 @@ void CfgInternetrfcbody() {
void CfgInternetviagate() {
CFG->internetviagate = GetYesno(val) ? true : false;
CFG->internetviagate = make_bool(GetYesno(val));
}
// ------------------------------------------------------------------

View File

@@ -170,8 +170,8 @@ extern "C" int AreaListCmp(const Area** __a, const Area** __b) {
case 'F':
case 'f':
if(*area_maybe) {
register bool amay = striinc(area_maybe, A->echoid()) ? true : false;
register bool bmay = striinc(area_maybe, B->echoid()) ? true : false;
bool amay = make_bool(striinc(area_maybe, A->echoid()));
bool bmay = make_bool(striinc(area_maybe, B->echoid()));
if((cmp = compare_two(bmay, amay)) != 0)
return cmp;

View File

@@ -142,7 +142,7 @@ int DoCarboncopy(GMsg* msg, GMsg** carbon) {
HeaderView->Use(AA, msg);
HeaderView->Paint();
GMenuCarbon MenuCarbon;
ignorecc = MenuCarbon.Run(msg) ? false : true;
ignorecc = make_bool_not(MenuCarbon.Run(msg));
if(ignorecc) // Do not process carbon copies
break;
if(newline)
@@ -362,7 +362,7 @@ void DoCrosspost(GMsg* msg, std::vector<int> &postareas) {
if(not ignorexc and (strnieql(ptr, "XC:", 3) or strnieql(ptr, "XP:", 3))) {
if(ask) {
GMenuCross MenuCross;
ignorexc = (CFG->crosspost != ASK) or MenuCross.Run(msg) ? false : true;
ignorexc = make_bool_not((CFG->crosspost != ASK) or MenuCross.Run(msg));
if(ignorexc) // Do not process crossposting
break;
if(newline)

View File

@@ -249,7 +249,7 @@ void DoKludges(int mode, GMsg* msg, int kludges) {
if(line->kludge & kludges) {
bool waswrapped;
do {
waswrapped = (line->type & GLINE_WRAP) ? true : false;
waswrapped = make_bool(line->type & GLINE_WRAP);
line = DeleteLine(line);
} while(line and waswrapped);
}

View File

@@ -235,7 +235,7 @@ static void WriteMsgs(GMsg* msg) {
SaveLines(MODE_WRITE, "\001PRN", msg, prnmargin);
}
else {
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, AA->Outputfile(), msg, prnmargin, (target & WRITE_CLIPBRD) ? true : false);
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, AA->Outputfile(), msg, prnmargin, make_bool(target & WRITE_CLIPBRD));
}
}
if(prnfp)

View File

@@ -1127,7 +1127,7 @@ void IEclass::DelChar() {
setlinetype(_thisline);
// Rewrap this line
bool display = (row > maxrow / 2) ? false : true;
bool display = make_bool_not(row > maxrow / 2);
wrapdel(&currline, &col, &row, display);
if(display) {
refresh(currline, row);
@@ -1553,7 +1553,7 @@ void IEclass::DeleteEOL() {
GFTRK("EditDeleteEOL");
bool _has_linefeed = (currline->txt.find('\n') != currline->txt.npos) ? true : false;
bool _has_linefeed = (currline->txt.find('\n') != currline->txt.npos);
Undo->PushItem(EDIT_UNDO_DEL_TEXT, currline);
@@ -3014,7 +3014,7 @@ void UndoStack::PlayItem() {
currline = thisline;
break;
case EDIT_UNDO_PUSH_LINE:
editor->UnDelete((last_item->action & LAST_LINE) ? false : true);
editor->UnDelete(make_bool_not(last_item->action & LAST_LINE));
break;
case EDIT_UNDO_POP_LINE:
editor->DelLine();

View File

@@ -84,7 +84,7 @@ static void InitCmdline(char* val) {
std::cout << "Warning: configuration filename missed for -C option, ignored.\n";
break;
case 'D':
cmdlineoldkeyw = (*val == '-') ? true : false;
cmdlineoldkeyw = (*val == '-');
break;
case 'E':
if(strieql(key, "EXPORTSOUP"))
@@ -93,7 +93,7 @@ static void InitCmdline(char* val) {
strxcpy(stecho, val, sizeof(stecho));
break;
case 'F':
cmdlineforce = (*val == '-') ? false : true;
cmdlineforce = make_bool_not(*val == '-');
if(toupper(key[1]) == 'F')
cmdlineforce++;
break;
@@ -112,7 +112,7 @@ static void InitCmdline(char* val) {
cmdlineimportsoup = true;
break;
case 'M':
disablesound = (*val == '-') ? false : true;
disablesound = make_bool_not(*val == '-');
break;
case 'N':
if(strieql(key, "NOSCAN"))
@@ -121,7 +121,7 @@ static void InitCmdline(char* val) {
cmdlinesharemode = SH_COMPAT;
break;
case 'P':
cmdlinepriority = (*val == '-') ? false : true;
cmdlinepriority = make_bool_not(*val == '-');
break;
case 'Q':
quiet = true;
@@ -134,17 +134,17 @@ static void InitCmdline(char* val) {
break;
case 'V':
quiet = false;
veryverbose = (toupper(key[1]) == 'V') ? true : false;
veryverbose = (toupper(key[1]) == 'V');
break;
case 'W':
cmdlinewriteareas = (*val == '-') ? false : true;
cmdlinewriteareas = make_bool_not(*val == '-');
break;
case 'Y':
cmdlinedebughg = (*val == '-') ? false : true;
cmdlinedebughg = make_bool_not(*val == '-');
break;
#if defined(GFTRK_ENABLE)
case 'X':
__gftrk_statusline = (*val == '-') ? false : true;
__gftrk_statusline = make_bool_not(*val == '-');
break;
case 'Z':
gftrk_set_max = atoi(val);

View File

@@ -819,7 +819,7 @@ void MakeMsg(int mode, GMsg* omsg, bool ignore_replyto) {
// Set msg date and time
bool dochgdate = true;
if(mode == MODE_CHANGE) {
dochgdate = EDIT->ChangeDate() ? true : false;
dochgdate = make_bool(EDIT->ChangeDate());
if((EDIT->ChangeDate() == YES) and not msg->attr.fmu())
dochgdate = false;
}

View File

@@ -267,8 +267,8 @@ void ToggleStyles() {
w_info(NULL);
if(k != Key_Esc) {
AA->adat->usestylies = (setting & 1) ? true : false;
AA->adat->hidestylies = (setting & 2) ? true : false;
AA->adat->usestylies = make_bool(setting & 1);
AA->adat->hidestylies = make_bool(setting & 2);
}
}

View File

@@ -61,7 +61,7 @@ char* CvtMessageIDtoMSGID(const char* mptr, char* msgidbuf, const char* echoid,
}
else {
bool spaces = strchr(mptr, ' ') ? true : false;
bool spaces = make_bool(strchr(mptr, ' '));
dword crc32 = CRC32_MASK_CCITT;
crc32 = strCrc32(mptr, NO, crc32);

View File

@@ -337,7 +337,7 @@ bool golded_search_manager::search(GMsg* msg, bool quick, bool shortcircuit) {
// Perform short-circuit logic analysis
if(shortcircuit) {
exit = found ? true : false;
exit = make_bool(found);
if(item == items.end()-1)
return exit;
}

View File

@@ -59,7 +59,7 @@ int edit_string(char* buf, int buf_size, char* title, int helpcat) {
while(len and ('!' > buf2[--len]))
buf2.erase(len, 1);
strcpy(buf, buf2.c_str());
return *buf ? true : false;
return make_bool(*buf);
}

View File

@@ -418,9 +418,9 @@ public:
bool pmscan() { return area->pmscan(); }
bool pmscanexcl() { return area->pmscanexcl(); }
bool pmscanincl() { return area->pmscanincl(); }
bool ismarked() const { return (marks & (1<<AL.mask)) ? true : false; }
bool ismarked() const { return make_bool(marks & (1<<AL.mask)); }
bool isnewmail() const { return (isvalidchg and isunreadchg) ? true : false; }
bool isnewmail() const { return (isvalidchg and isunreadchg); }
const char* echoid() const { return area->echoid(); }
const char* desc() const { return area->desc(); }