From: Art Cancro Date: Thu, 16 Oct 2008 16:26:33 +0000 (+0000) Subject: Trust the compiler to do short-circuit evaluation. X-Git-Tag: v7.86~1843 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=15285981d937232a4ac0e3a84c7f944d53cdafa6 Trust the compiler to do short-circuit evaluation. --- diff --git a/citadel/commands.c b/citadel/commands.c index d46e7afbc..4b71f698e 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -1645,7 +1645,7 @@ char keymenu(char *menuprompt, char *menustring) { choices = num_tokens(menustring, '|'); if (menuprompt != NULL) do_prompt = 1; - if (menuprompt != NULL) if (IsEmptyStr(menuprompt)) do_prompt = 0; + if ((menuprompt != NULL) && (IsEmptyStr(menuprompt))) do_prompt = 0; while (1) { if (display_prompt) { diff --git a/citadel/messages.c b/citadel/messages.c index 62aae6ade..3f295f9cb 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -571,7 +571,7 @@ int read_message(CtdlIPC *ipc, /* Set the reply-to address to an Internet e-mail address if possible */ - if (message->email != NULL) if (!IsEmptyStr(message->email)) { + if ((message->email != NULL) && (!IsEmptyStr(message->email))) { if (!IsEmptyStr(message->author)) { snprintf(reply_to, sizeof reply_to, "%s <%s>", message->author, message->email); } diff --git a/citadel/msgbase.c b/citadel/msgbase.c index b809bec20..140117556 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -402,11 +402,11 @@ void CtdlSetSeen(long *target_msgnums, int num_target_msgnums, #if 0 /* This is a special diagnostic section. Do not allow it to run during normal operation. */ CtdlLogPrintf(CTDL_DEBUG, "There are %d messages in the room.\n", num_msgs); for (i=0; i 0) if (msglist[i] <= msglist[i-1]) abort(); + if ((i > 0) && (msglist[i] <= msglist[i-1])) abort(); } CtdlLogPrintf(CTDL_DEBUG, "We are twiddling %d of them.\n", num_target_msgnums); for (k=0; k 0) if (target_msgnums[k] <= target_msgnums[k-1]) abort(); + if ((k > 0) && (target_msgnums[k] <= target_msgnums[k-1])) abort(); } #endif @@ -551,7 +551,7 @@ int CtdlForEachMessage(int mode, long ref, char *search_string, int need_to_free_re = 0; regmatch_t pm; - if (content_type) if (!IsEmptyStr(content_type)) { + if ((content_type) && (!IsEmptyStr(content_type))) { regcomp(&re, content_type, 0); need_to_free_re = 1; } @@ -579,7 +579,7 @@ int CtdlForEachMessage(int mode, long ref, char *search_string, /* If the caller is looking for a specific MIME type, filter * out all messages which are not of the type requested. */ - if (content_type != NULL) if (!IsEmptyStr(content_type)) { + if ((content_type != NULL) && (!IsEmptyStr(content_type))) { /* This call to GetMetaData() sits inside this loop * so that we only do the extra database read per msg @@ -3872,9 +3872,9 @@ void cmd_ent0(char *entargs) * is set, or if there is one or more Internet email recipients. */ if (CC->room.QRflags2 & QR2_SUBJECTREQ) subject_required = 1; - if (valid_to) if (valid_to->num_internet > 0) subject_required = 1; - if (valid_cc) if (valid_cc->num_internet > 0) subject_required = 1; - if (valid_bcc) if (valid_bcc->num_internet > 0) subject_required = 1; + if ((valid_to) && (valid_to->num_internet > 0)) subject_required = 1; + if ((valid_cc) && (valid_cc->num_internet > 0)) subject_required = 1; + if ((valid_bcc) && (valid_bcc->num_internet > 0)) subject_required = 1; /* If we're only checking the validity of the request, return * success without creating the message. diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 2114fb0e1..be5ca2b94 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -380,7 +380,7 @@ int ig_uds_server(char *sockpath, int queue_len, char **errormessage) if (actual_queue_len < 5) actual_queue_len = 5; i = unlink(sockpath); - if (i != 0) if (errno != ENOENT) { + if ((i != 0) && (errno != ENOENT)) { *errormessage = (char*) malloc(SIZ + 1); snprintf(*errormessage, SIZ, "citserver: can't unlink %s: %s", sockpath, strerror(errno));