git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remote-curl.c: Fix a compiler warning
@ 2012-11-21 19:08 Ramsay Jones
  2012-11-21 19:34 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Ramsay Jones @ 2012-11-21 19:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, GIT Mailing-list

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] remote-curl.c: Fix a compiler warning
  2012-11-21 19:08 [PATCH] remote-curl.c: Fix a compiler warning Ramsay Jones
@ 2012-11-21 19:34 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2012-11-21 19:34 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-21 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-21 19:08 [PATCH] remote-curl.c: Fix a compiler warning Ramsay Jones
2012-11-21 19:34 ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).