Trust the compiler to do short-circuit evaluation.
authorArt Cancro <ajc@citadel.org>
Thu, 16 Oct 2008 16:26:33 +0000 (16:26 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 16 Oct 2008 16:26:33 +0000 (16:26 +0000)
citadel/commands.c
citadel/messages.c
citadel/msgbase.c
citadel/sysdep.c

index d46e7afbc141f7f3d9ebfef0a3b650fe18268a08..4b71f698e2fcba024445719baf145b82f0df6d3c 100644 (file)
@@ -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) {
index 62aae6ade118d236fed6eaf45ccef57cc639d482..3f295f9cbb5a65a163fff64bad5534f2ead3bb6f 100644 (file)
@@ -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);
                }
index b809bec20dc4d69f0d4aa36baeee4208d2e5b00f..1401175565d5525ef0ef1b5ff3ef29a1f4a4319c 100644 (file)
@@ -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<num_msgs; ++i) {
-               if (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<num_target_msgnums; ++k) {
-               if (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.
index 2114fb0e1a1f2150be3c8267626d659d92991c85..be5ca2b9498be56e4e431cd3da0d5806d3476519 100644 (file)
@@ -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));