author | Jeff King <peff@peff.net> | |
Wed, 7 Sep 2011 17:44:07 +0000 (13:44 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 8 Sep 2011 20:51:32 +0000 (13:51 -0700) | ||
commit | 7ec0f31eec66b854a2ca856538723dea5f1c0ab7 | |
tree | aaa4893130fb1cbaf264add1eb51450f0aaf7334 | tree | snapshot |
parent | 7140c22c8e98042053d5ff63c8514f5cdf1cb6ed | commit | diff |
for-each-ref: refactor subject and body placeholder parsing
The find_subpos function was a little hard to use, as well
as to read. It would sometimes write into the subject and
body pointers, and sometimes not. The body pointer sometimes
could be compared to subject, and sometimes not. When
actually duplicating the subject, the caller was forced to
figure out again how long the subject is (which is not too
big a deal when the subject is a single line, but hard to
extend).
The refactoring makes the function more straightforward, both
to read and to use. We will always put something into the
subject and body pointers, and we return explicit lengths
for them, too.
This lays the groundwork both for more complex subject
parsing (e.g., multiline), as well as splitting the body
into subparts (like the text versus the signature).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The find_subpos function was a little hard to use, as well
as to read. It would sometimes write into the subject and
body pointers, and sometimes not. The body pointer sometimes
could be compared to subject, and sometimes not. When
actually duplicating the subject, the caller was forced to
figure out again how long the subject is (which is not too
big a deal when the subject is a single line, but hard to
extend).
The refactoring makes the function more straightforward, both
to read and to use. We will always put something into the
subject and body pointers, and we return explicit lengths
for them, too.
This lays the groundwork both for more complex subject
parsing (e.g., multiline), as well as splitting the body
into subparts (like the text versus the signature).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/for-each-ref.c | diff | blob | history |