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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan McGee <dpmcgee@xxxxxxxxx> writes:

> 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 ...

> @@ -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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]