diff options
Diffstat (limited to 'include/git2/message.h')
-rw-r--r-- | include/git2/message.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/include/git2/message.h b/include/git2/message.h index a74dcc2d9..661fecbb5 100644 --- a/include/git2/message.h +++ b/include/git2/message.h @@ -38,7 +38,18 @@ GIT_BEGIN_DECL */ GIT_EXTERN(int) git_message_prettify(git_buf *out, const char *message, int strip_comments, char comment_char); -typedef int(*git_message_trailer_cb)(const char *key, const char *value, void *payload); +typedef struct { + const char *key; + const char *value; +} git_message_trailer; + +typedef struct { + git_message_trailer *trailers; + size_t count; + + /* private */ + char *trailer_block; +} git_message_trailer_array; /** * Parse trailers out of a message, calling a callback once for each trailer. @@ -48,15 +59,14 @@ typedef int(*git_message_trailer_cb)(const char *key, const char *value, void *p * Trailers are key/value pairs in the last paragraph of a message, not * including any patches or conflicts that may be present. * + * @param arr A pre-allocated git_message_trailer_array struct to be filled in + * with any trailers found during parsing. * @param message The message to be parsed - * @param cb The callback to call for each trailer found in the message. The - * key and value arguments are pointers to NUL-terminated C strings. These - * pointers are only guaranteed to be valid until the callback returns. - * User code must make a copy of this data should it need to be retained - * @param payload Pointer to callback data (optional) * @return 0 on success, or non-zero callback return value. */ -GIT_EXTERN(int) git_message_trailers(const char *message, git_message_trailer_cb cb, void *payload); +GIT_EXTERN(int) git_message_trailers(git_message_trailer_array *arr, const char *message); + +GIT_EXTERN(void) git_message_trailer_array_free(git_message_trailer_array *arr); /** @} */ GIT_END_DECL |