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

From: Junio C Hamano <[email-masked]>
Date: Mon, 10 Dec 2007 22:04:52 -0800

Mike Hommey <[email-masked]> writes:

> Also, replace whitespaces with tabs in some places
>
> Signed-off-by: Mike Hommey <[email-masked]>
> ---
>
>  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

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

> @@ -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?