git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 1/3] list-objects: add "void *data" parameter to show functions
Date: Wed, 8 Apr 2009 06:39:35 +0200	[thread overview]
Message-ID: <200904080639.35499.chriscool@tuxfamily.org> (raw)
In-Reply-To: <7vk55vubcv.fsf@gitster.siamese.dyndns.org>

Le mercredi 8 avril 2009, Junio C Hamano a écrit :
> Christian Couder <chriscool@tuxfamily.org> writes:
> > The goal of this patch is to get rid of the "static struct rev_info
> > revs" static variable in "builtin-rev-list.c".
>
> Hmm.  If it were a more library-ish file, a removal of such a static
> variable might help you to make more than one calls to a library
> function, but does it matter in files like builtin-rev-list.c?  Its
> cmd_rev_list() is like main() --- it is meant to run once and exit.
>
> So if it is the only goal of this series, I am inclined to say that I do
> not have a reason to look at the rest of the series, but as a side effect
> does this removal make some other API better?  Perhaps a more library-ish
> function is in builtin-rev-list.c and this structure should really needs
> to be passed around as a parameter, but I cannot tell solely by reading
> the goal above, without reading the patches themselves.

In the cover letter, I wrote that the patch series removes restrictions on 
using the "show_bisect_vars" function.

In fact there was a restriction on the use of the BISECT_SHOW_ALL flag 
because that would use the "show_commit" function that was using static 
variables.

The restriction was described in a comment in "bisect.h" and this comment is 
removed by the series. 

This is the relevant hunk in patch 2/3:

diff --git a/bisect.h b/bisect.h
index f5d1067..b1c334d 100644
--- a/bisect.h
+++ b/bisect.h
@@ -14,12 +14,14 @@ extern struct commit_list *filter_skipped(struct 
commit_list *list,
 #define BISECT_SHOW_TRIED      (1<<1)
 #define BISECT_SHOW_STRINGED   (1<<2)
 
-/*
- * The flag BISECT_SHOW_ALL should not be set if this function is called
- * from outside "builtin-rev-list.c" as otherwise it would use
- * static "revs" from this file.
- */
-extern int show_bisect_vars(struct rev_info *revs, int reaches, int all,
+struct rev_list_info {
+       struct rev_info *revs;
+       int show_timestamp;
+       int hdr_termination;
+       const char *header_prefix;
+};
+
+extern int show_bisect_vars(struct rev_list_info *info, int reaches, int 
all,
                            int flags);
 
 extern int bisect_next_vars(const char *prefix);


Best regards,
Christian.

> > Anyway this makes the code more clean and more generic, so it
> > should be a good thing in the long run.
>
> I wouldn't disagree with that "long run" thing, but the answer to the
> above question affects the placement of this series in my prioritized
> queue.

  reply	other threads:[~2009-04-08  4:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090407040819.4338.4291.chriscool@tuxfamily.org>
2009-04-06 19:28 ` [PATCH 1/3] list-objects: add "void *data" parameter to show functions Christian Couder
2009-04-06 20:28   ` [PATCH 2/3] rev-list: remove last static vars used in "show_commit" Christian Couder
2009-04-07  3:08     ` [PATCH 3/3] rev-list: add "int bisect_show_flags" in "struct rev_list_info" Christian Couder
2009-04-08  7:40     ` [PATCH 2/3] rev-list: remove last static vars used in "show_commit" Paolo Bonzini
2009-04-09  3:11       ` Christian Couder
2009-04-08  2:29   ` [PATCH 1/3] list-objects: add "void *data" parameter to show functions Junio C Hamano
2009-04-08  4:39     ` Christian Couder [this message]
2009-04-08  5:10       ` Junio C Hamano

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=200904080639.35499.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 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 NNTP newsgroup(s).