Leverage the min macro from util.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
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);