Re: [PATCH 1/4] Improve message-id generation flow control for format-patch

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: Daniel Barkalow <barkalow@...>, <git@...>
Date: Wednesday, February 6, 2008 - 5:13 pm

On Wed, Feb 06, 2008 at 08:31:08PM +0000, Junio C Hamano wrote:
truct patch_ids *ids, const cha

  Why wouldn't you just use strbuf_detach ? I mean replacing:

+	info->message_id =3D buf.buf;

with:

+	info->message_id =3D strbuf_detach(&buf, NULL);

  isn't really hard to read, and has the nice side effect to prevent
errors that could happen in the future (like reusing buf and screwing
with info->message_id without noticing it). I'd rather stand on the safe
side here, it's more forward-compatible and idiot-proof[0].


  [0] Not that I believe git contributors are idiots, but I firmly
      believe in defensive programming when it doesn't impact
      performances. And I don't believe it would here.
--=20
=C2=B7O=C2=B7  Pierre Habouzit
=C2=B7=C2=B7O                                                madcoder@debia=
n.org
OOO                                                http://www.madism.org
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 1/4] Improve message-id generation flow control f..., Pierre Habouzit, (Wed Feb 6, 5:13 pm)