summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYounes Manton <younes.m@gmail.com>2008-12-20 17:09:55 -0500
committerYounes Manton <younes.m@gmail.com>2009-01-10 13:52:07 -0500
commit1e9c3efcc783cee46268cc227234ed118f0cc08b (patch)
treeffbd201fa2eae04348797d74e2124f739858fe3d
parentdb1021a37c29a60c70ce294077680ca3e98a6460 (diff)
g3dvl: Use Gallium MALLOC wrappers.
-rw-r--r--src/gallium/state_trackers/g3dvl/Makefile5
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_basic_csc.c14
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_context.c6
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_display.c6
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c10
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_screen.c6
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_surface.c6
-rw-r--r--src/libXvMC/Makefile2
-rw-r--r--src/libXvMC/block.c10
9 files changed, 34 insertions, 31 deletions
diff --git a/src/gallium/state_trackers/g3dvl/Makefile b/src/gallium/state_trackers/g3dvl/Makefile
index 84a0b2c6d8..cddfca54fe 100644
--- a/src/gallium/state_trackers/g3dvl/Makefile
+++ b/src/gallium/state_trackers/g3dvl/Makefile
@@ -3,7 +3,10 @@ OBJECTS = vl_display.o vl_screen.o vl_context.o vl_surface.o vl_shader_build.o
vl_r16snorm_mc_buf.o
GALLIUMDIR = ../..
-CFLAGS += -g -Wall -fPIC -I${GALLIUMDIR}/include -I${GALLIUMDIR}/auxiliary -I${GALLIUMDIR}/winsys/g3dvl
+CFLAGS += -g -Wall -Werror=implicit-function-declaration -fPIC \
+ -I${GALLIUMDIR}/include \
+ -I${GALLIUMDIR}/auxiliary \
+ -I${GALLIUMDIR}/winsys/g3dvl \
#############################################
diff --git a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
index 626d23cd46..3ce93cf49d 100644
--- a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
+++ b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
@@ -1,13 +1,13 @@
#define VL_INTERNAL
#include "vl_basic_csc.h"
#include <assert.h>
-#include <stdlib.h>
#include <pipe/p_context.h>
#include <pipe/p_winsys.h>
#include <pipe/p_state.h>
#include <pipe/p_inlines.h>
#include <tgsi/tgsi_parse.h>
#include <tgsi/tgsi_build.h>
+#include <util/u_memory.h>
#include "vl_csc.h"
#include "vl_surface.h"
#include "vl_shader_build.h"
@@ -237,7 +237,7 @@ static int vlDestroy
pipe->winsys->buffer_destroy(pipe->winsys, basic_csc->vs_const_buf.buffer);
pipe->winsys->buffer_destroy(pipe->winsys, basic_csc->fs_const_buf.buffer);
- free(basic_csc);
+ FREE(basic_csc);
return 0;
}
@@ -369,7 +369,7 @@ static int vlCreateVertexShader
assert(context);
pipe = csc->pipe;
- tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token));
+ tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token));
/* Version */
*(struct tgsi_version*)&tokens[0] = tgsi_build_version();
@@ -430,7 +430,7 @@ static int vlCreateVertexShader
vs.tokens = tokens;
csc->vertex_shader = pipe->create_vs_state(pipe, &vs);
- free(tokens);
+ FREE(tokens);
return 0;
}
@@ -456,7 +456,7 @@ static int vlCreateFragmentShader
assert(context);
pipe = csc->pipe;
- tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token));
+ tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token));
/* Version */
*(struct tgsi_version*)&tokens[0] = tgsi_build_version();
@@ -517,7 +517,7 @@ static int vlCreateFragmentShader
fs.tokens = tokens;
csc->fragment_shader = pipe->create_fs_state(pipe, &fs);
- free(tokens);
+ FREE(tokens);
return 0;
}
@@ -691,7 +691,7 @@ int vlCreateBasicCSC
assert(pipe);
assert(csc);
- basic_csc = calloc(1, sizeof(struct vlBasicCSC));
+ basic_csc = CALLOC_STRUCT(vlBasicCSC);
if (!basic_csc)
return 1;
diff --git a/src/gallium/state_trackers/g3dvl/vl_context.c b/src/gallium/state_trackers/g3dvl/vl_context.c
index 5b7bb73b39..fbea1363d8 100644
--- a/src/gallium/state_trackers/g3dvl/vl_context.c
+++ b/src/gallium/state_trackers/g3dvl/vl_context.c
@@ -1,9 +1,9 @@
#define VL_INTERNAL
#include "vl_context.h"
#include <assert.h>
-#include <stdlib.h>
#include <pipe/p_context.h>
#include <pipe/p_state.h>
+#include <util/u_memory.h>
#include "vl_render.h"
#include "vl_r16snorm_mc_buf.h"
#include "vl_csc.h"
@@ -111,7 +111,7 @@ int vlCreateContext
assert(context);
assert(pipe);
- ctx = calloc(1, sizeof(struct vlContext));
+ ctx = CALLOC_STRUCT(vlContext);
if (!ctx)
return 1;
@@ -152,7 +152,7 @@ int vlDestroyContext
context->pipe->delete_rasterizer_state(context->pipe, context->raster);
context->pipe->delete_depth_stencil_alpha_state(context->pipe, context->dsa);
- free(context);
+ FREE(context);
return 0;
}
diff --git a/src/gallium/state_trackers/g3dvl/vl_display.c b/src/gallium/state_trackers/g3dvl/vl_display.c
index af80faa7f5..dce06de758 100644
--- a/src/gallium/state_trackers/g3dvl/vl_display.c
+++ b/src/gallium/state_trackers/g3dvl/vl_display.c
@@ -1,7 +1,7 @@
#define VL_INTERNAL
#include "vl_display.h"
#include <assert.h>
-#include <stdlib.h>
+#include <util/u_memory.h>
int vlCreateDisplay
(
@@ -14,7 +14,7 @@ int vlCreateDisplay
assert(native_display);
assert(display);
- dpy = calloc(1, sizeof(struct vlDisplay));
+ dpy = CALLOC_STRUCT(vlDisplay);
if (!dpy)
return 1;
@@ -32,7 +32,7 @@ int vlDestroyDisplay
{
assert(display);
- free(display);
+ FREE(display);
return 0;
}
diff --git a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
index a31f5c58f4..fcea899ef9 100644
--- a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
+++ b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
@@ -1,7 +1,6 @@
#define VL_INTERNAL
#include "vl_r16snorm_mc_buf.h"
#include <assert.h>
-#include <stdlib.h>
#include <pipe/p_context.h>
#include <pipe/p_winsys.h>
#include <pipe/p_screen.h>
@@ -10,6 +9,7 @@
#include <tgsi/tgsi_parse.h>
#include <tgsi/tgsi_build.h>
#include <util/u_math.h>
+#include <util/u_memory.h>
#include "vl_render.h"
#include "vl_shader_build.h"
#include "vl_surface.h"
@@ -869,8 +869,8 @@ static int vlDestroy
pipe->winsys->buffer_destroy(pipe->winsys, mc->vs_const_buf.buffer);
pipe->winsys->buffer_destroy(pipe->winsys, mc->fs_const_buf.buffer);
- free(mc->macroblocks);
- free(mc);
+ FREE(mc->macroblocks);
+ FREE(mc);
return 0;
}
@@ -1007,7 +1007,7 @@ static int vlCreateDataBufs
pipe->winsys->buffer_unmap(pipe->winsys, mc->fs_const_buf.buffer);
- mc->macroblocks = malloc(sizeof(struct vlMpeg2MacroBlock) * mc->macroblocks_per_picture);
+ mc->macroblocks = MALLOC(sizeof(struct vlMpeg2MacroBlock) * mc->macroblocks_per_picture);
return 0;
}
@@ -1133,7 +1133,7 @@ int vlCreateR16SNormBufferedMC
assert(pipe);
assert(render);
- mc = calloc(1, sizeof(struct vlR16SnormBufferedMC));
+ mc = CALLOC_STRUCT(vlR16SnormBufferedMC);
mc->base.vlBegin = &vlBegin;
mc->base.vlRenderMacroBlocksMpeg2 = &vlRenderMacroBlocksMpeg2R16SnormBuffered;
diff --git a/src/gallium/state_trackers/g3dvl/vl_screen.c b/src/gallium/state_trackers/g3dvl/vl_screen.c
index 484f63b0d4..ade8643a66 100644
--- a/src/gallium/state_trackers/g3dvl/vl_screen.c
+++ b/src/gallium/state_trackers/g3dvl/vl_screen.c
@@ -1,7 +1,7 @@
#define VL_INTERNAL
#include "vl_screen.h"
#include <assert.h>
-#include <stdlib.h>
+#include <util/u_memory.h>
int vlCreateScreen
(
@@ -17,7 +17,7 @@ int vlCreateScreen
assert(pscreen);
assert(vl_screen);
- scrn = calloc(1, sizeof(struct vlScreen));
+ scrn = CALLOC_STRUCT(vlScreen);
if (!scrn)
return 1;
@@ -37,7 +37,7 @@ int vlDestroyScreen
{
assert(screen);
- free(screen);
+ FREE(screen);
return 0;
}
diff --git a/src/gallium/state_trackers/g3dvl/vl_surface.c b/src/gallium/state_trackers/g3dvl/vl_surface.c
index 076bd40d41..911469f966 100644
--- a/src/gallium/state_trackers/g3dvl/vl_surface.c
+++ b/src/gallium/state_trackers/g3dvl/vl_surface.c
@@ -1,11 +1,11 @@
#define VL_INTERNAL
#include "vl_surface.h"
#include <assert.h>
-#include <stdlib.h>
#include <string.h>
#include <pipe/p_screen.h>
#include <pipe/p_state.h>
#include <pipe/p_inlines.h>
+#include <util/u_memory.h>
#include <vl_winsys.h>
#include "vl_screen.h"
#include "vl_context.h"
@@ -28,7 +28,7 @@ int vlCreateSurface
assert(screen);
assert(surface);
- sfc = calloc(1, sizeof(struct vlSurface));
+ sfc = CALLOC_STRUCT(vlSurface);
if (!sfc)
return 1;
@@ -64,7 +64,7 @@ int vlDestroySurface
assert(surface);
pipe_texture_release(&surface->texture);
- free(surface);
+ FREE(surface);
return 0;
}
diff --git a/src/libXvMC/Makefile b/src/libXvMC/Makefile
index 4de26e9620..7badcfd264 100644
--- a/src/libXvMC/Makefile
+++ b/src/libXvMC/Makefile
@@ -8,7 +8,7 @@ ifeq (${DRIVER}, softpipe)
OBJECTS += ${GALLIUMDIR}/winsys/g3dvl/xsp_winsys.o
endif
-CFLAGS += -g -fPIC -Wall \
+CFLAGS += -g -fPIC -Wall -Werror=implicit-function-declaration \
-I${GALLIUMDIR}/state_trackers/g3dvl \
-I${GALLIUMDIR}/winsys/g3dvl \
-I${GALLIUMDIR}/include \
diff --git a/src/libXvMC/block.c b/src/libXvMC/block.c
index 328b035576..b38a89be09 100644
--- a/src/libXvMC/block.c
+++ b/src/libXvMC/block.c
@@ -1,7 +1,7 @@
#include <assert.h>
-#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/extensions/XvMC.h>
+#include <util/u_memory.h>
#include <vl_display.h>
#include <vl_screen.h>
#include <vl_context.h>
@@ -26,7 +26,7 @@ Status XvMCCreateBlocks(Display *display, XvMCContext *context, unsigned int num
blocks->context_id = context->context_id;
blocks->num_blocks = num_blocks;
- blocks->blocks = malloc(BLOCK_SIZE * num_blocks);
+ blocks->blocks = MALLOC(BLOCK_SIZE * num_blocks);
/* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */
blocks->privData = display;
@@ -38,7 +38,7 @@ Status XvMCDestroyBlocks(Display *display, XvMCBlockArray *blocks)
assert(display);
assert(blocks);
assert(display == blocks->privData);
- free(blocks->blocks);
+ FREE(blocks->blocks);
return Success;
}
@@ -61,7 +61,7 @@ Status XvMCCreateMacroBlocks(Display *display, XvMCContext *context, unsigned in
blocks->context_id = context->context_id;
blocks->num_blocks = num_blocks;
- blocks->macro_blocks = malloc(sizeof(XvMCMacroBlock) * num_blocks);
+ blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks);
/* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */
blocks->privData = display;
@@ -73,7 +73,7 @@ Status XvMCDestroyMacroBlocks(Display *display, XvMCMacroBlockArray *blocks)
assert(display);
assert(blocks);
assert(display == blocks->privData);
- free(blocks->macro_blocks);
+ FREE(blocks->macro_blocks);
return Success;
}