Windows: Use roken's min and max
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 3 Dec 2011 11:20:57 +0000 (11:20 +0000)
committerDerrick Brashear <shadow@dementix.org>
Sat, 3 Dec 2011 14:17:39 +0000 (06:17 -0800)
roken provides min() and max() macros. Use these, rather than our own
MIN() and MAX()

Change-Id: I82456c061cb274490e2ef2966a7075c2bde1f016
Reviewed-on: http://gerrit.openafs.org/6196
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/WINNT/afsd/cm_dcache.c
src/WINNT/afsd/cm_dns.c
src/WINNT/afsd/cm_vnodeops.c

index 9a7e82a..0fdee23 100644 (file)
@@ -1950,7 +1950,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *userp
 
                     osi_assertx(bufferp != NULL, "null cm_buf_t");
 
-                    len = MIN(tiov[iov].iov_len - iov_offset, cm_data.buf_blockSize - buffer_offset);
+                    len = min(tiov[iov].iov_len - iov_offset, cm_data.buf_blockSize - buffer_offset);
                     memcpy(bufferp + buffer_offset, tiov[iov].iov_base + iov_offset, len);
                     iov_offset += len;
                     buffer_offset += len;
@@ -2396,7 +2396,7 @@ long cm_GetData(cm_scache_t *scp, osi_hyper_t *offsetp, char *datap, int data_le
 
                     osi_assertx(bufferp != NULL, "null cm_buf_t");
 
-                    len = MIN(tiov[iov].iov_len - iov_offset, data_length - buffer_offset);
+                    len = min(tiov[iov].iov_len - iov_offset, data_length - buffer_offset);
                     memcpy(bufferp + buffer_offset, tiov[iov].iov_base + iov_offset, len);
                     iov_offset += len;
                     buffer_offset += len;
index ed0bf48..e03c8a6 100644 (file)
@@ -509,7 +509,7 @@ void processReplyBuffer_AFSDB(SOCKET commSock, PDNS_HDR replyBuff, int *cellHost
 
   /* ptr should now be at the start of the answer RR sections */
 
-  answerCount = MIN(answerCount, AFSMAXCELLHOSTS);
+  answerCount = min(answerCount, AFSMAXCELLHOSTS);
 #ifdef DEBUG
   fprintf(stderr, "processRep_AFSDB: answerCount=%d\n", answerCount);
 #endif /* DEBUG */
index 20ee837..df867bb 100644 (file)
@@ -4268,8 +4268,8 @@ static void cm_LockRangeSubtract(cm_range_t * pos, const cm_range_t * neg)
     afs_int64 int_begin;
     afs_int64 int_end;
 
-    int_begin = MAX(pos->offset, neg->offset);
-    int_end = MIN(pos->offset+pos->length, neg->offset+neg->length);
+    int_begin = max(pos->offset, neg->offset);
+    int_end = min(pos->offset+pos->length, neg->offset+neg->length);
 
     if (int_begin < int_end) {
         if (int_begin == pos->offset) {