From: Junio C Hamano <gitster@pobox.com>
To: mkoegler@auto.tuwien.ac.at (Martin Koegler)
Cc: "Shawn O. Pearce" <spearce@spearce.org>, git@vger.kernel.org
Subject: Re: [PATCH 1/4] add generic, type aware object chain walker
Date: Mon, 25 Feb 2008 00:02:15 -0800 [thread overview]
Message-ID: <7vmyppmpko.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080225075242.GD15761@auto.tuwien.ac.at> (Martin Koegler's message of "Mon, 25 Feb 2008 08:52:42 +0100")
mkoegler@auto.tuwien.ac.at (Martin Koegler) writes:
> What about
> #define OBJ_BAD -2
You mean "#define OBJ_ANY -2"?
>> After all, if the walker callback was told with
>> OBJ_ANY that any type of object is Ok, it should still say
>> "oops" if the given object said it actually is of type OBJ_BAD.
>> E.g. in your [2/4] patch:
>>
>> +static int mark_object(struct object *obj, int type, void *data)
>> +{
>> + ...
>> + if (type != OBJ_ANY && obj->type != type) {
>> + objerror(parent, "wrong object type in link");
>> + }
>>
>> if you use the above #define, a tagged object that has a bad
>> type will pass this check unnoticed, won't it?
>
> No, it wouldn't, as object->type is never initialized to OBJ_BAD:
> $ grep "OBJ_BAD" *.c *.h
> cache.h: OBJ_BAD = -1,
Don't you think that is too subtle? Don't you want to future
proof your code?
Using the OBJ_ANY (which I'd agree is a good name) that is
different from anything else that is already defined would be a
good idea for that, I would think.
next prev parent reply other threads:[~2008-02-25 8:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-24 14:43 [PATCH 1/4] add generic, type aware object chain walker Martin Koegler
2008-02-24 14:43 ` [PATCH 2/4] builtin-fsck: move away from object-refs Martin Koegler
2008-02-24 14:43 ` [PATCH 3/4] Remove unused object-ref code Martin Koegler
2008-02-24 14:43 ` [PATCH 4/4] builtin-fsck: reports missing parent commits Martin Koegler
2008-02-25 3:04 ` [PATCH 1/4] add generic, type aware object chain walker Shawn O. Pearce
2008-02-25 7:26 ` Martin Koegler
2008-02-25 7:37 ` Junio C Hamano
2008-02-25 7:52 ` Martin Koegler
2008-02-25 8:02 ` Junio C Hamano [this message]
2008-02-25 8:06 ` Martin Koegler
2008-02-25 8:12 ` Shawn O. Pearce
2008-02-25 17:35 ` Nicolas Pitre
2008-02-25 8:04 ` Shawn O. Pearce
2008-02-25 17:49 ` Nicolas Pitre
2008-02-25 3:08 ` Junio C Hamano
2008-02-25 7:46 ` Martin Koegler
2008-02-25 7:59 ` Junio C Hamano
2008-02-25 8:21 ` Martin Koegler
2008-02-25 8:10 ` Shawn O. Pearce
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=7vmyppmpko.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mkoegler@auto.tuwien.ac.at \
--cc=spearce@spearce.org \
/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).