Re: [PATCH 2/3] fast-import: tree allocation cleanups
- From
Jeff King <peff@peff.net>
- Date
- Mar 11, 2007, 15:51 UTC
- Message-ID
- <20070311155138.GA7110@coredump.intra.peff.net>
- In-Reply-To
- <20070311032147.GA10781@spearce.org>
On Sat, Mar 10, 2007 at 10:21:47PM -0500, Shawn O. Pearce wrote:
Show 7 quoted lines
> > + > > + t->entries[t->entry_count++] = e; > This I wouldn't have bothered to do in this patch. It is just > unecessary code churning, as you turn around and change this again > in the next patch. I actually dropped these two hunks from this > patch (but left the dang commit message comment in, whoops) and > moved the first hunk to the next patch.
OK. There are actually two changes: moving the insertion until after e->name is set up (which has no functionality impact) and changing the manner of insertion. I split them up to try to make them more readable, but clearly you figured out what I was going for.
Show 5 quoted lines
> > + name = to_atom(p, n); > [...] > > - e->name = to_atom(p, (unsigned short)n); > > You missed an unsigned short cast here.
Actually, I removed it intentionally (though clearly I should have documented it). It's casting from an unsigned int to an unsigned short. Such a cast is at best pointless (since the compiler performs the exact same cast implicitly -- see C99 6.5.2.2, paragraph 7), and at worst masks an error (e.g., if the type of n is changed).
Is there some subtle issue I'm missing here?
-Peff