# [PATCH] http.c: Spell the null pointer as NULL

3 messages from 2013-10-15 to 2013-10-15. Participants: Ramsay Jones, Jeff King, Junio C Hamano.
Thread: https://gitlist.dev/t/35145

## Ramsay Jones, 2013-10-15 21:55

Subject: [PATCH] http.c: Spell the null pointer as NULL
Message-ID: <525DB9B6.8040701@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/525DB9B6.8040701%40ramsay1.demon.co.uk

```

Commit 1bbcc224 ("http: refactor options to http_get_*", 28-09-2013)
changed the type of final 'options' argument of the http_get_file()
function from an int to an 'struct http_get_options' pointer.
However, it neglected to update the (single) call site. Since this
call was passing '0' to that argument, it was (correctly) being
interpreted as a null pointer. Change to argument to NULL.

Noticed by sparse. ("Using plain integer as NULL pointer")

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

Hi Jonathan, Junio,

I'm a little puzzled by not having noticed this until this evening! ;-)
Also, I note that maint@kernel.org != maint@repo.or.cz/jrn

ATB,
Ramsay Jones

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

diff --git a/http.c b/http.c
index 96d7578..b133ffd 100644
--- a/http.c
+++ b/http.c
@@ -1045,7 +1045,7 @@ static char *fetch_pack_index(unsigned char *sha1, const char *base_url)
 	strbuf_addf(&buf, "%s.temp", sha1_pack_index_name(sha1));
 	tmp = strbuf_detach(&buf, NULL);
 
-	if (http_get_file(url, tmp, 0) != HTTP_OK) {
+	if (http_get_file(url, tmp, NULL) != HTTP_OK) {
 		error("Unable to get pack index %s", url);
 		free(tmp);
 		tmp = NULL;
-- 
1.8.4

```

## Jeff King, 2013-10-15 22:03

Subject: Re: [PATCH] http.c: Spell the null pointer as NULL
Message-ID: <20131015220326.GA4927@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20131015220326.GA4927%40sigill.intra.peff.net
In-Reply-To: <525DB9B6.8040701@ramsay1.demon.co.uk>

```
On Tue, Oct 15, 2013 at 10:55:02PM +0100, Ramsay Jones wrote:

> Commit 1bbcc224 ("http: refactor options to http_get_*", 28-09-2013)
> changed the type of final 'options' argument of the http_get_file()
> function from an int to an 'struct http_get_options' pointer.
> However, it neglected to update the (single) call site. Since this
> call was passing '0' to that argument, it was (correctly) being
> interpreted as a null pointer. Change to argument to NULL.

Thanks, patch is obviously correct (and the cause was just oversight on
my part).

-Peff

```

## Junio C Hamano, 2013-10-15 23:02

Subject: Re: [PATCH] http.c: Spell the null pointer as NULL
Message-ID: <xmqqzjqa9ly9.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqzjqa9ly9.fsf%40gitster.dls.corp.google.com
In-Reply-To: <525DB9B6.8040701@ramsay1.demon.co.uk>

```
Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Also, I note that maint@kernel.org != maint@repo.or.cz/jrn

Thanks.

```
