xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 7 04:24:29 UTC 2019


 composite/compalloc.c             |    3 ++-
 composite/compwindow.c            |   15 +++++++++++----
 dix/privates.c                    |   15 ++++++++++-----
 dix/region.c                      |    3 ++-
 exa/exa_offscreen.c               |   11 ++++++-----
 hw/xquartz/xpr/x-list.c           |    3 ++-
 record/record.c                   |    3 ++-
 test/input.c                      |    3 ++-
 test/xfree86.c                    |    3 ++-
 test/xi2/protocol-eventconvert.c  |    6 ++++--
 test/xi2/protocol-xiquerydevice.c |    3 ++-
 11 files changed, 45 insertions(+), 23 deletions(-)

New commits:
commit 9d25408a59d6273f1c4c994de9cc53f488a8ec3c
Author: Adam Richter <adamrichter4 at gmail.com>
Date:   Thu May 2 15:02:36 2019 -0700

    assert(a && b) --> assert(a); assert(b)
    
    Separate each statement of the form "assert(a && b);" into "assert(a);"
    and "assert(b);" for more precise diagnostics, except for this clever
    use in drmmode_display.c where it was used to pass a hint to developers:
    
            assert(num_infos <= 32 && "update return type");

diff --git a/composite/compalloc.c b/composite/compalloc.c
index 3e2f14fb0..23320c406 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -669,7 +669,8 @@ compReallocPixmap(WindowPtr pWin, int draw_x, int draw_y,
     int pix_x, pix_y;
     int pix_w, pix_h;
 
-    assert(cw && pWin->redirectDraw != RedirectDrawNone);
+    assert(cw);
+    assert(pWin->redirectDraw != RedirectDrawNone);
     cw->oldx = pOld->screen_x;
     cw->oldy = pOld->screen_y;
     pix_x = draw_x - bw;
diff --git a/composite/compwindow.c b/composite/compwindow.c
index 54b4e6ac4..ea59b5a1a 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -72,10 +72,17 @@ compCheckWindow(WindowPtr pWin, void *data)
     else {
         assert(pWinPixmap == pParentPixmap);
     }
-    assert(0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
-    assert(0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3);
-    if (pParentPixmap)
-        assert(0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3);
+
+    assert(0 < pWinPixmap->refcnt)
+    assert(pWinPixmap->refcnt < 3);
+
+    assert(0 < pScreenPixmap->refcnt);
+    assert(pScreenPixmap->refcnt < 3);
+
+    if (pParentPixmap) {
+        assert(0 <= pParentPixmap->refcnt);
+        assert(pParentPixmap->refcnt < 3);
+    }
     return WT_WALKCHILDREN;
 }
 
diff --git a/dix/privates.c b/dix/privates.c
index 9ca80f0b6..83dfabc47 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -476,7 +476,8 @@ _dixAllocateObjectWithPrivates(unsigned baseSize, unsigned clear,
     PrivatePtr privates;
     PrivatePtr *devPrivates;
 
-    assert(type > PRIVATE_SCREEN && type < PRIVATE_LAST);
+    assert(type > PRIVATE_SCREEN);
+    assert(type < PRIVATE_LAST);
     assert(!screen_specific_private[type]);
 
     /* round up so that void * is aligned */
@@ -505,7 +506,8 @@ dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type)
     unsigned size;
     PrivatePtr p;
 
-    assert(type > PRIVATE_XSELINUX && type < PRIVATE_LAST);
+    assert(type > PRIVATE_XSELINUX);
+    assert(type < PRIVATE_LAST);
     assert(!screen_specific_private[type]);
 
     size = global_keys[type].offset;
@@ -554,7 +556,8 @@ dixFreePrivates(PrivatePtr privates, DevPrivateType type)
 extern _X_EXPORT int
 dixPrivatesSize(DevPrivateType type)
 {
-    assert(type >= PRIVATE_SCREEN && type < PRIVATE_LAST);
+    assert(type >= PRIVATE_SCREEN);
+    assert(type < PRIVATE_LAST);
     assert (!screen_specific_private[type]);
 
     return global_keys[type].offset;
@@ -696,7 +699,8 @@ _dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen,
     PrivatePtr *devPrivates;
     int privates_size;
 
-    assert(type > PRIVATE_SCREEN && type < PRIVATE_LAST);
+    assert(type > PRIVATE_SCREEN);
+    assert(type < PRIVATE_LAST);
     assert (screen_specific_private[type]);
 
     if (pScreen)
@@ -722,7 +726,8 @@ _dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen,
 int
 dixScreenSpecificPrivatesSize(ScreenPtr pScreen, DevPrivateType type)
 {
-    assert(type >= PRIVATE_SCREEN && type < PRIVATE_LAST);
+    assert(type >= PRIVATE_SCREEN);
+    assert(type < PRIVATE_LAST);
 
     if (screen_specific_private[type])
         return pScreen->screenSpecificPrivates[type].offset;
diff --git a/dix/region.c b/dix/region.c
index fd7313990..e269e695c 100644
--- a/dix/region.c
+++ b/dix/region.c
@@ -901,7 +901,8 @@ RegionUnionO(RegionPtr pReg,
     int x2;
 
     assert(y1 < y2);
-    assert(r1 != r1End && r2 != r2End);
+    assert(r1 != r1End);
+    assert(r2 != r2End);
 
     pNextRect = RegionTop(pReg);
 
diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index e28734898..174d4456a 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -48,8 +48,8 @@ ExaOffscreenValidate(ScreenPtr pScreen)
     assert(pExaScr->info->offScreenAreas->base_offset ==
            pExaScr->info->offScreenBase);
     for (area = pExaScr->info->offScreenAreas; area; area = area->next) {
-        assert(area->offset >= area->base_offset &&
-               area->offset < (area->base_offset + area->size));
+        assert(area->offset >= area->base_offset);
+        assert(area->offset < (area->base_offset + area->size));
         if (prev)
             assert(prev->base_offset + prev->size == area->base_offset);
         prev = area;
@@ -230,7 +230,8 @@ exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
          * Now get the system to merge the other needed areas together
          */
         while (area->size < real_size) {
-            assert(area->next && area->next->state == ExaOffscreenRemovable);
+            assert(area->next);
+            assert(area->next->state == ExaOffscreenRemovable);
             (void) ExaOffscreenKickOut(pScreen, area->next);
         }
     }
@@ -568,8 +569,8 @@ ExaOffscreenDefragment(ScreenPtr pScreen)
         area->base_offset = prev->base_offset;
         area->offset = area->base_offset;
         prev->offset += pExaDstPix->fb_ptr - pExaSrcPix->fb_ptr;
-        assert(prev->offset >= pExaScr->info->offScreenBase &&
-               prev->offset < pExaScr->info->memorySize);
+        assert(prev->offset >= pExaScr->info->offScreenBase);
+        assert(prev->offset < pExaScr->info->memorySize);
         prev->base_offset = prev->offset;
         if (area->next)
             prev->size = area->next->base_offset - prev->base_offset;
diff --git a/hw/xquartz/xpr/x-list.c b/hw/xquartz/xpr/x-list.c
index 29543d4e0..171657686 100644
--- a/hw/xquartz/xpr/x-list.c
+++ b/hw/xquartz/xpr/x-list.c
@@ -281,7 +281,8 @@ list_sort_1(x_list *lst, int length,
 
     /* Then merge them back together. */
 
-    assert(lst != NULL && mid != NULL);
+    assert(lst != NULL);
+    assert(mid != NULL);
 
     if ((*less)(mid->data, lst->data))
         out = out_head = mid, mid = mid->next;
diff --git a/record/record.c b/record/record.c
index fdcee7e00..3a1b00516 100644
--- a/record/record.c
+++ b/record/record.c
@@ -2376,7 +2376,8 @@ RecordDisableContext(RecordContextPtr pContext)
      * where all the disabled contexts are
      */
     i = RecordFindContextOnAllContexts(pContext);
-    assert((i != -1) && (i < numEnabledContexts));
+    assert(i != -1);
+    assert(i < numEnabledContexts);
     if (i != (numEnabledContexts - 1)) {
         ppAllContexts[i] = ppAllContexts[numEnabledContexts - 1];
         ppAllContexts[numEnabledContexts - 1] = pContext;
diff --git a/test/input.c b/test/input.c
index 9ff1a2fab..f092bb46d 100644
--- a/test/input.c
+++ b/test/input.c
@@ -1105,7 +1105,8 @@ cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2)
 {
     char **tags1, **tags2;
 
-    assert(attr1 && attr2);
+    assert(attr1);
+    assert(attr2);
     assert(attr1 != attr2);
     assert(attr1->flags == attr2->flags);
 
diff --git a/test/xfree86.c b/test/xfree86.c
index ff8ad2d2d..5ab23857f 100644
--- a/test/xfree86.c
+++ b/test/xfree86.c
@@ -69,7 +69,8 @@ xfree86_option_list_duplicate(void)
 
     a = xf86FindOption(options, o_null);
     b = xf86FindOption(duplicate, o_null);
-    assert(a && b);
+    assert(a);
+    assert(b);
 }
 
 static void
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index 8d19d5339..866da07f5 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -366,8 +366,10 @@ test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent * out, BOOL swap)
     values = (FP3232 *) (ptr + out->valuators_len * 4);
     for (i = 0; i < sizeof(in->valuators.mask) * 8 ||
          i < (out->valuators_len * 4) * 8; i++) {
-        if (i >= MAX_VALUATORS)
-            assert(!XIMaskIsSet(in->valuators.mask, i) && !XIMaskIsSet(ptr, i));
+        if (i >= MAX_VALUATORS) {
+            assert(!XIMaskIsSet(in->valuators.mask, i));
+            assert(!XIMaskIsSet(ptr, i));
+        }
         else if (i > sizeof(in->valuators.mask) * 8)
             assert(!XIMaskIsSet(ptr, i));
         else if (i > out->valuators_len * 4 * 8)
diff --git a/test/xi2/protocol-xiquerydevice.c b/test/xi2/protocol-xiquerydevice.c
index a068038fd..7e8da04e5 100644
--- a/test/xi2/protocol-xiquerydevice.c
+++ b/test/xi2/protocol-xiquerydevice.c
@@ -251,7 +251,8 @@ reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *closure)
                     }
 
                     assert(vi->length == 11);
-                    assert(vi->number >= 0 && vi->number < 4);
+                    assert(vi->number >= 0);
+                    assert(vi->number < 4);
                     if (info->deviceid == 2)    /* VCP */
                         assert(vi->number < 2);
 


More information about the xorg-commit mailing list