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

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?

Previous: Jeff KingNext: Jeff King
Message 5 of 9 in “[PATCHv5 0/2] Implement the GIT_TRACE_CURL environment variable”
  1. Elia PintoMay 2, 2016
  2. 1/2 http.c: implement the GIT_TRACE_CURL environment variableElia Pinto, May 2, 2016
  3. Ramsay JonesMay 2, 2016
  4. Jeff KingMay 2, 2016
  5. Junio C HamanoMay 2, 2016
  6. Jeff KingMay 2, 2016
  7. Junio C HamanoMay 2, 2016
  8. 2/2 imap-send.c: introduce the GIT_TRACE_CURL environment variableElia Pinto, May 2, 2016
  9. Jeff KingMay 2, 2016

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.