diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-11 16:42:09 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-12-13 15:12:43 +1000 |
commit | 121ac75d41f9b46035b74411c86b3619d25376af (patch) | |
tree | 9abdfe50ccb2c153ca4aa6327df1585dd91497a3 | |
parent | 45be57ef41d394a519f772e7e455f0821f57fda6 (diff) |
server/barriers: use new/delete instead of malloc/free
saves us the unwieldly reinterpret_cast
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | tests/server/barriers-notify.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/server/barriers-notify.cpp b/tests/server/barriers-notify.cpp index 71486d7..b656ceb 100644 --- a/tests/server/barriers-notify.cpp +++ b/tests/server/barriers-notify.cpp @@ -41,10 +41,10 @@ TEST_F(BarrierNotify, ReceivesNotifyEvents) XIEventMask mask; mask.deviceid = XIAllMasterDevices; mask.mask_len = XIMaskLen(XI_LASTEVENT); - mask.mask = reinterpret_cast<unsigned char*>(calloc(mask.mask_len, 1)); + mask.mask = new unsigned char[mask.mask_len](); XISetMask(mask.mask, XI_BarrierHit); XISelectEvents(dpy, root, &mask, 1); - free(mask.mask); + delete[] mask.mask; XSync(dpy, False); dev->PlayOne(EV_REL, REL_X, -40, True); @@ -76,11 +76,11 @@ TEST_F(BarrierNotify, CorrectEventIDs) XIEventMask mask; mask.deviceid = XIAllMasterDevices; mask.mask_len = XIMaskLen(XI_LASTEVENT); - mask.mask = reinterpret_cast<unsigned char*>(calloc(mask.mask_len, 1)); + mask.mask = new unsigned char[mask.mask_len](); XISetMask(mask.mask, XI_BarrierHit); XISetMask(mask.mask, XI_BarrierLeave); XISelectEvents(dpy, root, &mask, 1); - free(mask.mask); + delete[] mask.mask; XSync(dpy, False); /* Ensure we have a bunch of BarrierHits on our hands. */ @@ -141,11 +141,11 @@ TEST_F(BarrierNotify, BarrierReleases) XIEventMask mask; mask.deviceid = XIAllMasterDevices; mask.mask_len = XIMaskLen(XI_LASTEVENT); - mask.mask = reinterpret_cast<unsigned char*>(calloc(mask.mask_len, 1)); + mask.mask = new unsigned char[mask.mask_len](); XISetMask(mask.mask, XI_BarrierHit); XISetMask(mask.mask, XI_BarrierLeave); XISelectEvents(dpy, root, &mask, 1); - free(mask.mask); + delete[] mask.mask; XSync(dpy, False); XIWarpPointer(dpy, VIRTUAL_CORE_POINTER_ID, None, root, 0, 0, 0, 0, 30, 30); @@ -198,10 +198,10 @@ TEST_F(BarrierNotify, DestroyWindow) XIEventMask mask; mask.deviceid = XIAllMasterDevices; mask.mask_len = XIMaskLen(XI_LASTEVENT); - mask.mask = reinterpret_cast<unsigned char*>(calloc(mask.mask_len, 1)); + mask.mask = new unsigned char[mask.mask_len](); XISetMask(mask.mask, XI_BarrierHit); XISelectEvents(dpy, win, &mask, 1); - free(mask.mask); + delete[] mask.mask; XSync(dpy, False); dev->PlayOne(EV_REL, REL_X, -40, True); @@ -253,10 +253,10 @@ TEST_F(BarrierNotify, UnmapWindow) XIEventMask mask; mask.deviceid = XIAllMasterDevices; mask.mask_len = XIMaskLen(XI_LASTEVENT); - mask.mask = reinterpret_cast<unsigned char*>(calloc(mask.mask_len, 1)); + mask.mask = new unsigned char[mask.mask_len](); XISetMask(mask.mask, XI_BarrierHit); XISelectEvents(dpy, win, &mask, 1); - free(mask.mask); + delete[] mask.mask; XSync(dpy, False); dev->PlayOne(EV_REL, REL_X, -40, True); @@ -731,11 +731,11 @@ TEST_F(BarrierNotify, ReceivesLeaveOnDestroyWhenInsideHitbox) XIEventMask mask; mask.deviceid = XIAllMasterDevices; mask.mask_len = XIMaskLen(XI_LASTEVENT); - mask.mask = reinterpret_cast<unsigned char*>(calloc(mask.mask_len, 1)); + mask.mask = new unsigned char[mask.mask_len](); XISetMask(mask.mask, XI_BarrierHit); XISetMask(mask.mask, XI_BarrierLeave); XISelectEvents(dpy, win, &mask, 1); - free(mask.mask); + delete[] mask.mask; XSync(dpy, False); dev->PlayOne(EV_REL, REL_X, -40, True); @@ -774,11 +774,11 @@ TEST_F(BarrierNotify, DoesntReceiveLeaveOnDestroyWhenOutsideHitbox) XIEventMask mask; mask.deviceid = XIAllMasterDevices; mask.mask_len = XIMaskLen(XI_LASTEVENT); - mask.mask = reinterpret_cast<unsigned char*>(calloc(mask.mask_len, 1)); + mask.mask = new unsigned char[mask.mask_len](); XISetMask(mask.mask, XI_BarrierHit); XISetMask(mask.mask, XI_BarrierLeave); XISelectEvents(dpy, win, &mask, 1); - free(mask.mask); + delete[] mask.mask; XSync(dpy, False); /* Move the pointer, but don't hit the barrier. */ |