From 721019db1fa4728c9fa32babf48101eb4acd312a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Mon, 22 Dec 1997 15:26:50 -0800
Subject: [PATCH] updated to work with NT (no dual macro definitions)

Rev: src/modules/Image/blit.c:1.25
Rev: src/modules/Image/colortable.c:1.29
Rev: src/modules/Image/configure.in:1.4
Rev: src/modules/Image/dct.c:1.10
Rev: src/modules/Image/font.c:1.22
Rev: src/modules/Image/image.c:1.70
Rev: src/modules/Image/matrix.c:1.11
Rev: src/modules/Image/operator.c:1.10
Rev: src/modules/Image/pattern.c:1.10
Rev: src/modules/Image/polyfill.c:1.16
---
 src/modules/Image/blit.c       | 56 ++++++++++++++++------------------
 src/modules/Image/colortable.c |  8 +++--
 src/modules/Image/configure.in |  2 +-
 src/modules/Image/dct.c        | 12 +++-----
 src/modules/Image/font.c       |  7 +++--
 src/modules/Image/image.c      | 42 +++++++++++--------------
 src/modules/Image/matrix.c     | 15 ++++-----
 src/modules/Image/operator.c   | 42 ++++++++++++-------------
 src/modules/Image/pattern.c    |  8 ++---
 src/modules/Image/polyfill.c   |  6 ++--
 10 files changed, 92 insertions(+), 106 deletions(-)

diff --git a/src/modules/Image/blit.c b/src/modules/Image/blit.c
index e6d475b4b0..ea5266e003 100644
--- a/src/modules/Image/blit.c
+++ b/src/modules/Image/blit.c
@@ -1,10 +1,10 @@
-/* $Id: blit.c,v 1.24 1997/11/24 16:11:55 mirar Exp $ */
+/* $Id: blit.c,v 1.25 1997/12/22 23:26:43 hubbe Exp $ */
 #include "global.h"
 
 /*
 **! module Image
 **! note
-**!	$Id: blit.c,v 1.24 1997/11/24 16:11:55 mirar Exp $
+**!	$Id: blit.c,v 1.25 1997/12/22 23:26:43 hubbe Exp $
 **! class image
 */
 
@@ -29,8 +29,6 @@ extern struct program *image_program;
 #define THISOBJ (fp->current_object)
 
 #define absdiff(a,b) ((a)<(b)?((b)-(a)):((a)-(b)))
-#define min(a,b) ((a)<(b)?(a):(b))
-#define max(a,b) ((a)<(b)?(b):(a))
 
 #if 0
 #include <sys/resource.h>
@@ -58,7 +56,7 @@ static void chrono(char *x)
 
 /***************** internals ***********************************/
 
-#define testrange(x) max(min((x),255),0)
+#define testrange(x) MAXIMUM(MINIMUM((x),255),0)
 
 #define apply_alpha(x,y,alpha) \
    ((unsigned char)((y*(255L-(alpha))+x*(alpha))/255L))
@@ -219,10 +217,10 @@ void img_crop(struct image *dest,
    dest->xsize=x2-x1+1;
    dest->ysize=y2-y1+1;
 
-   xp=max(0,-x1);
-   yp=max(0,-y1);
-   xs=max(0,x1);
-   ys=max(0,y1);
+   xp=MAXIMUM(0,-x1);
+   yp=MAXIMUM(0,-y1);
+   xs=MAXIMUM(0,x1);
+   ys=MAXIMUM(0,y1);
 
    if (x1<0) x1=0; else if (x1>=img->xsize) x1=img->xsize-1;
    if (y1<0) y1=0; else if (y1>=img->ysize) y1=img->ysize-1;
@@ -309,11 +307,11 @@ void image_paste(INT32 args)
      push_object(THISOBJ);
      return;
    }   
-   blitwidth=min(x2,THIS->xsize-1)-max(x1,0)+1;
-   blitheight=min(y2,THIS->ysize-1)-max(y1,0)+1;
+   blitwidth=MINIMUM(x2,THIS->xsize-1)-MAXIMUM(x1,0)+1;
+   blitheight=MINIMUM(y2,THIS->ysize-1)-MAXIMUM(y1,0)+1;
    
