Initialize image data to zero if we're running under Valgrind's control. This means the suppression file is no longer needed.

SVN revision: 10000
This commit is contained in:
tsauerbeck 2004-05-02 08:41:11 +00:00 committed by tsauerbeck
parent 31007f3255
commit c62c7f1fdf
4 changed files with 33 additions and 15 deletions

View File

@ -1373,9 +1373,21 @@ AC_ARG_ENABLE(convert-32-rgb-rot-90,
]
)
# Setting have_valgrind to "no" seems pointless, but we just need to
# put something in as the 4th parameter, so configure doesn't abort
# when valgrind.pc isn't found.
PKG_CHECK_MODULES(VALGRIND, valgrind, have_valgrind=yes, have_valgrind=no)
if test x$have_valgrind = "xyes"; then
AC_DEFINE(HAVE_VALGRIND, 1, [Valgrind support])
fi
#####################################################################
## Fill in flags
AC_SUBST(VALGRIND_CFLAGS)
AC_SUBST(VALGRIND_LIBS)
AC_SUBST(freetype_cflags)
AC_SUBST(freetype_libs)

View File

@ -1,12 +0,0 @@
# $Id$
# valgrind suppression file for Evas.
#
{
It's safe to ignore this one
Memcheck:Param
writev(vector[...])
obj:/lib/libc-2.3.2.so
obj:/usr/X11R6/lib/libX11.so.6.2
fun:_X11TransWritev
fun:_XSend
}

View File

@ -5,8 +5,8 @@ AUTOMAKE_OPTIONS = 1.4 foreign
# A list of all the files in the current directory which can be regenerated
MAINTAINERCLEANFILES = Makefile.in
LDFLAGS =
INCLUDES = @freetype_cflags@ \
LDFLAGS = @VALGRIND_LIBS@
INCLUDES = @freetype_cflags@ @VALGRIND_CFLAGS@ \
-I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include

View File

@ -5,6 +5,10 @@
#include <Eet.h>
#endif
#ifdef HAVE_VALGRIND
#include <valgrind/valgrind.h>
#endif
static Evas_Hash * images = NULL;
static Evas_Object_List * cache = NULL;
static int cache_size = 0;
@ -91,7 +95,21 @@ evas_common_image_surface_free(RGBA_Surface *is)
void
evas_common_image_surface_alloc(RGBA_Surface *is)
{
is->data = malloc(is->w * is->h * sizeof(DATA32));
size_t siz = is->w * is->h * sizeof(DATA32);
static int on_valgrind;
/* init data when we're under Valgrind's control */
#ifdef HAVE_VALGRIND
static int init;
if (!init)
{
on_valgrind = RUNNING_ON_VALGRIND;
init = 1;
}
#endif
is->data = on_valgrind ? calloc(1, siz) : malloc(siz);
}
void