diff options
author | Matt Turner <[email protected]> | 2012-09-03 19:44:00 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2012-09-05 22:28:50 -0700 |
commit | 2b7a972e3f36bfcdc6fbe2b59d7ffdcde49c9405 (patch) | |
tree | 4b9504b4799e9d29363690fb9083ac4bbcf78d51 /src/glx/XF86dri.c | |
parent | 812931f602ff913a51a608a9b1b6826b7f2bfae0 (diff) |
Don't cast the return value of malloc/realloc
This patch has been generated by the following Coccinelle semantic
patch:
// Don't cast the return value of malloc/realloc.
//
// Casting the return value of malloc/realloc only stands to hide
// errors.
@@
type T;
expression E1, E2;
@@
- (T)
(
_mesa_align_calloc(E1, E2)
|
_mesa_align_malloc(E1, E2)
|
calloc(E1, E2)
|
malloc(E1)
|
realloc(E1, E2)
)
Diffstat (limited to 'src/glx/XF86dri.c')
-rw-r--r-- | src/glx/XF86dri.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/glx/XF86dri.c b/src/glx/XF86dri.c index fe3a1551fa6..b1cdc9b2865 100644 --- a/src/glx/XF86dri.c +++ b/src/glx/XF86dri.c @@ -201,7 +201,7 @@ XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, } if (rep.length) { - if (!(*busIdString = (char *) calloc(rep.busIdStringLength + 1, 1))) { + if (!(*busIdString = calloc(rep.busIdStringLength + 1, 1))) { _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); @@ -302,7 +302,7 @@ XF86DRIGetClientDriverName(Display * dpy, int screen, if (rep.length) { if (! (*clientDriverName = - (char *) calloc(rep.clientDriverNameLength + 1, 1))) { + calloc(rep.clientDriverNameLength + 1, 1))) { _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); @@ -521,7 +521,7 @@ XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, if (*numClipRects) { int len = sizeof(drm_clip_rect_t) * (*numClipRects); - *pClipRects = (drm_clip_rect_t *) calloc(len, 1); + *pClipRects = calloc(len, 1); if (*pClipRects) _XRead(dpy, (char *) *pClipRects, len); } @@ -532,7 +532,7 @@ XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, if (*numBackClipRects) { int len = sizeof(drm_clip_rect_t) * (*numBackClipRects); - *pBackClipRects = (drm_clip_rect_t *) calloc(len, 1); + *pBackClipRects = calloc(len, 1); if (*pBackClipRects) _XRead(dpy, (char *) *pBackClipRects, len); } @@ -582,7 +582,7 @@ XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer, *devPrivateSize = rep.devPrivateSize; if (rep.length) { - if (!(*pDevPrivate = (void *) calloc(rep.devPrivateSize, 1))) { + if (!(*pDevPrivate = calloc(rep.devPrivateSize, 1))) { _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); |