From 742b8213fe1298dd2c7152969d229e5dadd82a23 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 31 Jul 2019 20:25:31 +0100 Subject: Tidier git pointer typedefs --- gentoobrowse-api/service/utils/git.cpp | 2 +- gentoobrowse-api/service/utils/git.h | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gentoobrowse-api/service/utils/git.cpp b/gentoobrowse-api/service/utils/git.cpp index 71856d8..9a1cae2 100644 --- a/gentoobrowse-api/service/utils/git.cpp +++ b/gentoobrowse-api/service/utils/git.cpp @@ -31,7 +31,7 @@ namespace Gentoo { } AdHocFormatter(RefSpec, "refs/heads/%?:refs/remotes/%?/%?"); - std::unique_ptr + GitAnnotatedCommitPtr gitFetch(git_repository * repo, git_remote * remote, const char * remoteBranchName) { auto opts = gitSafeGet(git_fetch_init_options, GIT_FETCH_OPTIONS_VERSION); diff --git a/gentoobrowse-api/service/utils/git.h b/gentoobrowse-api/service/utils/git.h index 59f06f0..20e8755 100644 --- a/gentoobrowse-api/service/utils/git.h +++ b/gentoobrowse-api/service/utils/git.h @@ -19,13 +19,16 @@ namespace Gentoo { } } + template + using GitTPtr = std::unique_ptr; + template - std::unique_ptr + GitTPtr gitSafeGet(int(*get)(R**, P...), void(*release)(R*), A ... p) { R * r = nullptr; gitSafe(get, &r, p...); - return std::unique_ptr(r, release); + return GitTPtr(r, release); } template @@ -39,7 +42,8 @@ namespace Gentoo { std::string operator*(const git_oid &); - std::unique_ptr + using GitAnnotatedCommitPtr = GitTPtr; + GitAnnotatedCommitPtr gitFetch(git_repository * repo, git_remote * remote, const char * branch); git_oid -- cgit v1.2.3