# [PATCH] fast-import: fix a sparse 'NULL pointer' warning

2 messages from 2018-03-30 to 2018-03-30. Participants: Ramsay Jones, Junio C Hamano.
Thread: https://gitlist.dev/t/48189

## Ramsay Jones, 2018-03-30 22:22

Subject: [PATCH] fast-import: fix a sparse 'NULL pointer' warning
Message-ID: <fdda3631-400c-1e6d-92b8-a68fc237a413@ramsayjones.plus.com>
URL: https://gitlist.dev/e/fdda3631-400c-1e6d-92b8-a68fc237a413%40ramsayjones.plus.com

```

Commit a8dfa11562 ("fast-import: introduce mem_pool type", 2018-03-26)
introduces a 'mem_pool' type, along with a file-local global symbol
('fi_mem_poll') which is initialised in its declaration. This causes
sparse to issue a warning, thus:

      SP fast-import.c
  fast-import.c:301:40: warning: Using plain integer as NULL pointer

In order to suppress the warning, replace the '0' used to initialise the
'mp_block' field (of type 'struct mp_block *') with NULL.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Junio,

This was going to be an email to Jameson, but I wasn't fast enough! :(

This was originally written against the 'pu' branch, but since the
'jm/mem-pool' branch has graduated to 'next', I have rebased on 'next'.

Perhaps this could be squashed into that branch when you re-build
the 'next' branch at the beginning of the next cycle?

ATB,
Ramsay Jones

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

diff --git a/fast-import.c b/fast-import.c
index 0aa148ea4..38356e293 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -298,7 +298,7 @@ static int global_argc;
 static const char **global_argv;
 
 /* Memory pools */
-static struct mem_pool fi_mem_pool =  {0, 2*1024*1024 - sizeof(struct mp_block), 0 };
+static struct mem_pool fi_mem_pool =  {NULL, 2*1024*1024 - sizeof(struct mp_block), 0 };
 
 /* Atom management */
 static unsigned int atom_table_sz = 4451;
-- 
2.16.0

```

## Junio C Hamano, 2018-03-30 22:26

Subject: Re: [PATCH] fast-import: fix a sparse 'NULL pointer' warning
Message-ID: <xmqqin9d19q6.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqin9d19q6.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <fdda3631-400c-1e6d-92b8-a68fc237a413@ramsayjones.plus.com>

```
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:

> This was going to be an email to Jameson, but I wasn't fast enough! :(
>
> This was originally written against the 'pu' branch, but since the
> 'jm/mem-pool' branch has graduated to 'next', I have rebased on 'next'.
>
> Perhaps this could be squashed into that branch when you re-build
> the 'next' branch at the beginning of the next cycle?

Thanks.  

Yes, that would be the most sensible thing to do, I would think, as
the topic itself (like many other branches that are merged to 'next'
during the pre-release feature freeze period) is not ready for the
'master' branch yet anyway.



```
