Commit 9d25408a authored by Adam Richter's avatar Adam Richter

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");
parent dd1aebcc
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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
......
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment