Commit bdeb8772 by Carlos Martín Nieto

signature: add a dup function which takes a pool

This will be used by the transaction code.
parent 20363d58
......@@ -106,6 +106,30 @@ int git_signature_dup(git_signature **dest, const git_signature *source)
return 0;
}
int git_signature__pdup(git_signature **dest, const git_signature *source, git_pool *pool)
{
git_signature *signature;
if (source == NULL)
return 0;
signature = git_pool_mallocz(pool, sizeof(git_signature));
GITERR_CHECK_ALLOC(signature);
signature->name = git_pool_strdup(pool, source->name);
GITERR_CHECK_ALLOC(signature->name);
signature->email = git_pool_strdup(pool, source->email);
GITERR_CHECK_ALLOC(signature->email);
signature->when.time = source->when.time;
signature->when.offset = source->when.offset;
*dest = signature;
return 0;
}
int git_signature_now(git_signature **sig_out, const char *name, const char *email)
{
time_t now;
......
......@@ -15,4 +15,6 @@
int git_signature__parse(git_signature *sig, const char **buffer_out, const char *buffer_end, const char *header, char ender);
void git_signature__writebuf(git_buf *buf, const char *header, const git_signature *sig);
int git_signature__pdup(git_signature **dest, const git_signature *source, git_pool *pool);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment