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

Re: [Resend PATCH 2/4] Use strbuf in http code

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 11, 2007, 06:04 UTC
Message-ID
<7vlk81him3.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1197228659-19459-1-git-send-email-mh@glandium.org>
Mike Hommey <mh@glandium.org> writes:
Show 14 quoted lines
> Also, replace whitespaces with tabs in some places
>
> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---
>
>  While this doesn't fix the problem with symbolic refs, it does fail more
>  cleanly.
>
>  http-push.c   |  187 +++++++++++++++++++--------------------------------------
>  http-walker.c |   60 +++++++------------
>  http.c        |   34 ++++------
>  http.h        |   11 ++--
>  transport.c   |   18 ++----
>  5 files changed, 109 insertions(+), 201 deletions(-)
I like this code reduction, but
Show 23 quoted lines
> diff --git a/http.h b/http.h
> index fe1b0d1..bf3f12c 100644
> --- a/http.h
> +++ b/http.h
> @@ -6,6 +6,8 @@
>  #include <curl/curl.h>
>  #include <curl/easy.h>
>  
> +#include "strbuf.h"
> +
>  #if LIBCURL_VERSION_NUM >= 0x071000
>  #define USE_CURL_MULTI
>  #define DEFAULT_MAX_REQUESTS 5
> @@ -48,18 +50,17 @@ struct active_request_slot
>  
>  struct buffer
>  {
> -        size_t posn;
> -        size_t size;
> -        void *buffer;
> +	struct strbuf buf;
> +	size_t posn;
>  };
With this definition of "struct buffer", I do not think this can be correct.
Show 9 quoted lines
> @@ -1267,10 +1257,8 @@ static struct remote_lock *lock_remote(const char *path, long timeout)
>  {
>  	struct active_request_slot *slot;
>  	struct slot_results results;
> -	struct buffer out_buffer;
> -	struct buffer in_buffer;
> -	char *out_data;
> -	char *in_data;
> +	struct buffer out_buffer = { 0, STRBUF_INIT };

How seriously have you proofread and tested this series before sending it out?

Previous: Mike HommeyNext: Mike Hommey
Message 11 of 23 in “Cleanup variables in http.[ch]”
  1. 1/4 Cleanup variables in http.[ch]Mike Hommey, Dec 9, 2007
  2. 2/4 Use strbuf in http codeMike Hommey, Dec 9, 2007
  3. 3/4 Move the file read logic to read_patch_file() in builtin-apply.cMike Hommey, Dec 9, 2007
  4. 4/4 Add support for URLs to git-applyMike Hommey, Dec 9, 2007
  5. 4/4 Add support for URLs to git-applyMike Hommey, Dec 10, 2007
  6. Junio C HamanoDec 9, 2007
  7. Junio C HamanoDec 9, 2007
  8. Mike HommeyDec 9, 2007
  9. Junio C HamanoDec 9, 2007
  10. 2/4 Use strbuf in http codeMike Hommey, Dec 9, 2007
  11. Junio C HamanoDec 11, 2007
  12. Mike HommeyDec 11, 2007
  13. 2/4 Use strbuf in http codeMike Hommey, Dec 11, 2007
  14. git-send-email.perl: Really add angle brackets to In-Reply-To if necessaryMike Hommey, Dec 9, 2007
  15. Mike HommeyDec 9, 2007
  16. Junio C HamanoDec 9, 2007
  17. Mike HommeyDec 9, 2007
  18. David KastrupDec 9, 2007
  19. Randal L. SchwartzDec 9, 2007
  20. David KastrupDec 9, 2007
  21. Randal L. SchwartzDec 9, 2007
  22. git-send-email.perl: Really add angle brackets to In-Reply-To if necessaryMike Hommey, Dec 9, 2007
  23. Junio C HamanoDec 9, 2007

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.