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/mesa/main/mm.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/mesa/main/mm.c')
-rw-r--r-- | src/mesa/main/mm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c index ab32123a403..473e90fc2d5 100644 --- a/src/mesa/main/mm.c +++ b/src/mesa/main/mm.c @@ -65,11 +65,11 @@ mmInit(unsigned ofs, unsigned size) if (!size) return NULL; - heap = (struct mem_block *) calloc(1, sizeof(struct mem_block)); + heap = calloc(1, sizeof(struct mem_block)); if (!heap) return NULL; - block = (struct mem_block *) calloc(1, sizeof(struct mem_block)); + block = calloc(1, sizeof(struct mem_block)); if (!block) { free(heap); return NULL; @@ -103,7 +103,7 @@ SliceBlock(struct mem_block *p, /* break left [p, newblock, p->next], then p = newblock */ if (startofs > p->ofs) { - newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block)); + newblock = calloc(1, sizeof(struct mem_block)); if (!newblock) return NULL; newblock->ofs = startofs; @@ -127,7 +127,7 @@ SliceBlock(struct mem_block *p, /* break right, also [p, newblock, p->next] */ if (size < p->size) { - newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block)); + newblock = calloc(1, sizeof(struct mem_block)); if (!newblock) return NULL; newblock->ofs = startofs + size; |