From: wessels <> Date: Tue, 6 Jan 1998 04:18:12 +0000 (+0000) Subject: move min/max macros to squid.h and call them XMIN, XMAX X-Git-Tag: SQUID_3_0_PRE1~4253 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0254ee293e2665fe0c4c702a1ee9c780ee2b0cd9;p=thirdparty%2Fsquid.git move min/max macros to squid.h and call them XMIN, XMAX --- diff --git a/src/access_log.cc b/src/access_log.cc index 6b6f9cc521..0b2e5308dd 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -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; diff --git a/src/comm.cc b/src/comm.cc index 9e32cf14bf..6bb8b74d57 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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 @@ -111,9 +111,6 @@ #include #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; diff --git a/src/squid.h b/src/squid.h index d981fd78a0..8086350c69 100644 --- a/src/squid.h +++ b/src/squid.h @@ -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 */ diff --git a/src/stmem.cc b/src/stmem.cc index 72718e1812..9f6bebc56d 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -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 @@ -106,8 +106,6 @@ #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;