diff options
author | Vicent Marti <vicent@github.com> | 2014-08-18 15:18:59 +0200 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-08-18 15:18:59 +0200 |
commit | d28b2b7a5ff608ce8f3da0e0b6a4c75afcf1e82c (patch) | |
tree | b060de361e87763abd373bc535fcb09778c28e29 /include | |
parent | 43ebca8d7baa420a35ac1a8b23258066a0e5b223 (diff) | |
parent | 4ca0b566ca811550b4db31045e580b4970e5b8e3 (diff) | |
download | libgit2-d28b2b7a5ff608ce8f3da0e0b6a4c75afcf1e82c.tar.gz |
Merge pull request #2528 from libgit2/vmg/tostr_s
Export `git_oid_tostr_s` instead of `_allocfmt`
Diffstat (limited to 'include')
-rw-r--r-- | include/git2/oid.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/git2/oid.h b/include/git2/oid.h index 1cfd4e5e2..db2f3af70 100644 --- a/include/git2/oid.h +++ b/include/git2/oid.h @@ -116,13 +116,17 @@ GIT_EXTERN(void) git_oid_nfmt(char *out, size_t n, const git_oid *id); GIT_EXTERN(void) git_oid_pathfmt(char *out, const git_oid *id); /** - * Format a git_oid into a newly allocated c-string. + * Format a git_oid into a statically allocated c-string. + * + * The c-string is owned by the library and should not be freed + * by the user. If libgit2 is built with thread support, the string + * will be stored in TLS (i.e. one buffer per thread) to allow for + * concurrent calls of the function. * * @param id the oid structure to format - * @return the c-string; NULL if memory is exhausted. Caller must - * deallocate the string with git__free(). + * @return the c-string */ -GIT_EXTERN(char *) git_oid_allocfmt(const git_oid *id); +GIT_EXTERN(char *) git_oid_tostr_s(const git_oid *oid); /** * Format a git_oid into a buffer as a hex format c-string. |