iliaa Mon Nov 18 07:31:39 2002 EDT Modified files: /php4/ext/gd/libgd gd_jpeg.c gd_png.c gdhelpers.c gdhelpers.h Log: Changed memory allocation wrappers to macros, so that it is possible to see where the memory leak is happening. Index: php4/ext/gd/libgd/gd_jpeg.c diff -u php4/ext/gd/libgd/gd_jpeg.c:1.4 php4/ext/gd/libgd/gd_jpeg.c:1.5 --- php4/ext/gd/libgd/gd_jpeg.c:1.4 Tue Oct 29 18:08:01 2002 +++ php4/ext/gd/libgd/gd_jpeg.c Mon Nov 18 07:31:39 2002 @@ -29,6 +29,7 @@ /* JCE: arrange HAVE_LIBJPEG so that it can be set in gd.h */ #ifdef HAVE_LIBJPEG #include "gdhelpers.h" +#undef HAVE_STDLIB_H /* 1.8.1: remove dependency on jinclude.h */ #include "jpeglib.h" Index: php4/ext/gd/libgd/gd_png.c diff -u php4/ext/gd/libgd/gd_png.c:1.4 php4/ext/gd/libgd/gd_png.c:1.5 --- php4/ext/gd/libgd/gd_png.c:1.4 Tue Oct 29 18:08:01 2002 +++ php4/ext/gd/libgd/gd_png.c Mon Nov 18 07:31:39 2002 @@ -7,8 +7,9 @@ /* JCE: Arrange HAVE_LIBPNG so that it can be set in gd.h */ #ifdef HAVE_LIBPNG -#include "gdhelpers.h" + #include "png.h" /* includes zlib.h and setjmp.h */ +#include "gdhelpers.h" #define TRUE 1 #define FALSE 0 Index: php4/ext/gd/libgd/gdhelpers.c diff -u php4/ext/gd/libgd/gdhelpers.c:1.4 php4/ext/gd/libgd/gdhelpers.c:1.5 --- php4/ext/gd/libgd/gdhelpers.c:1.4 Sun Nov 17 14:45:10 2002 +++ php4/ext/gd/libgd/gdhelpers.c Mon Nov 18 07:31:39 2002 @@ -2,8 +2,6 @@ #include "config.h" #endif -#include "php.h" - #include "gd.h" #include "gdhelpers.h" #include <stdlib.h> @@ -75,34 +73,4 @@ /* 5. Return token */ *state = s; return result; -} - -void * -gdCalloc (size_t nmemb, size_t size) -{ - return ecalloc (nmemb, size); -} - -void * -gdMalloc (size_t size) -{ - return emalloc (size); -} - -void * -gdRealloc (void *ptr, size_t size) -{ - return erealloc (ptr, size); -} - -void -gdFree (void *ptr) -{ - efree (ptr); -} - -char * -gdEstrdup (const char *ptr) -{ - return estrdup(ptr); } Index: php4/ext/gd/libgd/gdhelpers.h diff -u php4/ext/gd/libgd/gdhelpers.h:1.3 php4/ext/gd/libgd/gdhelpers.h:1.4 --- php4/ext/gd/libgd/gdhelpers.h:1.3 Sun Nov 17 14:45:10 2002 +++ php4/ext/gd/libgd/gdhelpers.h Mon Nov 18 07:31:39 2002 @@ -2,6 +2,7 @@ #define GDHELPERS_H 1 #include <sys/types.h> +#include "php.h" /* TBB: strtok_r is not universal; provide an implementation of it. */ @@ -11,10 +12,11 @@ in gd.h, where callers can utilize it to correctly free memory allocated by these functions with the right version of free(). */ -void *gdCalloc(size_t nmemb, size_t size); -void *gdMalloc(size_t size); -void *gdRealloc(void *ptr, size_t size); -char *gdEstrdup(const char *ptr); +#define gdCalloc(nmemb, size) ecalloc(nmemb, size) +#define gdMalloc(size) emalloc(size) +#define gdRealloc(ptr, size) erealloc(ptr, size) +#define gdEstrdup(ptr) estrdup(ptr) +#define gdFree(ptr) efree(ptr) #endif /* GDHELPERS_H */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php