Skip to content

Commit 06f6c04

Browse files
committed
Build with libgit2 1.4.0+
1 parent a8025d5 commit 06f6c04

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
77
# Add libgit2
88
find_package(PkgConfig)
99
if(PkgConfig_FOUND)
10-
PKG_CHECK_MODULES(LIBGIT2 libgit2>=0.99)
10+
PKG_CHECK_MODULES(LIBGIT2 libgit2>=1.4.0)
1111
endif()
1212
if(NOT LIBGIT2_FOUND)
1313
ADD_SUBDIRECTORY(ext/libgit2 ${CMAKE_BINARY_DIR}/lib)

ext/libgit2

Submodule libgit2 updated 1860 files

src/data_buffer.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ data_buffer::data_buffer(size_t n) {
1717
c_struct_.ptr = (char *)malloc(n * sizeof(char));
1818
if (c_struct_.ptr)
1919
memset(c_struct_.ptr, '\0', n * sizeof(char));
20-
c_struct_.asize = n;
21-
c_struct_.size = 0;
20+
c_struct_.size = n;
2221
}
2322

2423
data_buffer::data_buffer(const git_buf *c_ptr) {
25-
c_struct_.ptr = (char *)malloc(c_ptr->asize * sizeof(char));
26-
c_struct_.asize = c_ptr->asize;
24+
c_struct_.ptr = (char *)malloc(c_ptr->size * sizeof(char));
2725
c_struct_.size = c_ptr->size;
2826
if (c_struct_.ptr)
29-
strncpy(c_struct_.ptr, c_ptr->ptr, c_ptr->asize);
27+
strncpy(c_struct_.ptr, c_ptr->ptr, c_ptr->size);
3028
}
3129

3230
data_buffer::~data_buffer() {
@@ -37,19 +35,15 @@ data_buffer::~data_buffer() {
3735
data_buffer::data_buffer(data_buffer&& other) {
3836
c_struct_.size = other.c_struct_.size;
3937
c_struct_.ptr = other.c_struct_.ptr;
40-
c_struct_.asize = other.c_struct_.asize;
4138
other.c_struct_.size = 0;
42-
other.c_struct_.asize = 0;
4339
other.c_struct_.ptr = nullptr;
4440
}
4541

4642
data_buffer& data_buffer::operator= (data_buffer&& other) {
4743
if (other.c_struct_.ptr != c_struct_.ptr) {
4844
c_struct_.size = other.c_struct_.size;
4945
c_struct_.ptr = other.c_struct_.ptr;
50-
c_struct_.asize = other.c_struct_.asize;
5146
other.c_struct_.size = 0;
52-
other.c_struct_.asize = 0;
5347
other.c_struct_.ptr = nullptr;
5448
}
5549
return *this;

0 commit comments

Comments
 (0)