Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
a99f33e9
Commit
a99f33e9
authored
Oct 01, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3447 from arthurschreiber/arthur/fix-odb-refdb-free
refdb and odb backends must provide `free` function
parents
ba1a5553
d3b29fb9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
10 deletions
+10
-10
include/git2/sys/odb_backend.h
+4
-0
include/git2/sys/refdb_backend.h
+2
-2
src/odb.c
+1
-2
src/refdb.c
+2
-6
tests/odb/sorting.c
+1
-0
No files found.
include/git2/sys/odb_backend.h
View file @
a99f33e9
...
...
@@ -83,6 +83,10 @@ struct git_odb_backend {
git_odb_writepack
**
,
git_odb_backend
*
,
git_odb
*
odb
,
git_transfer_progress_cb
progress_cb
,
void
*
progress_payload
);
/**
* Frees any resources held by the odb (including the `git_odb_backend`
* itself). An odb backend implementation must provide this function.
*/
void
(
*
free
)(
git_odb_backend
*
);
};
...
...
include/git2/sys/refdb_backend.h
View file @
a99f33e9
...
...
@@ -130,8 +130,8 @@ struct git_refdb_backend {
int
(
*
ensure_log
)(
git_refdb_backend
*
backend
,
const
char
*
refname
);
/**
* Frees any resources held by the refdb
. A refdb implementation may
*
provide this function; if it is not provided, nothing will be done
.
* Frees any resources held by the refdb
(including the `git_refdb_backend`
*
itself). A refdb backend implementation must provide this function
.
*/
void
(
*
free
)(
git_refdb_backend
*
backend
);
...
...
src/odb.c
View file @
a99f33e9
...
...
@@ -600,8 +600,7 @@ static void odb_free(git_odb *db)
backend_internal
*
internal
=
git_vector_get
(
&
db
->
backends
,
i
);
git_odb_backend
*
backend
=
internal
->
backend
;
if
(
backend
->
free
)
backend
->
free
(
backend
);
else
git__free
(
backend
);
backend
->
free
(
backend
);
git__free
(
internal
);
}
...
...
src/refdb.c
View file @
a99f33e9
...
...
@@ -61,12 +61,8 @@ int git_refdb_open(git_refdb **out, git_repository *repo)
static
void
refdb_free_backend
(
git_refdb
*
db
)
{
if
(
db
->
backend
)
{
if
(
db
->
backend
->
free
)
db
->
backend
->
free
(
db
->
backend
);
else
git__free
(
db
->
backend
);
}
if
(
db
->
backend
)
db
->
backend
->
free
(
db
->
backend
);
}
int
git_refdb_set_backend
(
git_refdb
*
db
,
git_refdb_backend
*
backend
)
...
...
tests/odb/sorting.c
View file @
a99f33e9
...
...
@@ -14,6 +14,7 @@ static git_odb_backend *new_backend(size_t position)
if
(
b
==
NULL
)
return
NULL
;
b
->
base
.
free
=
(
void
(
*
)(
git_odb_backend
*
))
git__free
;
b
->
base
.
version
=
GIT_ODB_BACKEND_VERSION
;
b
->
position
=
position
;
return
(
git_odb_backend
*
)
b
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment