Commit 4a6621fdf7b26aec5abeeb0c91cc3f57489518ab

Philip Kelley 2012-11-29T08:35:21

Leverage the min macro from util.h

diff --git a/src/transports/http.c b/src/transports/http.c
index 4ef99e3..02f7492 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -30,7 +30,6 @@ static const char *basic_authtype = "Basic";
 #define PARSE_ERROR_REPLAY	-2
 
 #define CHUNK_SIZE	4096
-#define MIN(a, b)	(((a) < (b)) ? (a) : (b))
 
 enum last_cb {
 	NONE,
@@ -542,7 +541,7 @@ static int http_stream_write_chunked(
 	}
 	else {
 		/* Append as much to the buffer as we can */
-		int count = MIN(CHUNK_SIZE - s->chunk_buffer_len, len);
+		int count = min(CHUNK_SIZE - s->chunk_buffer_len, len);
 
 		if (!s->chunk_buffer)
 			s->chunk_buffer = git__malloc(CHUNK_SIZE);
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index dab25f9..fe4b802 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -30,8 +30,6 @@
 #define CACHED_POST_BODY_BUF_SIZE	4096
 #define UUID_LENGTH_CCH	32
 
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-
 static const char *prefix_http = "http://";
 static const char *prefix_https = "https://";
 static const char *upload_pack_service = "upload-pack";
@@ -395,7 +393,7 @@ replay:
 				DWORD bytes_written;
 
 				if (!ReadFile(s->post_body, buffer,
-					MIN(CACHED_POST_BODY_BUF_SIZE, len),
+					min(CACHED_POST_BODY_BUF_SIZE, len),
 					&bytes_read, NULL) ||
 					!bytes_read) {
 					git__free(buffer);
@@ -699,7 +697,7 @@ static int winhttp_stream_write_chunked(
 	}
 	else {
 		/* Append as much to the buffer as we can */
-		int count = MIN(CACHED_POST_BODY_BUF_SIZE - s->chunk_buffer_len, len);
+		int count = min(CACHED_POST_BODY_BUF_SIZE - s->chunk_buffer_len, len);
 
 		if (!s->chunk_buffer)
 			s->chunk_buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);