summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-06 09:29:00 -0700
committerBrian <[email protected]>2008-02-06 09:35:39 -0700
commitf12d641ab2bafe20f876dddb90ada76c83732757 (patch)
tree7b6049ea2704535ac7c6979eee3fc2a505f6f9c0 /src
parentc8af89cf722830ec16d594afd99d717aed71d44c (diff)
gallium: use mem_dup()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/softpipe/sp_state_blend.c10
-rw-r--r--src/mesa/pipe/softpipe/sp_state_rasterizer.c7
-rw-r--r--src/mesa/pipe/softpipe/sp_state_sampler.c4
3 files changed, 6 insertions, 15 deletions
diff --git a/src/mesa/pipe/softpipe/sp_state_blend.c b/src/mesa/pipe/softpipe/sp_state_blend.c
index 160ca5cbc09..2d40d6bd8f5 100644
--- a/src/mesa/pipe/softpipe/sp_state_blend.c
+++ b/src/mesa/pipe/softpipe/sp_state_blend.c
@@ -32,13 +32,12 @@
#include "sp_context.h"
#include "sp_state.h"
+
void *
softpipe_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));
}
void softpipe_bind_blend_state( struct pipe_context *pipe,
@@ -78,10 +77,7 @@ void *
softpipe_create_depth_stencil_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));
}
void
diff --git a/src/mesa/pipe/softpipe/sp_state_rasterizer.c b/src/mesa/pipe/softpipe/sp_state_rasterizer.c
index ce8fa4f2b8b..53755099dde 100644
--- a/src/mesa/pipe/softpipe/sp_state_rasterizer.c
+++ b/src/mesa/pipe/softpipe/sp_state_rasterizer.c
@@ -35,12 +35,9 @@
void *
softpipe_create_rasterizer_state(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *setup)
+ const struct pipe_rasterizer_state *rast)
{
- struct pipe_rasterizer_state *state =
- MALLOC( sizeof(struct pipe_rasterizer_state) );
- memcpy(state, setup, sizeof(struct pipe_rasterizer_state));
- return state;
+ return mem_dup(rast, sizeof(*rast));
}
void softpipe_bind_rasterizer_state(struct pipe_context *pipe,
diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c
index 3842e71503b..51b4b782873 100644
--- a/src/mesa/pipe/softpipe/sp_state_sampler.c
+++ b/src/mesa/pipe/softpipe/sp_state_sampler.c
@@ -40,9 +40,7 @@ void *
softpipe_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