LCOV - code coverage report
Current view: top level - foo/src/jamidht - git_def.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 15 15 100.0 %
Date: 2026-01-22 10:39:23 Functions: 15 15 100.0 %

          Line data    Source code
       1             : /*
       2             :  *  Copyright (C) 2004-2026 Savoir-faire Linux Inc.
       3             :  *
       4             :  *  This program is free software: you can redistribute it and/or modify
       5             :  *  it under the terms of the GNU General Public License as published by
       6             :  *  the Free Software Foundation, either version 3 of the License, or
       7             :  *  (at your option) any later version.
       8             :  *
       9             :  *  This program is distributed in the hope that it will be useful,
      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      12             :  *  GNU General Public License for more details.
      13             :  *
      14             :  *  You should have received a copy of the GNU General Public License
      15             :  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
      16             :  */
      17             : #pragma once
      18             : 
      19             : #include <memory>
      20             : #include <git2.h>
      21             : 
      22             : namespace jami {
      23             : 
      24             : struct GitPackBuilderDeleter
      25             : {
      26        1115 :     inline void operator()(git_packbuilder* p) const { git_packbuilder_free(p); }
      27             : };
      28             : using GitPackBuilder = std::unique_ptr<git_packbuilder, GitPackBuilderDeleter>;
      29             : 
      30             : struct GitRepositoryDeleter
      31             : {
      32       50820 :     inline void operator()(git_repository* p) const { git_repository_free(p); }
      33             : };
      34             : using GitRepository = std::unique_ptr<git_repository, GitRepositoryDeleter>;
      35             : 
      36             : struct GitRevWalkerDeleter
      37             : {
      38       20179 :     inline void operator()(git_revwalk* p) const { git_revwalk_free(p); }
      39             : };
      40             : using GitRevWalker = std::unique_ptr<git_revwalk, GitRevWalkerDeleter>;
      41             : 
      42             : struct GitCommitDeleter
      43             : {
      44       53056 :     inline void operator()(git_commit* p) const { git_commit_free(p); }
      45             : };
      46             : using GitCommit = std::unique_ptr<git_commit, GitCommitDeleter>;
      47             : 
      48             : struct GitAnnotatedCommitDeleter
      49             : {
      50         931 :     inline void operator()(git_annotated_commit* p) const { git_annotated_commit_free(p); }
      51             : };
      52             : using GitAnnotatedCommit = std::unique_ptr<git_annotated_commit, GitAnnotatedCommitDeleter>;
      53             : 
      54             : struct GitIndexDeleter
      55             : {
      56        1453 :     inline void operator()(git_index* p) const { git_index_free(p); }
      57             : };
      58             : using GitIndex = std::unique_ptr<git_index, GitIndexDeleter>;
      59             : 
      60             : struct GitTreeDeleter
      61             : {
      62       11274 :     inline void operator()(git_tree* p) const { git_tree_free(p); }
      63             : };
      64             : using GitTree = std::unique_ptr<git_tree, GitTreeDeleter>;
      65             : 
      66             : struct GitRemoteDeleter
      67             : {
      68        6211 :     inline void operator()(git_remote* p) const { git_remote_free(p); }
      69             : };
      70             : using GitRemote = std::unique_ptr<git_remote, GitRemoteDeleter>;
      71             : 
      72             : struct GitReferenceDeleter
      73             : {
      74         910 :     inline void operator()(git_reference* p) const { git_reference_free(p); }
      75             : };
      76             : using GitReference = std::unique_ptr<git_reference, GitReferenceDeleter>;
      77             : 
      78             : struct GitSignatureDeleter
      79             : {
      80         730 :     inline void operator()(git_signature* p) const { git_signature_free(p); }
      81             : };
      82             : using GitSignature = std::unique_ptr<git_signature, GitSignatureDeleter>;
      83             : 
      84             : struct GitObjectDeleter
      85             : {
      86       12243 :     inline void operator()(git_object* p) const { git_object_free(p); }
      87             : };
      88             : using GitObject = std::unique_ptr<git_object, GitObjectDeleter>;
      89             : 
      90             : struct GitDiffDeleter
      91             : {
      92        2838 :     inline void operator()(git_diff* p) const { git_diff_free(p); }
      93             : };
      94             : using GitDiff = std::unique_ptr<git_diff, GitDiffDeleter>;
      95             : 
      96             : struct GitDiffStatsDeleter
      97             : {
      98        2820 :     inline void operator()(git_diff_stats* p) const { git_diff_stats_free(p); }
      99             : };
     100             : using GitDiffStats = std::unique_ptr<git_diff_stats, GitDiffStatsDeleter>;
     101             : 
     102             : struct GitIndexConflictIteratorDeleter
     103             : {
     104           1 :     inline void operator()(git_index_conflict_iterator* p) const { git_index_conflict_iterator_free(p); }
     105             : };
     106             : using GitIndexConflictIterator = std::unique_ptr<git_index_conflict_iterator, GitIndexConflictIteratorDeleter>;
     107             : 
     108             : struct GitBufDeleter
     109             : {
     110        3854 :     inline void operator()(git_buf* b) const { git_buf_dispose(b); }
     111             : };
     112             : using GitBuf = std::unique_ptr<git_buf, GitBufDeleter>;
     113             : 
     114             : } // namespace jami

Generated by: LCOV version 1.14