trailer: avoid unnecessary splitting on lines
commit022349c3b091f2aa047f1cd12b5409d564b25324
authorJonathan Tan <jonathantanmy@google.com>
Wed, 2 Nov 2016 17:29:18 +0000 (2 10:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Nov 2016 22:22:18 +0000 (29 14:22 -0800)
tree8cfbb0786d7ef38795ed0a8360e4dfe3ee7bee9a
parent710714aaa822acbad14f1b7100fa2776d2bc8ce6
trailer: avoid unnecessary splitting on lines

trailer.c currently splits lines while processing a buffer (and also
rejoins lines when needing to invoke ignore_non_trailer).

Avoid such line splitting, except when generating the strings
corresponding to trailers (for ease of use by clients - a subsequent
patch will allow other components to obtain the layout of a trailer
block in a buffer, including the trailers themselves). The main purpose
of this is to make it easy to return pointers into the original buffer
(for a subsequent patch), but this also significantly reduces the number
of memory allocations required.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
trailer.c