git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin/blame.c: Fix a "Using plain integer as NULL pointer" warning
@ 2012-05-13 21:41 Ramsay Jones
  2012-05-13 23:39 ` René Scharfe
  0 siblings, 1 reply; 3+ messages in thread
From: Ramsay Jones @ 2012-05-13 21:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: rene.scharfe, GIT Mailing-list



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

Hi Junio,

I try to catch these warnings, while the topics are still in the
pu branch, so that we can squash the fix into them before they
hit next. I don't know how I missed this one (commit 4b4132f,
"blame: factor out helper for calling xdi_diff()", 09-05-2012)
which was part of the 'rs/xdiff-lose-emit-func' branch.

Sorry about that.

ATB,
Ramsay Jones


 builtin/blame.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index 778d661..24d3dd5 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -93,7 +93,7 @@ static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
 {
 	xpparam_t xpp = {0};
 	xdemitconf_t xecfg = {0};
-	xdemitcb_t ecb = {0};
+	xdemitcb_t ecb = {NULL};
 
 	xpp.flags = xdl_opts;
 	xecfg.ctxlen = ctxlen;
-- 
1.7.10

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

* Re: [PATCH] builtin/blame.c: Fix a "Using plain integer as NULL pointer" warning
  2012-05-13 21:41 [PATCH] builtin/blame.c: Fix a "Using plain integer as NULL pointer" warning Ramsay Jones
@ 2012-05-13 23:39 ` René Scharfe
  2012-05-15 17:33   ` Ramsay Jones
  0 siblings, 1 reply; 3+ messages in thread
From: René Scharfe @ 2012-05-13 23:39 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

Am 13.05.2012 23:41, schrieb Ramsay Jones:
>
>
> Signed-off-by: Ramsay Jones<ramsay@ramsay1.demon.co.uk>
> ---
>
> Hi Junio,
>
> I try to catch these warnings, while the topics are still in the
> pu branch, so that we can squash the fix into them before they
> hit next. I don't know how I missed this one (commit 4b4132f,
> "blame: factor out helper for calling xdi_diff()", 09-05-2012)
> which was part of the 'rs/xdiff-lose-emit-func' branch.
>
> Sorry about that.
>
> ATB,
> Ramsay Jones
>
>
>   builtin/blame.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/blame.c b/builtin/blame.c
> index 778d661..24d3dd5 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -93,7 +93,7 @@ static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
>   {
>   	xpparam_t xpp = {0};
>   	xdemitconf_t xecfg = {0};
> -	xdemitcb_t ecb = {0};
> +	xdemitcb_t ecb = {NULL};
>
>   	xpp.flags = xdl_opts;
>   	xecfg.ctxlen = ctxlen;

The warning is given by sparse, not a C compiler, correct?  It's 
probably worth shutting it up by making that change; my excuse for using 
{0} is that it is such a nice and portable idiom [1] for initializing 
any structure, however.

René


[1] http://www.ex-parrot.com/~chris/random/initialise.html

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

* Re: [PATCH] builtin/blame.c: Fix a "Using plain integer as NULL pointer" warning
  2012-05-13 23:39 ` René Scharfe
@ 2012-05-15 17:33   ` Ramsay Jones
  0 siblings, 0 replies; 3+ messages in thread
From: Ramsay Jones @ 2012-05-15 17:33 UTC (permalink / raw)
  To: René Scharfe; +Cc: Junio C Hamano, GIT Mailing-list

René Scharfe wrote:
> Am 13.05.2012 23:41, schrieb Ramsay Jones:
>>
>> Signed-off-by: Ramsay Jones<ramsay@ramsay1.demon.co.uk>
>> ---
>>
>> Hi Junio,
>>
>> I try to catch these warnings, while the topics are still in the
>> pu branch, so that we can squash the fix into them before they
>> hit next. I don't know how I missed this one (commit 4b4132f,
>> "blame: factor out helper for calling xdi_diff()", 09-05-2012)
>> which was part of the 'rs/xdiff-lose-emit-func' branch.
>>
>> Sorry about that.
>>
>> ATB,
>> Ramsay Jones
>>
>>
>>   builtin/blame.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/builtin/blame.c b/builtin/blame.c
>> index 778d661..24d3dd5 100644
>> --- a/builtin/blame.c
>> +++ b/builtin/blame.c
>> @@ -93,7 +93,7 @@ static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
>>   {
>>   	xpparam_t xpp = {0};
>>   	xdemitconf_t xecfg = {0};
>> -	xdemitcb_t ecb = {0};
>> +	xdemitcb_t ecb = {NULL};
>>
>>   	xpp.flags = xdl_opts;
>>   	xecfg.ctxlen = ctxlen;
> 
> The warning is given by sparse, not a C compiler, correct?  It's 
> probably worth shutting it up by making that change; my excuse for using 
> {0} is that it is such a nice and portable idiom [1] for initializing 
> any structure, however.

Yes, sorry, it is indeed a sparse warning. (The original
subject line mentioned sparse, but it was too long ... ;-)

Thanks!

ATB,
Ramsay Jones

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

end of thread, other threads:[~2012-05-15 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-13 21:41 [PATCH] builtin/blame.c: Fix a "Using plain integer as NULL pointer" warning Ramsay Jones
2012-05-13 23:39 ` René Scharfe
2012-05-15 17:33   ` Ramsay Jones

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