@@ -17,16 +17,14 @@ data_buffer::data_buffer(size_t n) {
17
17
c_struct_.ptr = (char *)malloc (n * sizeof (char ));
18
18
if (c_struct_.ptr )
19
19
memset (c_struct_.ptr , ' \0 ' , n * sizeof (char ));
20
- c_struct_.asize = n;
21
- c_struct_.size = 0 ;
20
+ c_struct_.size = n;
22
21
}
23
22
24
23
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 ));
27
25
c_struct_.size = c_ptr->size ;
28
26
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 );
30
28
}
31
29
32
30
data_buffer::~data_buffer () {
@@ -37,19 +35,15 @@ data_buffer::~data_buffer() {
37
35
data_buffer::data_buffer (data_buffer&& other) {
38
36
c_struct_.size = other.c_struct_ .size ;
39
37
c_struct_.ptr = other.c_struct_ .ptr ;
40
- c_struct_.asize = other.c_struct_ .asize ;
41
38
other.c_struct_ .size = 0 ;
42
- other.c_struct_ .asize = 0 ;
43
39
other.c_struct_ .ptr = nullptr ;
44
40
}
45
41
46
42
data_buffer& data_buffer::operator = (data_buffer&& other) {
47
43
if (other.c_struct_ .ptr != c_struct_.ptr ) {
48
44
c_struct_.size = other.c_struct_ .size ;
49
45
c_struct_.ptr = other.c_struct_ .ptr ;
50
- c_struct_.asize = other.c_struct_ .asize ;
51
46
other.c_struct_ .size = 0 ;
52
- other.c_struct_ .asize = 0 ;
53
47
other.c_struct_ .ptr = nullptr ;
54
48
}
55
49
return *this ;
0 commit comments