Re: [PATCHv5 1/2] http.c: implement the GIT_TRACE_CURL environment variable
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 2, 2016, 18:59 UTC
- Message-ID
- <xmqq60uwthfh.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160502142813.50868-2-gitter.spiros@gmail.com>
Elia Pinto <gitter.spiros@gmail.com> writes:
Show 31 quoted lines
> +static void curl_dump(const char *text, unsigned char *ptr, size_t size, int nopriv)
> +{
> + size_t i;
> + struct strbuf out = STRBUF_INIT;
> + unsigned int width = 80;
> +
> + strbuf_addf(&out, "%s, %10.10ld bytes (0x%8.8lx)\n",
> + text, (long)size, (long)size);
> + trace_strbuf(&trace_curl, &out);
> +
> + for (i = 0; i < size; i += width) {
> + ...
> + for (w = 0; (w < width) && (i + w < size); w++) {
> + if ((i + w + 1 < size) && ptr[i + w] == '\r'
> + && ptr[i + w + 1] == '\n') {
> + i += (w + 2 - width);
> + break;
> + }
> + strbuf_addch(&out, (ptr[i + w] >= 0x20)
> + && (ptr[i + w] < 0x80) ? ptr[i + w] : '.');
> + if ((i + w + 2 < size)
> + && ptr[i + w + 1] == '\r'
> + && ptr[i + w + 2] == '\n') {
> + i += (w + 3 - width);
> + break;
> + }
> + }
> + ...
> + }
> + strbuf_release(&out);
> +}There is no change in this hard-to-read double-loop since the previous round?
Show 5 quoted lines
> +int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp)
> +{
> + const char *text;
> + (void)handle; /* prevent compiler unused parameter warning if checked */
> + (void)userp; /* prevent compiler unused parameter warning if checked */I really do not want to see these casts. Unused parameters are perfectly normal in a codebase with callback functions, no? I do not think these are the first occurrences of unused parameters in our codebase, and I do not think we have such cast to void to them. Why add this ugliness only to here?