nlopess Sat Jan 13 11:16:15 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/gd/libgd gd.c
Log:
fix valgrind error in test bug24594.phpt
while at it, remove some dead code and change the pts vector to char to save
(much) memory
# Pierre: one more to merge ;)
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.6&r2=1.90.2.1.2.7&diff_format=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.6
php-src/ext/gd/libgd/gd.c:1.90.2.1.2.7
--- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.6 Tue Nov 14 13:45:24 2006
+++ php-src/ext/gd/libgd/gd.c Sat Jan 13 11:16:15 2007
@@ -2004,9 +2004,9 @@
/* stack of filled segments */
struct seg *stack;
struct seg *sp;
+ char **pts;
- int **pts;
- if(!im->tile){
+ if (!im->tile) {
return;
}
@@ -2014,10 +2014,10 @@
tiled = nc==gdTiled;
nc = gdImageTileGet(im,x,y);
- pts = (int **) ecalloc(sizeof(int *) * im->sy, sizeof(int));
+ pts = (char **) ecalloc(sizeof(char *) * im->sy, sizeof(char));
for (i=0; i<im->sy;i++) {
- pts[i] = (int *) ecalloc(im->sx, sizeof(int));
+ pts[i] = (char *) ecalloc(im->sx, sizeof(char));
}
stack = (struct seg *)safe_emalloc(sizeof(struct seg),
((int)(im->sy*im->sx)/4), 1);
@@ -2032,10 +2032,6 @@
while (sp>stack) {
FILL_POP(y, x1, x2, dy);
for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc);
x--) {
- if (pts[y][x]){
- /* we should never be here */
- break;
- }
nc = gdImageTileGet(im,x,y);
pts[y][x]=1;
gdImageSetPixel(im,x, y, nc);
@@ -2051,11 +2047,7 @@
}
x = x1+1;
do {
- for (; x<=wx2 && (!pts[y][x] && gdImageGetPixel(im,x,
y)==oc) ; x++) {
- if (pts[y][x]){
- /* we should never be here */
- break;
- }
+ for (; x<wx2 && (!pts[y][x] && gdImageGetPixel(im,x,
y)==oc) ; x++) {
nc = gdImageTileGet(im,x,y);
pts[y][x]=1;
gdImageSetPixel(im, x, y, nc);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php