git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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?
Previous: Tay Ray ChuanNext: Dan McGee
Message 4 of 5 in “http: make curl callbacks match contracts from curl header”
  1. 1/2 http: make curl callbacks match contracts from curl headerDan McGee, Mar 31, 2011
  2. 2/2 http-push: refactor curl_easy_setup madnessDan McGee, Mar 31, 2011
  3. Tay Ray ChuanApr 16, 2011
  4. Junio C HamanoApr 4, 2011
  5. http: make curl callbacks match contracts from curl headerDan McGee, Apr 5, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.