]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
move min/max macros to squid.h and call them XMIN, XMAX
authorwessels <>
Tue, 6 Jan 1998 04:18:12 +0000 (04:18 +0000)
committerwessels <>
Tue, 6 Jan 1998 04:18:12 +0000 (04:18 +0000)
src/access_log.cc
src/comm.cc
src/squid.h
src/stmem.cc

index 6b6f9cc521675973bcae1d70c9307d65822230c1..0b2e5308ddf54612889159799903959f148293d2 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: access_log.cc,v 1.15 1998/01/02 02:06:01 wessels Exp $
+ * $Id: access_log.cc,v 1.16 1998/01/05 21:18:12 wessels Exp $
  *
  * DEBUG: section 46    Access Log
  * AUTHOR: Duane Wessels
@@ -58,7 +58,6 @@ const char *log_tags[] =
 };
 
 #define MAX_LINELEN (4096)
-#define max(a,b)  ((a)>(b)? (a): (b))
 
 static int LogfileStatus = LOG_DISABLE;
 static int LogfileFD = -1;
index 9e32cf14bf05a6dd126fdf258b9aa825021d93cd..6bb8b74d57e6b0fe97d95cba1f0602f761c049ac 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.219 1998/01/05 00:45:45 wessels Exp $
+ * $Id: comm.cc,v 1.220 1998/01/05 21:18:13 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
 #include <netinet/tcp.h>
 #endif
 
-#define min(x,y) ((x)<(y)? (x) : (y))
-#define max(a,b) ((a)>(b)? (a) : (b))
-
 typedef struct {
     char *host;
     u_short port;
@@ -1230,7 +1227,7 @@ comm_init(void)
     /* Keep a few file descriptors free so that we don't run out of FD's
      * after accepting a client but before it opens a socket or a file.
      * Since Squid_MaxFD can be as high as several thousand, don't waste them */
-    RESERVED_FD = min(100, Squid_MaxFD / 4);
+    RESERVED_FD = XMIN(100, Squid_MaxFD / 4);
     /* hardwired lifetimes */
     meta_data.misc += Squid_MaxFD * sizeof(int);
     zero_tv.tv_sec = 0;
index d981fd78a0e829dc98691d566d6ecd40b08763ba..8086350c69372132fc5056e3a16fd46390214c76 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.149 1998/01/02 19:27:01 wessels Exp $
+ * $Id: squid.h,v 1.150 1998/01/05 21:18:14 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -329,4 +329,7 @@ struct rusage {
 #include "snprintf.h"
 #endif
 
+#define XMIN(x,y) ((x)<(y)? (x) : (y))
+#define XMAX(a,b) ((a)>(b)? (a) : (b))
+
 #endif /* SQUID_H */
index 72718e1812f94192b415ca04302d6a2e68d5d772..9f6bebc56dfb6228e7006176f6201b1993ecd4f4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stmem.cc,v 1.53 1997/11/12 23:47:41 wessels Exp $
+ * $Id: stmem.cc,v 1.54 1998/01/05 21:18:15 wessels Exp $
  *
  * DEBUG: section 19    Memory Primitives
  * AUTHOR: Harvest Derived
 
 #include "squid.h"
 
-#define min(x,y) ((x)<(y)? (x) : (y))
-
 #ifndef USE_MEMALIGN
 #define USE_MEMALIGN 0
 #endif
@@ -187,7 +185,7 @@ memAppend(mem_hdr * mem, const char *data, int len)
      * allocation loop */
     if (mem->head && mem->tail && (mem->tail->len < SM_PAGE_SIZE)) {
        avail_len = SM_PAGE_SIZE - (mem->tail->len);
-       len_to_copy = min(avail_len, len);
+       len_to_copy = XMIN(avail_len, len);
        xmemcpy((mem->tail->data + mem->tail->len), data, len_to_copy);
        /* Adjust the ptr and len according to what was deposited in the page */
        data += len_to_copy;
@@ -195,7 +193,7 @@ memAppend(mem_hdr * mem, const char *data, int len)
        mem->tail->len += len_to_copy;
     }
     while (len > 0) {
-       len_to_copy = min(len, SM_PAGE_SIZE);
+       len_to_copy = XMIN(len, SM_PAGE_SIZE);
        p = xcalloc(1, sizeof(mem_node));
        p->next = NULL;
        p->len = len_to_copy;
@@ -237,7 +235,7 @@ memCopy(const mem_hdr * mem, off_t offset, char *buf, size_t size)
     /* Start copying begining with this block until
      * we're satiated */
     bytes_into_this_packet = offset - t_off;
-    bytes_from_this_packet = min(bytes_to_go, p->len - bytes_into_this_packet);
+    bytes_from_this_packet = XMIN(bytes_to_go, p->len - bytes_into_this_packet);
     xmemcpy(buf, p->data + bytes_into_this_packet, bytes_from_this_packet);
     bytes_to_go -= bytes_from_this_packet;
     ptr_to_buf = buf + bytes_from_this_packet;