-   img_blit(THIS->img+max(0,x1)+(THIS->xsize)*max(0,y1),
-	    img->img+max(0,-x1)+(x2-x1+1)*max(0,-y1),
+   img_blit(THIS->img+MAXIMUM(0,x1)+(THIS->xsize)*MAXIMUM(0,y1),
+	    img->img+MAXIMUM(0,-x1)+(x2-x1+1)*MAXIMUM(0,-y1),
 	    blitwidth,
 	    blitheight,
 	    THIS->xsize,
@@ -463,15 +461,15 @@ CHRONO("image_paste_mask init");
    }
    else x1=y1=0;
 
-   x2=min(THIS->xsize-x1,min(img->xsize,mask->xsize));
-   y2=min(THIS->ysize-y1,min(img->ysize,mask->ysize));
+   x2=MINIMUM(THIS->xsize-x1,MINIMUM(img->xsize,mask->xsize));
+   y2=MINIMUM(THIS->ysize-y1,MINIMUM(img->ysize,mask->ysize));
 
 CHRONO("image_paste_mask begin");
 
-   s=img->img+max(0,-x1)+max(0,-y1)*img->xsize;
-   m=mask->img+max(0,-x1)+max(0,-y1)*mask->xsize;
-   d=THIS->img+max(0,-x1)+x1+(y1+max(0,-y1))*THIS->xsize;
-   x=max(0,-x1);
+   s=img->img+MAXIMUM(0,-x1)+MAXIMUM(0,-y1)*img->xsize;
+   m=mask->img+MAXIMUM(0,-x1)+MAXIMUM(0,-y1)*mask->xsize;
+   d=THIS->img+MAXIMUM(0,-x1)+x1+(y1+MAXIMUM(0,-y1))*THIS->xsize;
+   x=MAXIMUM(0,-x1);
    smod=img->xsize-(x2-x);
    mmod=mask->xsize-(x2-x);
    dmod=THIS->xsize-(x2-x);
@@ -479,9 +477,9 @@ CHRONO("image_paste_mask begin");
    q=1.0/255;
 
    THREADS_ALLOW();
-   for (y=max(0,-y1); y<y2; y++)
+   for (y=MAXIMUM(0,-y1); y<y2; y++)
    {
-      for (x=max(0,-x1); x<x2; x++)
+      for (x=MAXIMUM(0,-x1); x<x2; x++)
       {
 	 if (m->r==255) d->r=s->r;
 	 else if (m->r==0) {}
@@ -570,14 +568,14 @@ void image_paste_alpha_color(INT32 args)
    }
    else x1=y1=0;
    
-   x2=min(THIS->xsize-x1,mask->xsize);
-   y2=min(THIS->ysize-y1,mask->ysize);
+   x2=MINIMUM(THIS->xsize-x1,mask->xsize);
+   y2=MINIMUM(THIS->ysize-y1,mask->ysize);
 
 CHRONO("image_paste_alpha_color begin");
 
-   m=mask->img+max(0,-x1)+max(0,-y1)*mask->xsize;
-   d=THIS->img+max(0,-x1)+x1+(y1+max(0,-y1))*THIS->xsize;
-   x=max(0,-x1);
+   m=mask->img+MAXIMUM(0,-x1)+MAXIMUM(0,-y1)*mask->xsize;
+   d=THIS->img+MAXIMUM(0,-x1)+x1+(y1+MAXIMUM(0,-y1))*THIS->xsize;
+   x=MAXIMUM(0,-x1);
    mmod=mask->xsize-(x2-x);
    dmod=THIS->xsize-(x2-x);
 
@@ -586,9 +584,9 @@ CHRONO("image_paste_alpha_color begin");
    rgb=THIS->rgb;
 
    THREADS_ALLOW();
-   for (y=max(0,-y1); y<y2; y++)
+   for (y=MAXIMUM(0,-y1); y<y2; y++)
    {
-      for (x=max(0,-x1); x<x2; x++)
+      for (x=MAXIMUM(0,-x1); x<x2; x++)
       {
 	 if (m->r==255) d->r=rgb.r;
 	 else if (m->r==0) ;
@@ -620,7 +618,7 @@ void img_box(INT32 x1,INT32 y1,INT32 x2,INT32 y2)
    if (x2<0||y2<0||x1>=THIS->xsize||y1>=THIS->ysize) return;
    if (x1<0) x1 = 0;
    if (y1<0) y1 = 0;
-   img_box_nocheck(max(x1,0),max(y1,0),min(x2,THIS->xsize-1),min(y2,THIS->ysize-1));
+   img_box_nocheck(MAXIMUM(x1,0),MAXIMUM(y1,0),MINIMUM(x2,THIS->xsize-1),MINIMUM(y2,THIS->ysize-1));
 }
 
 
diff --git a/src/modules/Image/colortable.c b/src/modules/Image/colortable.c
index faef61406c..a217d8f543 100644
--- a/src/modules/Image/colortable.c
+++ b/src/modules/Image/colortable.c
@@ -1,11 +1,11 @@
 #include <config.h>
 
-/* $Id: colortable.c,v 1.28 1997/11/30 22:05:33 grubba Exp $ */
+/* $Id: colortable.c,v 1.29 1997/12/22 23:26:44 hubbe Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: colortable.c,v 1.28 1997/11/30 22:05:33 grubba Exp $
+**!	$Id: colortable.c,v 1.29 1997/12/22 23:26:44 hubbe Exp $
 **! class colortable
 **!
 **!	This object keeps colortable information,
@@ -21,12 +21,14 @@
 #undef COLORTABLE_REDUCE_DEBUG
 
 #include "global.h"
-RCSID("$Id: colortable.c,v 1.28 1997/11/30 22:05:33 grubba Exp $");
+RCSID("$Id: colortable.c,v 1.29 1997/12/22 23:26:44 hubbe Exp $");
 
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 #include <errno.h>
 #include <math.h> /* fabs() */
 
diff --git a/src/modules/Image/configure.in b/src/modules/Image/configure.in
index 7184a2532a..10c3fe257a 100644
--- a/src/modules/Image/configure.in
+++ b/src/modules/Image/configure.in
@@ -7,7 +7,7 @@ sinclude(../module_configure.in)
 
 AC_FUNC_MMAP
 
-AC_CHECK_HEADERS(sys/fcntl.h fcntl.h stdlib.h)
+AC_CHECK_HEADERS(sys/fcntl.h fcntl.h stdlib.h netinet/in.h)
 
 AC_SUBST(RANLIB)
 
diff --git a/src/modules/Image/dct.c b/src/modules/Image/dct.c
index 866a8431f0..6e30807082 100644
--- a/src/modules/Image/dct.c
+++ b/src/modules/Image/dct.c
@@ -1,9 +1,9 @@
-/* $Id: dct.c,v 1.9 1997/10/27 22:41:19 mirar Exp $ */
+/* $Id: dct.c,v 1.10 1997/12/22 23:26:45 hubbe Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: dct.c,v 1.9 1997/10/27 22:41:19 mirar Exp $
+**!	$Id: dct.c,v 1.10 1997/12/22 23:26:45 hubbe Exp $
 **! class image
 */
 
@@ -28,9 +28,7 @@ extern struct program *image_program;
 #define THIS ((struct image *)(fp->current_storage))
 #define THISOBJ (fp->current_object)
 
-#define min(a,b) ((a)<(b)?(a):(b))
-#define max(a,b) ((a)<(b)?(b):(a))
-#define testrange(x) max(min((x),255),0)
+#define testrange(x) MAXIMUM(MINIMUM((x),255),0)
 
 static const double c0=0.70710678118654752440;
 static const double pi=3.14159265358979323846;
@@ -96,8 +94,8 @@ void image_dct(INT32 args)
        && sp[-args].type==T_INT 
        && sp[1-args].type==T_INT)
    {
-      img->xsize=max(1,sp[-args].u.integer);
-      img->ysize=max(1,sp[1-args].u.integer);
+      img->xsize=MAXIMUM(1,sp[-args].u.integer);
+      img->ysize=MAXIMUM(1,sp[1-args].u.integer);
    }
    else error("Illegal arguments to image->dct()\n");
 
diff --git a/src/modules/Image/font.c b/src/modules/Image/font.c
index eaeba48fb8..1c347d2e6a 100644
--- a/src/modules/Image/font.c
+++ b/src/modules/Image/font.c
@@ -1,4 +1,4 @@
-/* $Id: font.c,v 1.21 1997/11/11 22:17:48 mirar Exp $ */
+/* $Id: font.c,v 1.22 1997/12/22 23:26:46 hubbe Exp $ */
 #include <config.h>
 
 #define SPACE_CHAR 'i'
@@ -6,7 +6,7 @@
 /*
 **! module Image
 **! note
-**!	$Id: font.c,v 1.21 1997/11/11 22:17:48 mirar Exp $
+**!	$Id: font.c,v 1.22 1997/12/22 23:26:46 hubbe Exp $
 **! class font
 **!
 **! note
@@ -106,7 +106,10 @@ Kerningtable types:
 #include <sys/fcntl.h>
 #endif
 
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
+
 #include <errno.h>
 
 #include "config.h"
diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c
index c785be2d3a..90e2898250 100644
--- a/src/modules/Image/image.c
+++ b/src/modules/Image/image.c
@@ -1,9 +1,9 @@
-/* $Id: image.c,v 1.69 1997/11/29 18:59:35 hedda Exp $ */
+/* $Id: image.c,v 1.70 1997/12/22 23:26:46 hubbe Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: image.c,v 1.69 1997/11/29 18:59:35 hedda Exp $
+**!	$Id: image.c,v 1.70 1997/12/22 23:26:46 hubbe Exp $
 **! class image
 **!
 **!	The main object of the <ref>Image</ref> module, this object
@@ -82,7 +82,7 @@
 
 #include "stralloc.h"
 #include "global.h"
-RCSID("$Id: image.c,v 1.69 1997/11/29 18:59:35 hedda Exp $");
+RCSID("$Id: image.c,v 1.70 1997/12/22 23:26:46 hubbe Exp $");
 #include "pike_macros.h"
 #include "object.h"
 #include "constants.h"
@@ -103,9 +103,7 @@ extern struct program *image_colortable_program;
 #define THIS ((struct image *)(fp->current_storage))
 #define THISOBJ (fp->current_object)
 
-#define min(a,b) ((a)<(b)?(a):(b))
-#define max(a,b) ((a)<(b)?(b):(a))
-#define testrange(x) max(min(((int)x),255),0)
+#define testrange(x) MAXIMUM(MINIMUM(((int)x),255),0)
 
 #define sq(x) ((x)*(x))
 
@@ -1296,32 +1294,32 @@ void image_tuned_box(INT32 args)
 	{
 	  image_tuned_box_leftright(topleft, bottomright, 
 				    this->img+x1+this->xsize*y1, 
-				    xw+1, min(xw+1, this->xsize-x1),  
-				    this->xsize, min(yw+1, this->ysize-y1));
+				    xw+1, MINIMUM(xw+1, this->xsize-x1),  
+				    this->xsize, MINIMUM(yw+1, this->ysize-y1));
 
 	} 
       else if(color_equal(topleft,topright) && color_equal(bottomleft,bottomright))
 	{
 	  image_tuned_box_topbottom(topleft, bottomleft, 
 				    this->img+x1+this->xsize*y1, 
-				    min(xw+1, this->xsize-x1), this->xsize, 
-				    yw+1, min(yw+1, this->ysize-y1));
+				    MINIMUM(xw+1, this->xsize-x1), this->xsize, 
+				    yw+1, MINIMUM(yw+1, this->ysize-y1));
 	} else 
 	  goto ugly;
     } else {  
     ugly:
       dxw = 1.0/(float)xw;
       dyw = 1.0/(float)yw;
-      ymax=min(yw,this->ysize-y1);
-      for (x=max(0,-x1); x<=xw && x+x1<this->xsize; x++)
+      ymax=MINIMUM(yw,this->ysize-y1);
+      for (x=MAXIMUM(0,-x1); x<=xw && x+x1<this->xsize; x++)
 	{
 #define tune_factor(a,aw) (1.0-((float)(a)*(aw)))
 	  float tfx1=tune_factor(x,dxw);
 	  float tfx2=tune_factor(xw-x,dxw);
 
-	  img=this->img+x+x1+this->xsize*max(0,y1);
+	  img=this->img+x+x1+this->xsize*MAXIMUM(0,y1);
 	  if (topleft.alpha||topright.alpha||bottomleft.alpha||bottomright.alpha)
-	    for (y=max(0,-y1); y<ymax; y++)
+	    for (y=MAXIMUM(0,-y1); y<ymax; y++)
 	      {
 		float tfy;
 		rgbda_group sum={0.0,0.0,0.0,0.0};
@@ -1345,7 +1343,7 @@ void image_tuned_box(INT32 args)
 		img+=this->xsize;
 	      }
 	  else
-	    for (y=max(0,-y1); y<ymax; y++)
+	    for (y=MAXIMUM(0,-y1); y<ymax; y++)
 	      {
 		float tfy;
 		rgbd_group sum={0,0,0};
@@ -1821,18 +1819,12 @@ exit_loop:
    push_object(o);
 }
 
-#ifndef MAX
-#define MAX(X,Y) ((X)>(Y)?(X):(Y))
-#endif
 #ifndef MAX3
-#define MAX3(X,Y,Z) MAX(MAX(X,Y),Z)
+#define MAX3(X,Y,Z) MAXIMUM(MAXIMUM(X,Y),Z)
 #endif
 
-#ifndef MIN
-#define MIN(X,Y) ((X)<(Y)?(X):(Y))
-#endif
 #ifndef MIN3
-#define MIN3(X,Y,Z) MIN(MIN(X,Y),Z)
+#define MIN3(X,Y,Z) MINIMUM(MINIMUM(X,Y),Z)
 #endif
 
 void image_rgb_to_hsv(INT32 args)
@@ -1982,7 +1974,7 @@ void isf_seek(int mode,int ydir,INT32 low_limit,INT32 x1,INT32 x2,INT32 y,
 #endif
 
 #define MARK_DISTANCE(_dest,_value) \
-      ((_dest).r=(_dest).g=(_dest).b=(max(1,255-(_value>>8))))
+      ((_dest).r=(_dest).g=(_dest).b=(MAXIMUM(1,255-(_value>>8))))
    if ( mode&ISF_LEFT ) /* scan left from x1 */
    {
       x=x1;
@@ -2113,7 +2105,7 @@ void image_select_from(INT32 args)
       if (sp[2-args].type!=T_INT)
 	 error("Illegal argument 3 (edge value) to Image.image->select_from()\n");
       else
-	 low_limit=max(0,sp[2-args].u.integer);
+	 low_limit=MAXIMUM(0,sp[2-args].u.integer);
    else
       low_limit=30;
    low_limit=low_limit*low_limit;
diff --git a/src/modules/Image/matrix.c b/src/modules/Image/matrix.c
index bd5f171ee0..ebf63c68f1 100644
--- a/src/modules/Image/matrix.c
+++ b/src/modules/Image/matrix.c
@@ -1,9 +1,9 @@
-/* $Id: matrix.c,v 1.10 1997/10/27 22:41:25 mirar Exp $ */
+/* $Id: matrix.c,v 1.11 1997/12/22 23:26:47 hubbe Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: matrix.c,v 1.10 1997/10/27 22:41:25 mirar Exp $
+**!	$Id: matrix.c,v 1.11 1997/12/22 23:26:47 hubbe Exp $
 **! class image
 */
 
@@ -29,9 +29,6 @@ extern struct program *image_program;
 #define THIS ((struct image *)(fp->current_storage))
 #define THISOBJ (fp->current_object)
 
-#define min(a,b) ((a)<(b)?(a):(b))
-#define max(a,b) ((a)<(b)?(b):(a))
-
 #if 0
 #include <sys/resource.h>
 #define CHRONO(X) chrono(X)
@@ -115,7 +112,7 @@ static INLINE int getrgbl(rgbl_group *rgb,INT32 args_start,INT32 args,char *name
 
 
 #define decimals(x) ((x)-(int)(x))
-#define testrange(x) max(min((x),255),0)
+#define testrange(x) MAXIMUM(MINIMUM((x),255),0)
 #define _scale_add_rgb(dest,src,factor) \
    ((dest)->r+=(src)->r*(factor), \
     (dest)->g+=(src)->g*(factor), \
@@ -208,9 +205,9 @@ CHRONO("transfer begin");
      s=new;
      y=newx*newy;
      while (y--) {
-       d->r=min((int)(s->r+0.5),255);
-       d->g=min((int)(s->g+0.5),255);
-       d->b=min((int)(s->b+0.5),255);
+       d->r=MINIMUM((int)(s->r+0.5),255);
+       d->g=MINIMUM((int)(s->g+0.5),255);
+       d->b=MINIMUM((int)(s->b+0.5),255);
        d++; s++;
      }
 
diff --git a/src/modules/Image/operator.c b/src/modules/Image/operator.c
index 2f59e2eb33..e999d68fde 100644
--- a/src/modules/Image/operator.c
+++ b/src/modules/Image/operator.c
@@ -1,9 +1,9 @@
-/* $Id: operator.c,v 1.9 1997/10/27 22:41:26 mirar Exp $ */
+/* $Id: operator.c,v 1.10 1997/12/22 23:26:48 hubbe Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: operator.c,v 1.9 1997/10/27 22:41:26 mirar Exp $
+**!	$Id: operator.c,v 1.10 1997/12/22 23:26:48 hubbe Exp $
 **! class image
 */
 
@@ -30,8 +30,6 @@ extern struct program *image_program;
 #define THISOBJ (fp->current_object)
 
 #define absdiff(a,b) ((a)<(b)?((b)-(a)):((a)-(b)))
-#define min(a,b) ((a)<(b)?(a):(b))
-#define max(a,b) ((a)<(b)?(b):(a))
 
 #define STANDARD_OPERATOR_HEADER(what) \
    struct object *o;			   			\
@@ -152,17 +150,17 @@ void image_operator_plus(INT32 args)
 STANDARD_OPERATOR_HEADER("`+")
    while (i--)
    {
-      d->r=min(s1->r+s2->r,255);
-      d->g=min(s1->g+s2->g,255);
-      d->b=min(s1->b+s2->b,255);
+      d->r=MINIMUM(s1->r+s2->r,255);
+      d->g=MINIMUM(s1->g+s2->g,255);
+      d->b=MINIMUM(s1->b+s2->b,255);
       s1++; s2++; d++; 
    }
    else
    while (i--)
    {
-      d->r=min(s1->r+rgb.r,255);
-      d->g=min(s1->g+rgb.g,255);
-      d->b=min(s1->b+rgb.b,255);
+      d->r=MINIMUM(s1->r+rgb.r,255);
+      d->g=MINIMUM(s1->g+rgb.g,255);
+      d->b=MINIMUM(s1->b+rgb.b,255);
       s1++; d++;
    }
    THREADS_DISALLOW();
@@ -238,17 +236,17 @@ void image_operator_maximum(INT32 args)
 STANDARD_OPERATOR_HEADER("`| 'maximum'")
    while (i--)
    {
-      d->r=max(s1->r,s2->r);
-      d->g=max(s1->g,s2->g);
-      d->b=max(s1->b,s2->b);
+      d->r=MAXIMUM(s1->r,s2->r);
+      d->g=MAXIMUM(s1->g,s2->g);
+      d->b=MAXIMUM(s1->b,s2->b);
       s1++; s2++; d++; 
    }
    else
    while (i--)
    {
-      d->r=max(s1->r,rgb.r);
-      d->g=max(s1->g,rgb.g);
-      d->b=max(s1->b,rgb.b);
+      d->r=MAXIMUM(s1->r,rgb.r);
+      d->g=MAXIMUM(s1->g,rgb.g);
+      d->b=MAXIMUM(s1->b,rgb.b);
       s1++; s2++; d++; 
    }
    THREADS_DISALLOW();
@@ -278,17 +276,17 @@ void image_operator_minimum(INT32 args)
 STANDARD_OPERATOR_HEADER("`& 'minimum'")
    while (i--)
    {
-      d->r=min(s1->r,s2->r);
-      d->g=min(s1->g,s2->g);
-      d->b=min(s1->b,s2->b);
+      d->r=MINIMUM(s1->r,s2->r);
+      d->g=MINIMUM(s1->g,s2->g);
+      d->b=MINIMUM(s1->b,s2->b);
       s1++; s2++; d++; 
    }
    else
    while (i--)
    {
-      d->r=min(s1->r,rgb.r);
-      d->g=min(s1->g,rgb.g);
-      d->b=min(s1->b,rgb.b);
+      d->r=MINIMUM(s1->r,rgb.r);
+      d->g=MINIMUM(s1->g,rgb.g);
+      d->b=MINIMUM(s1->b,rgb.b);
       s1++; d++; 
    }
    THREADS_DISALLOW();
diff --git a/src/modules/Image/pattern.c b/src/modules/Image/pattern.c
index b23f4b5e3b..8b7ba8f94b 100644
--- a/src/modules/Image/pattern.c
+++ b/src/modules/Image/pattern.c
@@ -1,9 +1,9 @@
-/* $Id: pattern.c,v 1.9 1997/11/02 18:49:11 grubba Exp $ */
+/* $Id: pattern.c,v 1.10 1997/12/22 23:26:49 hubbe Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: pattern.c,v 1.9 1997/11/02 18:49:11 grubba Exp $
+**!	$Id: pattern.c,v 1.10 1997/12/22 23:26:49 hubbe Exp $
 **! class image
 */
 
@@ -28,9 +28,7 @@ extern struct program *image_program;
 #define THIS ((struct image *)(fp->current_storage))
 #define THISOBJ (fp->current_object)
 
-#define min(a,b) ((a)<(b)?(a):(b))
-#define max(a,b) ((a)<(b)?(b):(a))
-#define testrange(x) max(min((x),255),0)
+#define testrange(x) MAXIMUM(MINIMUM((x),255),0)
 
 /**************** noise ************************/
 
diff --git a/src/modules/Image/polyfill.c b/src/modules/Image/polyfill.c
index 8ec9d203f8..9132233839 100644
--- a/src/modules/Image/polyfill.c
+++ b/src/modules/Image/polyfill.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: polyfill.c,v 1.15 1997/11/12 03:40:20 mirar Exp $");
+RCSID("$Id: polyfill.c,v 1.16 1997/12/22 23:26:50 hubbe Exp $");
 
 /* Prototypes are needed for these */
 extern double floor(double);
@@ -29,7 +29,7 @@ extern double floor(double);
 /*
 **! module Image
 **! note
-**!	$Id: polyfill.c,v 1.15 1997/11/12 03:40:20 mirar Exp $
+**!	$Id: polyfill.c,v 1.16 1997/12/22 23:26:50 hubbe Exp $
 **! class image
 */
 
@@ -652,7 +652,7 @@ static void polyfill_some(struct image *img,
    int i;
 
    rgb_group *dest=img->img,rgb=img->rgb;
-   float *buf=alloca(sizeof(float)*(img->xsize+1));
+   float *buf=(float *)alloca(sizeof(float)*(img->xsize+1));
 
 
    if (!buf) error("out of stack, typ\n");
-- 
GitLab