threads / patch / 48189

patchfast-import: fix a sparse 'NULL pointer' warning

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

## tl;dr

2 messages between Mar 30, 2018 and Mar 30, 2018. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Ramsay Jones· Mar 30, 2018, 22:22 UTC · lore

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(-)
Show changes to fast-import.c +1 −1
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· Mar 30, 2018, 22:26 UTC · re: Ramsay Jones · lore

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

Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
Show 7 quoted lines
> 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.

← back to recent threads