{"thread":{"id":"50713","subject":"[PATCH] upload-pack: fix sparse warnings","startedAt":"2019-03-12T01:54:02Z","lastAt":"2019-03-12T01:54:02Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"371210","messageId":"5f0c12d5-6714-1516-3579-33d839ad7b7e@ramsayjones.plus.com","threadId":"50713","inReplyTo":null,"subject":"[PATCH] upload-pack: fix sparse warnings","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2019-03-12T01:53:57Z","receivedAt":"2019-03-12T01:54:02Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n\nHi Jonathan,\n\nIf you need to re-roll your 'jt/fetch-cdn-offload' branch, could\nyou please squash this into the relevant patches. (The first hunk\ninto commit a8d662e3da4 (\"upload-pack: refactor reading of pack-objects\nout\", 2019-03-08) and the second hunk into commit 820a5361db1\n(\"upload-pack: send part of packfile response as uri\", 2019,-03-08)).\n\n[Johannes mentioned 'clang' complaining - I have clang v5.0.1 and\nit does not issue any warnings for the new initialization.]\n\nThis patch fixes the following sparse warnings:\n\n  $ diff psp-out psp-out1\n  190,191d189\n  < upload-pack.c:182:45: warning: missing braces around initializer\n  < upload-pack.c:1167:56: warning: Using plain integer as NULL pointer\n  $ \n\nIf you don't like the new initializer expression, maybe don't\ninitialize in the declaration and use a traditional:\n\n   memset(&output_state, 0, sizeof(struct output_state));\n\ninstead?\n\nThanks!\n\nATB,\nRamsay Jones\n\n\n upload-pack.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/upload-pack.c b/upload-pack.c\nindex d36e1fc06a..52309d40ae 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -179,7 +179,7 @@ static void create_pack_file(const struct object_array *have_obj,\n \t\t\t     const struct string_list *uri_protocols)\n {\n \tstruct child_process pack_objects = CHILD_PROCESS_INIT;\n-\tstruct output_state output_state = {0};\n+\tstruct output_state output_state = { { 0 }, 0, 0, 0 };\n \tchar progress[128];\n \tchar abort_msg[] = \"aborting due to possible repository \"\n \t\t\"corruption on the remote side.\";\n@@ -1164,7 +1164,7 @@ void upload_pack(struct upload_pack_options *options)\n \tif (want_obj.nr) {\n \t\tstruct object_array have_obj = OBJECT_ARRAY_INIT;\n \t\tget_common_commits(&reader, &have_obj, &want_obj);\n-\t\tcreate_pack_file(&have_obj, &want_obj, 0);\n+\t\tcreate_pack_file(&have_obj, &want_obj, NULL);\n \t}\n }\n \n-- \n2.21.0\n"}]}