diff options
author | Russell Belfer <rb@github.com> | 2012-08-14 10:50:58 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-08-14 10:50:58 -0700 |
commit | 85a0e28b80e42a52247e16478b5f75475b00e56b (patch) | |
tree | 0eaf28379baa12661bb6a2d66a07bc1d67cf2589 /include/git2/message.h | |
parent | fdc637c4e266349b35ac4fb45a4e5aa63c5a78e0 (diff) | |
download | libgit2-85a0e28b80e42a52247e16478b5f75475b00e56b.tar.gz |
Make git_message_prettify return bytes written
If you want to be absolutely safe with git_message_prettify, you
can now pass a NULL pointer for the buffer and get back the number
of bytes that would be copied into the buffer.
This means that an error is a non-negative return code and a
success will be greater than zero from this function.
Diffstat (limited to 'include/git2/message.h')
-rw-r--r-- | include/git2/message.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/git2/message.h b/include/git2/message.h index 7f2558583..b42cb7677 100644 --- a/include/git2/message.h +++ b/include/git2/message.h @@ -23,8 +23,9 @@ GIT_BEGIN_DECL * * Optionally, can remove lines starting with a "#". * - * @param message_out The user allocated buffer which will be filled with - * the cleaned up message. + * @param message_out The user allocated buffer which will be filled with + * the cleaned up message. Pass NULL if you just want to get the size of the + * prettified message as the output value. * * @param size The size of the allocated buffer message_out. * @@ -32,7 +33,8 @@ GIT_BEGIN_DECL * * @param strip_comments 1 to remove lines starting with a "#", 0 otherwise. * - * @return GIT_SUCCESS or an error code + * @return -1 on error, else number of characters in prettified message + * including the trailing NUL byte */ GIT_EXTERN(int) git_message_prettify(char *message_out, size_t buffer_size, const char *message, int strip_comments); |