Cell: use mem_dup()
authorBrian <brian.paul@tungstengraphics.com>
Wed, 6 Feb 2008 16:35:33 +0000 (09:35 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 6 Feb 2008 16:35:39 +0000 (09:35 -0700)
src/mesa/pipe/cell/ppu/cell_state_blend.c
src/mesa/pipe/cell/ppu/cell_state_sampler.c

index 2c19aa3971535b0df62c31af11127d1e04f50ec3..4fc60548c8579aaa0b438f5c470409e61dc85327 100644 (file)
@@ -39,9 +39,7 @@ void *
 cell_create_blend_state(struct pipe_context *pipe,
                         const struct pipe_blend_state *blend)
 {
-   struct pipe_blend_state *state = MALLOC(sizeof(struct pipe_blend_state));
-   memcpy(state, blend, sizeof(struct pipe_blend_state));
-   return state;
+   return mem_dup(blend, sizeof(*blend));
 }
 
 
@@ -85,10 +83,7 @@ void *
 cell_create_depth_stencil_alpha_state(struct pipe_context *pipe,
                  const struct pipe_depth_stencil_alpha_state *depth_stencil)
 {
-   struct pipe_depth_stencil_alpha_state *state =
-      MALLOC(sizeof(struct pipe_depth_stencil_alpha_state));
-   memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_alpha_state));
-   return state;
+   return mem_dup(depth_stencil, sizeof(*depth_stencil));
 }
 
 
index 317f7603bb720c33781fa92271f06bb5b015afaf..ade6cc8338e2b93b671f08325a4a30068ad6b777 100644 (file)
@@ -40,9 +40,7 @@ void *
 cell_create_sampler_state(struct pipe_context *pipe,
                           const struct pipe_sampler_state *sampler)
 {
-   struct pipe_sampler_state *state = MALLOC( sizeof(struct pipe_sampler_state) );
-   memcpy(state, sampler, sizeof(struct pipe_sampler_state));
-   return state;
+   return mem_dup(sampler, sizeof(*sampler));
 }
 
 void