git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] http.c: Spell the null pointer as NULL
@ 2013-10-15 21:55 Ramsay Jones
  2013-10-15 22:03 ` Jeff King
  2013-10-15 23:02 ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Ramsay Jones @ 2013-10-15 21:55 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Junio C Hamano, Jeff King, GIT Mailing-list


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

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

* Re: [PATCH] http.c: Spell the null pointer as NULL
  2013-10-15 21:55 Ramsay Jones
@ 2013-10-15 22:03 ` Jeff King
  2013-10-15 23:02 ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff King @ 2013-10-15 22:03 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Jonathan Nieder, Junio C Hamano, GIT Mailing-list

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

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

* Re: [PATCH] http.c: Spell the null pointer as NULL
  2013-10-15 21:55 Ramsay Jones
  2013-10-15 22:03 ` Jeff King
@ 2013-10-15 23:02 ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-10-15 23:02 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Jonathan Nieder, Jeff King, GIT Mailing-list

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

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

Thanks.

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

* [PATCH] http.c: Spell the null pointer as NULL
@ 2013-10-24 20:17 Ramsay Jones
  2013-10-24 20:58 ` Jonathan Nieder
  2013-10-24 21:42 ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Ramsay Jones @ 2013-10-24 20:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, GIT Mailing-list


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 Junio,

This is a repost of:

  http://article.gmane.org/gmane.comp.version-control.git/236201

I suspect that this simply fell through the cracks ... (if not,
please let me know ;-)

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

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

* Re: [PATCH] http.c: Spell the null pointer as NULL
  2013-10-24 20:17 [PATCH] http.c: Spell the null pointer as NULL Ramsay Jones
@ 2013-10-24 20:58 ` Jonathan Nieder
  2013-10-24 21:42 ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Nieder @ 2013-10-24 20:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ramsay Jones, Jeff King, GIT Mailing-list

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.

Jeff King wrote:

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

For what it's worth, against the jk/http-auth-redirects branch,

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

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

* Re: [PATCH] http.c: Spell the null pointer as NULL
  2013-10-24 20:17 [PATCH] http.c: Spell the null pointer as NULL Ramsay Jones
  2013-10-24 20:58 ` Jonathan Nieder
@ 2013-10-24 21:42 ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-10-24 21:42 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Jeff King, GIT Mailing-list

Thanks.

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

end of thread, other threads:[~2013-10-24 21:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-24 20:17 [PATCH] http.c: Spell the null pointer as NULL Ramsay Jones
2013-10-24 20:58 ` Jonathan Nieder
2013-10-24 21:42 ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2013-10-15 21:55 Ramsay Jones
2013-10-15 22:03 ` Jeff King
2013-10-15 23:02 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).