Re: [RFC 16/17] object_array_entry: copy name before storing in name field

2013-05-20 Thread Johan Herland
On Sun, May 19, 2013 at 10:27 PM, Michael Haggerty mhag...@alum.mit.edu wrote: This is the culmination of the last few commits. Since some callers want to store refnames in the name field of object_array elements, but we don't want those callers to assume that the refnames that they got from

Re: [RFC 16/17] object_array_entry: copy name before storing in name field

2013-05-20 Thread Michael Haggerty
On 05/20/2013 12:33 PM, Johan Herland wrote: On Sun, May 19, 2013 at 10:27 PM, Michael Haggerty mhag...@alum.mit.edu wrote: This is the culmination of the last few commits. Since some callers want to store refnames in the name field of object_array elements, but we don't want those callers

Re: [RFC 16/17] object_array_entry: copy name before storing in name field

2013-05-20 Thread Jeff King
On Mon, May 20, 2013 at 04:42:38PM +0200, Michael Haggerty wrote: * Many callers store the empty string () as the name; for example, most of the entries created during a run of rev-list have as their name. This means that lots of needless copies of are being made. I think that

Re: [RFC 16/17] object_array_entry: copy name before storing in name field

2013-05-20 Thread Michael Haggerty
On 05/20/2013 06:44 PM, Jeff King wrote: On Mon, May 20, 2013 at 04:42:38PM +0200, Michael Haggerty wrote: * Many callers store the empty string () as the name; for example, most of the entries created during a run of rev-list have as their name. This means that lots of needless copies

[RFC 16/17] object_array_entry: copy name before storing in name field

2013-05-19 Thread Michael Haggerty
Change object_array and object_array_entry to copy the name before storing it in the name field, and free it when an entry is deleted from the array. This is useful because some of the name strings passed to add_object_array() or add_object_array_with_mode() are refnames whose lifetime is not