Re: [PATCH 1/2] http: make curl callbacks match contracts from curl header
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 4, 2011, 23:34 UTC
- Message-ID
- <7v8vvp7fr0.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1301535531-1244-1-git-send-email-dpmcgee@gmail.com>
Dan McGee <dpmcgee@gmail.com> writes:
Show 10 quoted lines
> 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 ...
Show 6 quoted lines
> @@ -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?