mirror of
https://git.proxmox.com/git/libgit2
synced 2025-07-23 19:30:28 +00:00
Added an oid function that accepts nul-terminated strings
This commit is contained in:
parent
7dbf4039ae
commit
0c8efb38f9
@ -46,6 +46,16 @@ typedef struct git_oid {
|
|||||||
*/
|
*/
|
||||||
GIT_EXTERN(int) git_oid_fromstr(git_oid *out, const char *str);
|
GIT_EXTERN(int) git_oid_fromstr(git_oid *out, const char *str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse a hex formatted null-terminated string into a git_oid.
|
||||||
|
*
|
||||||
|
* @param out oid structure the result is written into.
|
||||||
|
* @param str input hex string; must be at least 4 characters
|
||||||
|
* long and null-terminated.
|
||||||
|
* @return 0 or an error code
|
||||||
|
*/
|
||||||
|
GIT_EXTERN(int) git_oid_fromstrp(git_oid *out, const char *str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse N characters of a hex formatted object id into a git_oid
|
* Parse N characters of a hex formatted object id into a git_oid
|
||||||
*
|
*
|
||||||
|
@ -51,6 +51,11 @@ int git_oid_fromstrn(git_oid *out, const char *str, size_t length)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int git_oid_fromstrp(git_oid *out, const char *str)
|
||||||
|
{
|
||||||
|
return git_oid_fromstrn(out, str, min(strlen(str), GIT_OID_HEXSZ));
|
||||||
|
}
|
||||||
|
|
||||||
int git_oid_fromstr(git_oid *out, const char *str)
|
int git_oid_fromstr(git_oid *out, const char *str)
|
||||||
{
|
{
|
||||||
return git_oid_fromstrn(out, str, GIT_OID_HEXSZ);
|
return git_oid_fromstrn(out, str, GIT_OID_HEXSZ);
|
||||||
|
Loading…
Reference in New Issue
Block a user