Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH 1/2] http: make curl callbacks match contracts from curl header

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:58

Possibly related (same subject, not in this thread)

Dan McGee [off-list ref] writes:
quoted hunk
diff --git a/http-walker.c b/http-walker.c
index 9bc8114..c83df1b 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -185,7 +185,7 @@ static void process_alternates_response(void *callback_data)
 	struct active_request_slot *slot = alt_req->slot;
 	struct alt_base *tail = cdata->alt;
 	const char *base = alt_req->base;
-	static const char null_byte = '\0';
+	char null_byte = '\0';
I know you needed this change because later call to fwrite_buffer() uses a
pointer to this one byte, and the fwrite_buffer() takes "char *" not
"const char *", but ...
quoted hunk
@@ -1183,7 +1183,7 @@ static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
 	} while (posn < size);
 
 	freq->stream.avail_in = size;
-	freq->stream.next_in = ptr;
+	freq->stream.next_in = (void *)ptr;
... if you are willing to cast the type away like this anyway, which is
not a bad thing at all, wouldn't it be better to keep the "static const
char nul_byte = '\0'" as it was, and use it like

	fwrite_buffer((char *)&nul_byte, 1, 1, ...);

for consistency?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help