messsage: use git_buf in prettify()

A lot of the tests were checking for overflow, which we don't have
anymore, so we can remove them.
This commit is contained in:
Carlos Martín Nieto
2014-01-27 04:44:06 +01:00
parent ee550477d1
commit e1d7f0035e
4 changed files with 34 additions and 100 deletions
+5 -12
View File
@@ -8,6 +8,7 @@
#define INCLUDE_git_message_h__
#include "common.h"
#include "buffer.h"
/**
* @file git2/message.h
@@ -23,25 +24,17 @@ GIT_BEGIN_DECL
*
* Optionally, can remove lines starting with a "#".
*
* @param out The user-allocated buffer which will be filled with the
* cleaned up message. Pass NULL if you just want to get the needed
* size of the prettified message as the output value.
*
* @param out_size Size of the `out` buffer in bytes.
* @param out The user-allocated git_buf which will be filled with the
* cleaned up message.
*
* @param message The message to be prettified.
*
* @param strip_comments Non-zero to remove lines starting with "#", 0 to
* leave them in.
*
* @return -1 on error, else number of characters in prettified message
* including the trailing NUL byte
* @return 0 or an error code.
*/
GIT_EXTERN(int) git_message_prettify(
char *out,
size_t out_size,
const char *message,
int strip_comments);
GIT_EXTERN(int) git_message_prettify(git_buf *out, const char *message, int strip_comments);
/** @} */
GIT_END_DECL