All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: GIT Mailing-list <git@vger.kernel.org>, rappazzo@gmail.com
Subject: Re: [PATCH] worktree: don't use C99 feature
Date: Wed, 23 Sep 2015 08:01:25 -0700	[thread overview]
Message-ID: <xmqq1tdpyybe.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <56027FDC.1070905@ramsayjones.plus.com> (Ramsay Jones's message of "Wed, 23 Sep 2015 11:33:00 +0100")

Ramsay Jones <ramsay@ramsayjones.plus.com> writes:

> Commits 9c0b9f6 ("worktree: add 'list' command", 18-09-2015) and
> 40ca3d3 ("worktree: add functions to get worktree details", 18-08-2015)
> both introduce the use of a C99 feature (declare the loop control
> variable in the loop header initializer section).
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Junio,
>
> The pu branch doesn't build for me. Do you have -std=c99 set somewhere?
>
> Could you please squash the relevant parts of this patch (or something
> like it) into the two commits mentioned above.
>
> Thanks!

Oh, this is embarrassing, as I do recall noticing this during the
review (in my MUA before running "git am") but somehow it slipped my
mind.

Thanks for catching.



> ATB,
> Ramsay Jones
>
>  builtin/worktree.c | 6 +++---
>  worktree.c         | 7 +++++--
>  2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/builtin/worktree.c b/builtin/worktree.c
> index e6e36ac..b318c39 100644
> --- a/builtin/worktree.c
> +++ b/builtin/worktree.c
> @@ -415,16 +415,16 @@ static int list(int ac, const char **av, const char *prefix)
>          usage_with_options(worktree_usage, options);
>      else {
>          struct worktree **worktrees = get_worktrees();
> -        int path_maxlen = 0;
> +        int i, path_maxlen = 0;
>  
>          if (!porcelain) {
> -            for (int i = 0; worktrees[i]; i++) {
> +            for (i = 0; worktrees[i]; i++) {
>                  int len = strlen(worktrees[i]->path);
>                  if (len > path_maxlen)
>                      path_maxlen = len;
>              }
>          }
> -        for (int i = 0; worktrees[i]; i++) {
> +        for (i = 0; worktrees[i]; i++) {
>              if (porcelain)
>                  show_worktree_porcelain(worktrees[i]);
>              else
> diff --git a/worktree.c b/worktree.c
> index 41c229e..d17b5b6 100644
> --- a/worktree.c
> +++ b/worktree.c
> @@ -5,7 +5,9 @@
>  
>  void free_worktrees(struct worktree **worktrees)
>  {
> -    for (int i = 0; worktrees[i]; i++) {
> +    int i;
> +
> +    for (i = 0; worktrees[i]; i++) {
>          free(worktrees[i]->path);
>          free(worktrees[i]->git_dir);
>          free(worktrees[i]->head_ref);
> @@ -207,8 +209,9 @@ char *find_shared_symref(const char *symref, const char *target)
>      struct strbuf sb = STRBUF_INIT;
>      struct worktree **worktrees = get_worktrees();
>      int symref_is_head = !strcmp("HEAD", symref);
> +    int i;
>  
> -    for (int i = 0; worktrees[i]; i++) {
> +    for (i = 0; worktrees[i]; i++) {
>          if (!symref_is_head) {
>              strbuf_reset(&path);
>              strbuf_reset(&sb);

      reply	other threads:[~2015-09-23 15:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 10:33 [PATCH] worktree: don't use C99 feature Ramsay Jones
2015-09-23 15:01 ` Junio C Hamano [this message]

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

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

  git send-email \
    --in-reply-to=xmqq1tdpyybe.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=ramsay@ramsayjones.plus.com \
    --cc=rappazzo@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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.