mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: make get_sha() return std::string
This was crazy: it returned a local static buffer, i.e. was inherently non-reentrant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2f3d8d83f5
commit
2f4dbf1848
3 changed files with 7 additions and 7 deletions
|
@ -1906,14 +1906,14 @@ static int do_git_load(git_repository *repo, const char *branch, struct git_pars
|
|||
return ret;
|
||||
}
|
||||
|
||||
extern "C" const char *get_sha(git_repository *repo, const char *branch)
|
||||
std::string get_sha(git_repository *repo, const char *branch)
|
||||
{
|
||||
static char git_id_buffer[GIT_OID_HEXSZ + 1];
|
||||
char git_id_buffer[GIT_OID_HEXSZ + 1];
|
||||
git_commit *commit;
|
||||
if (find_commit(repo, branch, &commit))
|
||||
return NULL;
|
||||
return std::string();
|
||||
git_oid_tostr(git_id_buffer, sizeof(git_id_buffer), (const git_oid *)commit);
|
||||
return git_id_buffer;
|
||||
return std::string(git_id_buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue