diff options
author | Matt Turner <mattst88@gmail.com> | 2014-09-21 21:24:01 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2014-12-08 17:02:19 -0800 |
commit | 8af4aaf351313f9d4692697bf28d3c3f84e01ca4 (patch) | |
tree | 3d7fdabf8fc729efef9d011ac583acd0b7ae8e3d /src/gallium/state_trackers/glx/xlib/glx_api.c | |
parent | f0a8bcd84e50468a703a0ac366a4e067610df30c (diff) |
Don't cast the return value of malloc/realloc
See commit 2b7a972e for the Coccinelle script.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/gallium/state_trackers/glx/xlib/glx_api.c')
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/glx_api.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 1807edbf5c..ad80dc09d1 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -253,8 +253,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, */ xmvis->vishandle = vinfo; /* Allocate more space for additional visual */ - VisualTable = (XMesaVisual *) realloc( VisualTable, - sizeof(XMesaVisual) * (NumVisuals + 1)); + VisualTable = realloc(VisualTable, sizeof(XMesaVisual) * (NumVisuals + 1)); /* add xmvis to the list */ VisualTable[NumVisuals] = xmvis; NumVisuals++; @@ -1078,7 +1077,7 @@ glXChooseVisual( Display *dpy, int screen, int *list ) xmvis = choose_visual(dpy, screen, list, GL_FALSE); if (xmvis) { /* create a new vishandle - the cached one may be stale */ - xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo)); + xmvis->vishandle = malloc(sizeof(XVisualInfo)); if (xmvis->vishandle) { memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo)); } @@ -1829,8 +1828,7 @@ glXGetFBConfigs( Display *dpy, int screen, int *nelements ) visTemplate.screen = screen; visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements); if (*nelements > 0) { - XMesaVisual *results; - results = (XMesaVisual *) malloc(*nelements * sizeof(XMesaVisual)); + XMesaVisual *results = malloc(*nelements * sizeof(XMesaVisual)); if (!results) { *nelements = 0; return NULL; @@ -1864,7 +1862,7 @@ glXChooseFBConfig(Display *dpy, int screen, xmvis = choose_visual(dpy, screen, attribList, GL_TRUE); if (xmvis) { - GLXFBConfig *config = (GLXFBConfig *) malloc(sizeof(XMesaVisual)); + GLXFBConfig *config = malloc(sizeof(XMesaVisual)); if (!config) { *nitems = 0; return NULL; @@ -1889,7 +1887,7 @@ glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) return xmvis->vishandle; #else /* create a new vishandle - the cached one may be stale */ - xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo)); + xmvis->vishandle = malloc(sizeof(XVisualInfo)); if (xmvis->vishandle) { memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo)); } |