Trust the compiler to do short-circuit evaluation.
authorArt Cancro <ajc@citadel.org>
Thu, 16 Oct 2008 16:18:30 +0000 (16:18 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 16 Oct 2008 16:18:30 +0000 (16:18 +0000)
webcit/auth.c
webcit/event.c
webcit/paging.c
webcit/useredit.c
webcit/webserver.c

index 2e58a710a0d053d5d5d249f26d90d69ee41c3b4c..af571a48f8ab827f72146170b85cbfba81499be2 100644 (file)
@@ -41,9 +41,9 @@ void display_login(char *mesg)
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"login_screen\">\n");
 
-       if (mesg != NULL) if (!IsEmptyStr(mesg)) {
-                       stresc(buf, SIZ,  mesg, 0, 0);
-                       svprintf(HKEY("MESG"), WCS_STRING, "%s", buf);
+       if ((mesg != NULL) && (!IsEmptyStr(mesg))) {
+               stresc(buf, SIZ,  mesg, 0, 0);
+               svprintf(HKEY("MESG"), WCS_STRING, "%s", buf);
        }
 
        svprintf(HKEY("LOGIN_INSTRUCTIONS"), WCS_STRING,
@@ -116,9 +116,9 @@ void display_openid_login(char *mesg)
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"login_screen\">\n");
 
-       if (mesg != NULL) if (!IsEmptyStr(mesg)) {
-                       stresc(buf, SIZ,  mesg, 0, 0);
-                       svprintf(HKEY("MESG"), WCS_STRING, "%s", buf);
+       if ((mesg != NULL) && (!IsEmptyStr(mesg))) {
+               stresc(buf, SIZ,  mesg, 0, 0);
+               svprintf(HKEY("MESG"), WCS_STRING, "%s", buf);
        }
 
        svprintf(HKEY("LOGIN_INSTRUCTIONS"), WCS_STRING,
index 5bb3efb4fd87a5623d6bc4468e1617e96a490db7..f073f47b58492719f8bfce4553c334cd3c53fde3 100644 (file)
@@ -337,15 +337,17 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        }
 
        wprintf("<INPUT TYPE=\"radio\" NAME=\"transp\" VALUE=\"transparent\"");
-       if (v != NULL) if (icalvalue_get_transp(v) == ICAL_TRANSP_TRANSPARENT)
+       if ((v != NULL) && (icalvalue_get_transp(v) == ICAL_TRANSP_TRANSPARENT)) {
                wprintf(" CHECKED");
+       }
        wprintf(">");
        wprintf(_("Free"));
        wprintf("&nbsp;&nbsp;");
 
        wprintf("<INPUT TYPE=\"radio\" NAME=\"transp\" VALUE=\"opaque\"");
-       if (v != NULL) if (icalvalue_get_transp(v) == ICAL_TRANSP_OPAQUE)
+       if ((v != NULL) && (icalvalue_get_transp(v) == ICAL_TRANSP_OPAQUE)) {
                wprintf(" CHECKED");
+       }
        wprintf(">");
        wprintf(_("Busy"));
 
index b36375d872eccfc1e953ae696cb1d87ffc1dd090..acfcdd97c57d4b76c6730e26cfb2d092e74d219b 100644 (file)
@@ -304,7 +304,7 @@ void chat_recv(void) {
                pf.fd = WC->chat_sock;
                pf.events = POLLIN;
                pf.revents = 0;
-               if (poll(&pf, 1, 1) > 0) if (pf.revents & POLLIN) {
+               if ((poll(&pf, 1, 1) > 0) && (pf.revents & POLLIN)) {
                        ++got_data;
 
                        /** Temporarily swap the serv and chat sockets during chat talk */
index 2446b3c2e9153964b22bbaf06ec291eedd8d2ca1..9e2babafacbf8451b20ee9f535ffffaf469906b1 100644 (file)
@@ -496,7 +496,7 @@ TRYAGAIN:
        }
 
        /** If there's no vcard, create one */
-       if (vcard_msgnum < 0) if (already_tried_creating_one == 0) {
+       if ((vcard_msgnum < 0) && (already_tried_creating_one == 0)) {
                already_tried_creating_one = 1;
                serv_puts("ENT0 1|||4");
                serv_getln(buf, sizeof buf);
index 5c328b189160b2e14f0af123df436b4094922557..ce9affa28e289975264a3c3b3adfd9870bd0ea10 100644 (file)
@@ -147,7 +147,7 @@ int ig_uds_server(char *sockpath, int queue_len)
        if (actual_queue_len < 5) actual_queue_len = 5;
 
        i = unlink(sockpath);
-       if (i != 0) if (errno != ENOENT) {
+       if ((i != 0) && (errno != ENOENT)) {
                lprintf(1, "webcit: can't unlink %s: %s\n",
                        sockpath, strerror(errno));
                exit(WC_EXIT_BIND);