git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org
Cc: Brandon Williams <bmwill@google.com>, jrnieder@gmail.com
Subject: [PATCH v3 1/5] push: unmark a local variable as static
Date: Wed,  5 Apr 2017 10:47:15 -0700	[thread overview]
Message-ID: <20170405174719.1297-2-bmwill@google.com> (raw)
In-Reply-To: <20170405174719.1297-1-bmwill@google.com>

There isn't any obvious reason for the 'struct string_list push_options'
and 'struct string_list_item *item' to be marked as static, so unmark
them as being static.  Also, clear the push_options string_list to
prevent memory leaking.

Signed-off-by: Brandon Williams <bmwill@google.com>
---
 builtin/push.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/builtin/push.c b/builtin/push.c
index 5c22e9f2e..a597759d8 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -510,8 +510,8 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 	int push_cert = -1;
 	int rc;
 	const char *repo = NULL;	/* default repository */
-	static struct string_list push_options = STRING_LIST_INIT_DUP;
-	static struct string_list_item *item;
+	struct string_list push_options = STRING_LIST_INIT_DUP;
+	const struct string_list_item *item;
 
 	struct option options[] = {
 		OPT__VERBOSITY(&verbosity),
@@ -584,6 +584,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 			die(_("push options must not have new line characters"));
 
 	rc = do_push(repo, flags, &push_options);
+	string_list_clear(&push_options, 0);
 	if (rc == -1)
 		usage_with_options(push_usage, options);
 	else
-- 
2.12.2.715.g7642488e1d-goog


  reply	other threads:[~2017-04-05 17:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 23:11 [PATCH] push: propagate push-options with --recurse-submodules Brandon Williams
2017-03-31 23:20 ` Jonathan Nieder
2017-03-31 23:26   ` Brandon Williams
2017-03-31 23:56 ` [PATCH v2 0/2] propagate push-options Brandon Williams
2017-03-31 23:56   ` [PATCH v2 1/2] push: unmark a local variable as static Brandon Williams
2017-04-01  0:11     ` Jonathan Nieder
2017-04-01  0:16       ` Brandon Williams
2017-03-31 23:56   ` [PATCH v2 2/2] push: propagate push-options with --recurse-submodules Brandon Williams
2017-04-01  0:19     ` Jonathan Nieder
2017-04-06  0:17       ` Jacob Keller
2017-04-06 17:39         ` Brandon Williams
2017-04-05 17:47   ` [PATCH v3 0/5] propagating push-options, remote and refspec Brandon Williams
2017-04-05 17:47     ` Brandon Williams [this message]
2017-04-05 17:47     ` [PATCH v3 2/5] push: propagate push-options with --recurse-submodules Brandon Williams
2017-04-05 17:47     ` [PATCH v3 3/5] remote: expose parse_push_refspec function Brandon Williams
2017-04-05 17:47     ` [PATCH v3 4/5] submodule--helper: add push-check subcommand Brandon Williams
2017-04-05 17:47     ` [PATCH v3 5/5] push: propagate remote and refspec with --recurse-submodules Brandon Williams
2017-04-11  7:44     ` [PATCH v3 0/5] propagating push-options, remote and refspec Junio C Hamano
2017-04-11 16:33       ` Brandon Williams

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=20170405174719.1297-2-bmwill@google.com \
    --to=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.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).