mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn saved_git_id into a std::string
Simplifies memory management. Think about unglobalizing this, once everything is in C++ so that we can put an std::string into struct divelog. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
45cb0c09fc
commit
bf05dec52b
4 changed files with 15 additions and 14 deletions
|
@ -266,20 +266,18 @@ static int parse_file_buffer(const char *filename, struct memblock *mem, struct
|
|||
|
||||
extern "C" bool remote_repo_uptodate(const char *filename, struct git_info *info)
|
||||
{
|
||||
char *current_sha = copy_string(saved_git_id);
|
||||
std::string current_sha = saved_git_id;
|
||||
|
||||
if (is_git_repository(filename, info) && open_git_repository(info)) {
|
||||
const char *sha = get_sha(info->repo, info->branch);
|
||||
if (!empty_string(sha) && same_string(sha, current_sha)) {
|
||||
if (!sha.empty() && current_sha == sha) {
|
||||
fprintf(stderr, "already have loaded SHA %s - don't load again\n", sha);
|
||||
free(current_sha);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Either the repository couldn't be opened, or the SHA couldn't
|
||||
// be found.
|
||||
free(current_sha);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue