Re: mark parsing in fast-import
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Apr 22, 2008, 23:15 UTC
- Message-ID
- <20080422231515.GJ29771@spearce.org>
- In-Reply-To
- <20080422093942.GA3752@alea.gnuu.de>
Jrg Sommer <joerg@alea.gnuu.de> wrote:
> > Another question: Is :0 a valid mark? In import_marks() is a check for > !mark, but I haven't seen it anywhere else.
No, in fast-import ":0" is _not_ a valid mark. We burn the first entry in the marks table (always leaving it empty) as then we can use the idiom "!mark" to say "no mark was requested/given" and "mark" to say "mark was requested/given". Hence we do not need an extra flag to tell us either way.
Given that a mark is just a pointer, and that extra flag would likely have been a global "static int have_mark" or some such it works out to be about the same amount of memory - 4 or 8 bytes. No big deal, and the code is probably easier to follow as a result.
-- Shawn.