git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	GIT Mailing-list <git@vger.kernel.org>
Subject: [PATCH] upload-pack: fix sparse warnings
Date: Tue, 12 Mar 2019 01:53:57 +0000	[thread overview]
Message-ID: <5f0c12d5-6714-1516-3579-33d839ad7b7e@ramsayjones.plus.com> (raw)


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

Hi Jonathan,

If you need to re-roll your 'jt/fetch-cdn-offload' branch, could
you please squash this into the relevant patches. (The first hunk
into commit a8d662e3da4 ("upload-pack: refactor reading of pack-objects
out", 2019-03-08) and the second hunk into commit 820a5361db1
("upload-pack: send part of packfile response as uri", 2019,-03-08)).

[Johannes mentioned 'clang' complaining - I have clang v5.0.1 and
it does not issue any warnings for the new initialization.]

This patch fixes the following sparse warnings:

  $ diff psp-out psp-out1
  190,191d189
  < upload-pack.c:182:45: warning: missing braces around initializer
  < upload-pack.c:1167:56: warning: Using plain integer as NULL pointer
  $ 

If you don't like the new initializer expression, maybe don't
initialize in the declaration and use a traditional:

   memset(&output_state, 0, sizeof(struct output_state));

instead?

Thanks!

ATB,
Ramsay Jones


 upload-pack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/upload-pack.c b/upload-pack.c
index d36e1fc06a..52309d40ae 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -179,7 +179,7 @@ static void create_pack_file(const struct object_array *have_obj,
 			     const struct string_list *uri_protocols)
 {
 	struct child_process pack_objects = CHILD_PROCESS_INIT;
-	struct output_state output_state = {0};
+	struct output_state output_state = { { 0 }, 0, 0, 0 };
 	char progress[128];
 	char abort_msg[] = "aborting due to possible repository "
 		"corruption on the remote side.";
@@ -1164,7 +1164,7 @@ void upload_pack(struct upload_pack_options *options)
 	if (want_obj.nr) {
 		struct object_array have_obj = OBJECT_ARRAY_INIT;
 		get_common_commits(&reader, &have_obj, &want_obj);
-		create_pack_file(&have_obj, &want_obj, 0);
+		create_pack_file(&have_obj, &want_obj, NULL);
 	}
 }
 
-- 
2.21.0

                 reply	other threads:[~2019-03-12  1:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f0c12d5-6714-1516-3579-33d839ad7b7e@ramsayjones.plus.com \
    --to=ramsay@ramsayjones.plus.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jonathantanmy@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).