summaryrefslogtreecommitdiffstats
path: root/src/glx/drisw_glx.c
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2012-09-04 23:09:22 -0700
committerMatt Turner <[email protected]>2012-09-05 22:28:50 -0700
commit6bda027e01c15df24d36de5bf3838ea8ed7e9e56 (patch)
treebb41d06abd676913add0761732908c064b68663a /src/glx/drisw_glx.c
parent5067506ea6ada5eeae33b1acf1c916e00121c12a (diff)
Use calloc instead of malloc/memset-0
This patch has been generated by the following Coccinelle semantic patch: @@ expression E; identifier I; @@ - I = malloc(E); + I = calloc(1, E); ... - memset(I, 0, sizeof *I); Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/glx/drisw_glx.c')
-rw-r--r--src/glx/drisw_glx.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index b68e62272c7..920a9ab7b99 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -392,11 +392,10 @@ drisw_create_context(struct glx_screen *base,
shared = pcp_shared->driContext;
}
- pcp = malloc(sizeof *pcp);
+ pcp = calloc(1, sizeof *pcp);
if (pcp == NULL)
return NULL;
- memset(pcp, 0, sizeof *pcp);
if (!glx_context_init(&pcp->base, &psc->base, &config->base)) {
free(pcp);
return NULL;
@@ -457,11 +456,10 @@ drisw_create_context_attribs(struct glx_screen *base,
shared = pcp_shared->driContext;
}
- pcp = malloc(sizeof *pcp);
+ pcp = calloc(1, sizeof *pcp);
if (pcp == NULL)
return NULL;
- memset(pcp, 0, sizeof *pcp);
if (!glx_context_init(&pcp->base, &psc->base, &config->base)) {
free(pcp);
return NULL;
@@ -522,11 +520,10 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable,
Bool ret;
const __DRIswrastExtension *swrast = psc->swrast;
- pdp = malloc(sizeof(*pdp));
+ pdp = calloc(1, sizeof(*pdp));
if (!pdp)
return NULL;
- memset(pdp, 0, sizeof *pdp);
pdp->base.xDrawable = xDrawable;
pdp->base.drawable = drawable;
pdp->base.psc = &psc->base;