Commit Diff


commit - d65a88a2f0db40d2c2ac34ee34e8aff8ac629d52
commit + 77d7d3bb1aabafae6c020c8a07a6e9f4f7885c9b
blob - 0678325a656296d677ef121766f0c17a0ea3c6cf
blob + 8facb7400a9b81b47c7d834b4dc261ff3a2ef4d8
--- include/got_fetch.h
+++ include/got_fetch.h
@@ -16,8 +16,6 @@
 
 #define GOT_FETCH_DEFAULT_REMOTE_NAME	"origin"
 
-#define GOT_FETCH_PKTMAX	65536
-
 /*
  * Attempt to parse a URI into the following parts:
  * A protocol scheme, hostname, port number (as a string), path on server,
blob - a805a93b43a7bd5f89c592a6da5982f41dd96ae6
blob + 225bc42faab244492a77e967c829b9cf47301009
--- include/got_send.h
+++ include/got_send.h
@@ -17,8 +17,6 @@
 
 #define GOT_SEND_DEFAULT_REMOTE_NAME	"origin"
 
-#define GOT_SEND_PKTMAX	65536
-
 /*
  * Attempt to open a connection to a server using the provided protocol
  * scheme, hostname port number (as a string) and server-side path.
blob - 58ebe83cb10ef337c7ed983de51d61cc5f631253
blob + 6392c7ed06f631433155ab4dbd754e9d3ad6f32c
--- lib/fetch.c
+++ lib/fetch.c
@@ -61,6 +61,7 @@
 #include "got_lib_object_cache.h"
 #include "got_lib_repository.h"
 #include "got_lib_dial.h"
+#include "got_lib_pkt.h"
 
 #ifndef nitems
 #define nitems(_a)	(sizeof((_a)) / sizeof((_a)[0]))
@@ -452,7 +453,7 @@ got_fetch_pack(struct got_object_id **pack_hash, struc
 	npackfd = -1;
 
 	packfile_size = 0;
-	progress = calloc(GOT_FETCH_PKTMAX, 1);
+	progress = calloc(GOT_PKT_MAX, 1);
 	if (progress == NULL) {
 		err = got_error_from_errno("calloc");
 		goto done;
@@ -488,7 +489,7 @@ got_fetch_pack(struct got_object_id **pack_hash, struc
 			 * partial lines of progress output to the callback.
 			 */
 			if (strlcat(progress, server_progress,
-			    GOT_FETCH_PKTMAX) >= GOT_FETCH_PKTMAX) {
+			    GOT_PKT_MAX) >= GOT_PKT_MAX) {
 				progress[0] = '\0'; /* discard */
 				continue;
 			}
@@ -509,9 +510,9 @@ got_fetch_pack(struct got_object_id **pack_hash, struc
 				if (err)
 					break;
 				n = strlen(progress);
-				if (n < GOT_FETCH_PKTMAX - 1) {
+				if (n < GOT_PKT_MAX - 1) {
 					memmove(progress, &progress[n + 1],
-					    GOT_FETCH_PKTMAX - n - 1);
+					    GOT_PKT_MAX - n - 1);
 				} else
 					progress[0] = '\0';
 			}
blob - 63ad53665bec47053190034f7eb81cac0421e217
blob + 009561888bba0c0f18ea02211c6639bf87cfb368
--- lib/got_lib_pkt.h
+++ lib/got_lib_pkt.h
@@ -15,6 +15,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#define GOT_PKT_MAX	65536
+
 const struct got_error *got_pkt_readn(ssize_t *off, int fd, void *buf,
     size_t n);
 const struct got_error *got_pkt_flushpkt(int fd, int chattygot);
blob - 42a19bfb5390548d4249bd5c2f9432a6a853b121
blob + 15451b4e3f2c64f4522ab8457cb5e6151ed1e1f4
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
@@ -308,7 +308,7 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
     struct imsgbuf *ibuf)
 {
 	const struct got_error *err = NULL;
-	char buf[GOT_FETCH_PKTMAX];
+	char buf[GOT_PKT_MAX];
 	char hashstr[SHA1_DIGEST_STRING_LENGTH];
 	struct got_object_id *have, *want;
 	int is_firstpkt = 1, nref = 0, refsz = 16;
blob - ac6ef5c2976fe590056d360be5438a4c3f05df4c
blob + 366a7752b050575027ad23ce7530ed0f5655788d
--- libexec/got-send-pack/got-send-pack.c
+++ libexec/got-send-pack/got-send-pack.c
@@ -325,7 +325,7 @@ send_pack(int fd, struct got_pathlist_head *refs,
     struct got_pathlist_head *delete_refs, struct imsgbuf *ibuf)
 {
 	const struct got_error *err = NULL;
-	char buf[GOT_FETCH_PKTMAX];
+	char buf[GOT_PKT_MAX];
 	unsigned char zero_id[SHA1_DIGEST_LENGTH] = { 0 };
 	char old_hashstr[SHA1_DIGEST_STRING_LENGTH];
 	char new_hashstr[SHA1_DIGEST_STRING_LENGTH];