mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-30 22:24:56 +00:00
Leverage the min macro from util.h
This commit is contained in:
parent
6762fe087b
commit
4a6621fdf7
@ -30,7 +30,6 @@ static const char *basic_authtype = "Basic";
|
|||||||
#define PARSE_ERROR_REPLAY -2
|
#define PARSE_ERROR_REPLAY -2
|
||||||
|
|
||||||
#define CHUNK_SIZE 4096
|
#define CHUNK_SIZE 4096
|
||||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
|
||||||
|
|
||||||
enum last_cb {
|
enum last_cb {
|
||||||
NONE,
|
NONE,
|
||||||
@ -542,7 +541,7 @@ static int http_stream_write_chunked(
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Append as much to the buffer as we can */
|
/* 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)
|
if (!s->chunk_buffer)
|
||||||
s->chunk_buffer = git__malloc(CHUNK_SIZE);
|
s->chunk_buffer = git__malloc(CHUNK_SIZE);
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
#define CACHED_POST_BODY_BUF_SIZE 4096
|
#define CACHED_POST_BODY_BUF_SIZE 4096
|
||||||
#define UUID_LENGTH_CCH 32
|
#define UUID_LENGTH_CCH 32
|
||||||
|
|
||||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
|
||||||
|
|
||||||
static const char *prefix_http = "http://";
|
static const char *prefix_http = "http://";
|
||||||
static const char *prefix_https = "https://";
|
static const char *prefix_https = "https://";
|
||||||
static const char *upload_pack_service = "upload-pack";
|
static const char *upload_pack_service = "upload-pack";
|
||||||
@ -395,7 +393,7 @@ replay:
|
|||||||
DWORD bytes_written;
|
DWORD bytes_written;
|
||||||
|
|
||||||
if (!ReadFile(s->post_body, buffer,
|
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, NULL) ||
|
||||||
!bytes_read) {
|
!bytes_read) {
|
||||||
git__free(buffer);
|
git__free(buffer);
|
||||||
@ -699,7 +697,7 @@ static int winhttp_stream_write_chunked(
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Append as much to the buffer as we can */
|
/* 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)
|
if (!s->chunk_buffer)
|
||||||
s->chunk_buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);
|
s->chunk_buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user