g3dvl: Use Gallium MALLOC wrappers.
authorYounes Manton <younes.m@gmail.com>
Sat, 20 Dec 2008 22:09:55 +0000 (17:09 -0500)
committerYounes Manton <younes.m@gmail.com>
Sat, 10 Jan 2009 18:52:07 +0000 (13:52 -0500)
src/gallium/state_trackers/g3dvl/Makefile
src/gallium/state_trackers/g3dvl/vl_basic_csc.c
src/gallium/state_trackers/g3dvl/vl_context.c
src/gallium/state_trackers/g3dvl/vl_display.c
src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
src/gallium/state_trackers/g3dvl/vl_screen.c
src/gallium/state_trackers/g3dvl/vl_surface.c
src/libXvMC/Makefile
src/libXvMC/block.c

index 84a0b2c6d8cc4b4d391db3b4badefa9af104d50e..cddfca54fe5560d154962022f4ee73a1de88a948 100644 (file)
@@ -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                         \
 
 #############################################
 
index 626d23cd468ecddb9be34ea7eea5c2637620920a..3ce93cf49d1e72a8fddad5b455e529fa10a946bd 100644 (file)
@@ -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;
index 5b7bb73b39e6ea63271555a19270dc4ab06537a0..fbea1363d8743bbe76b74ce2a3ea3178d98662ff 100644 (file)
@@ -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;
 }
index af80faa7f52d967ce7555d7a50a33fba8d15cae9..dce06de75833cd4cf635e38f11af5e1d5ae12c0e 100644 (file)
@@ -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;
 }
index a31f5c58f46ebd0f983929788b8af1f6ae97d7fa..fcea899ef9ca21952e60d71fbec08865e5e3ceec 100644 (file)
@@ -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;
index 484f63b0d4d4b19251bf92db9e4fdceb3ea024b9..ade8643a66a239d72ac04c4a53569ed3d5537fd8 100644 (file)
@@ -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;
 }
index 076bd40d4140b6b1f8263fe0abf186e74218644e..911469f966a2281cb8097d1cd2316f7abf7b4351 100644 (file)
@@ -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;
 }
index 4de26e96202b65b9499d46b9ce48ce541153238a..7badcfd264568ebc5393e630c23ffecb1391ce60 100644 (file)
@@ -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                      \
index 328b035576b4575bf14493f78a1e7da09bd3a2ec..b38a89be0920188e55c43be7f17db13d5654eaf5 100644 (file)
@@ -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;
 }