{"thread":{"id":"31964","subject":"[PATCH] builtin/config.c: Fix a sparse warning","startedAt":"2012-10-28T21:05:25Z","lastAt":"2012-10-29T05:47:02Z","messageCount":2,"participants":["Ramsay Jones","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"202065","messageId":"508D9E15.1040105@ramsay1.demon.co.uk","threadId":"31964","inReplyTo":null,"subject":"[PATCH] builtin/config.c: Fix a sparse warning","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-10-28T21:05:25Z","receivedAt":"2012-10-28T21:05:25Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nSparse issues an \"Using plain integer as NULL pointer\" warning while\nchecking a 'struct strbuf_list' initializer expression. The initial\nfield of the struct has pointer type, but the initializer expression\nis given as '{0}'. In order to suppress the warning, we simply replace\nthe initializer with '{NULL}'.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nHi Jeff,\n\nI try to catch these types of warnings while the patches are still\nin the pu branch. I don't know how I missed this one, but I don't\nremember your 'jk/config-ignore-duplicates' branch being in pu.\n\nSorry about that.\n\nATB,\nRamsay Jones\n\n builtin/config.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex f881053..e796af4 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -165,7 +165,7 @@ static int collect_config(const char *key_, const char *value_, void *cb)\n static int get_value(const char *key_, const char *regex_)\n {\n \tint ret = CONFIG_GENERIC_ERROR;\n-\tstruct strbuf_list values = {0};\n+\tstruct strbuf_list values = {NULL};\n \tint i;\n \n \tif (use_key_regexp) {\n-- \n1.8.0\n"},{"id":"202086","messageId":"20121029054702.GD30186@sigill.intra.peff.net","threadId":"31964","inReplyTo":"508D9E15.1040105@ramsay1.demon.co.uk","subject":"Re: [PATCH] builtin/config.c: Fix a sparse warning","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-10-29T05:47:02Z","receivedAt":"2012-10-29T05:47:02Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Oct 28, 2012 at 09:05:25PM +0000, Ramsay Jones wrote:\n\n> Sparse issues an \"Using plain integer as NULL pointer\" warning while\n> checking a 'struct strbuf_list' initializer expression. The initial\n> field of the struct has pointer type, but the initializer expression\n> is given as '{0}'. In order to suppress the warning, we simply replace\n> the initializer with '{NULL}'.\n\nI slightly disagree with sparse here, as the 0 here is not about\nexplicitly setting the pointer, but is an idiomatic shorthand for\nrequesting static-like initialization (and it is purely a style thing,\nnot a bug, as 0 is a fine null pointer, even on platforms without\nall-bits-zero null pointers).\n\nBut I think it is still worth changing in the name of\nsparse-cleanliness. Thanks.\n\n> I try to catch these types of warnings while the patches are still\n> in the pu branch. I don't know how I missed this one, but I don't\n> remember your 'jk/config-ignore-duplicates' branch being in pu.\n> \n> Sorry about that.\n\nNot your fault. The time during which it would have been in pu was after\nJunio left but before I had pushed out my pu. I did have it locally in\npu for a bit, but it ended up on next the first time it was published,\nbecause the series had already received favorable review on the list in\nthe meantime.\n\nBut I forgot that some people may first see the new code via the\npublished pu, not the list (e.g., if they are pulling and building pu\nroutinely with sparse).  I'll try to be better about making sure stuff\nis actually published in pu for a cycle before merging to next.\n\n-Peff\n"}]}