# [PATCH] remote-curl.c: Fix a compiler warning

2 messages from 2012-11-21 to 2012-11-21. Participants: Ramsay Jones, Jeff King.
Thread: https://gitlist.dev/t/32158

## Ramsay Jones, 2012-11-21 19:08

Subject: [PATCH] remote-curl.c: Fix a compiler warning
Message-ID: <50AD26C3.2090407@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/50AD26C3.2090407%40ramsay1.demon.co.uk

```
In particular, gcc issues an "'gzip_size' might be used uninitialized"
warning (-Wuninitialized). However, this warning is a false positive,
since the 'gzip_size' variable would not, in fact, be used uninitialized.
In order to suppress the warning, we simply initialise the variable to
zero in it's declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Hi Junio,

This is on top of next. (commit df126e108: "remote-curl: hoist gzip
buffer size to top of post_rpc", 31-10-2012).

Thanks!

ATB,
Ramsay Jones

 remote-curl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/remote-curl.c b/remote-curl.c
index d8b3600..9a8b123 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -400,7 +400,7 @@ static int post_rpc(struct rpc_state *rpc)
 	struct curl_slist *headers = NULL;
 	int use_gzip = rpc->gzip_request;
 	char *gzip_body = NULL;
-	size_t gzip_size;
+	size_t gzip_size = 0;
 	int err, large_request = 0;
 
 	/* Try to load the entire request, if we can fit it into the
-- 
1.8.0

```

## Jeff King, 2012-11-21 19:34

Subject: Re: [PATCH] remote-curl.c: Fix a compiler warning
Message-ID: <20121121193453.GD16280@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20121121193453.GD16280%40sigill.intra.peff.net
In-Reply-To: <50AD26C3.2090407@ramsay1.demon.co.uk>

```
On Wed, Nov 21, 2012 at 07:08:51PM +0000, Ramsay Jones wrote:

> In particular, gcc issues an "'gzip_size' might be used uninitialized"
> warning (-Wuninitialized). However, this warning is a false positive,
> since the 'gzip_size' variable would not, in fact, be used uninitialized.
> In order to suppress the warning, we simply initialise the variable to
> zero in it's declaration.
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
> 
> Hi Junio,
> 
> This is on top of next. (commit df126e108: "remote-curl: hoist gzip
> buffer size to top of post_rpc", 31-10-2012).

Thanks. I meant to apply this during my tenure as maintainer, but it
slipped through the cracks.

-Peff

```
