Re: sha1_to_hex() usage cleanup
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 4, 2006, 00:36 UTC
- Message-ID
- <7v1wvabp7a.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.64.0605031717190.4086@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
Show 13 quoted lines
> Somebody on the #git channel complained that the sha1_to_hex() thing uses > a static buffer which caused an error message to show the same hex output > twice instead of showing two different ones. > > That's pretty easily rectified by making it uses a simple LRU of a few > buffers, which also allows some other users (that were aware of the buffer > re-use) to be written in a more straightforward manner. > > Signed-off-by: Linus Torvalds <torvalds@osdl.org> > --- > > This is another throw-away patch of mine. Not a big deal, but since I > tried it, I might as well try to submit it and see if Junio agrees..
Makes sort of sense in that the callers still need to be aware of the magic 4 limit but as long as they are they do not have to worry about allocation/deallocation/copying. But is that kind of cheat maintainable? I dunno.