File tree Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 19
19
*/
20
20
#include "git-compat-util.h"
21
21
#include "ewok.h"
22
+ #include "strbuf.h"
22
23
23
24
int ewah_serialize_native (struct ewah_bitmap * self , int fd )
24
25
{
@@ -110,6 +111,18 @@ int ewah_serialize(struct ewah_bitmap *self, int fd)
110
111
return ewah_serialize_to (self , write_helper , (void * )(intptr_t )fd );
111
112
}
112
113
114
+ static int write_strbuf (void * user_data , const void * data , size_t len )
115
+ {
116
+ struct strbuf * sb = user_data ;
117
+ strbuf_add (sb , data , len );
118
+ return len ;
119
+ }
120
+
121
+ int ewah_serialize_strbuf (struct ewah_bitmap * self , struct strbuf * sb )
122
+ {
123
+ return ewah_serialize_to (self , write_strbuf , sb );
124
+ }
125
+
113
126
int ewah_read_mmap (struct ewah_bitmap * self , const void * map , size_t len )
114
127
{
115
128
const uint8_t * ptr = map ;
Original file line number Diff line number Diff line change 30
30
# define ewah_calloc xcalloc
31
31
#endif
32
32
33
+ struct strbuf ;
33
34
typedef uint64_t eword_t ;
34
35
#define BITS_IN_WORD (sizeof(eword_t) * 8)
35
36
@@ -98,6 +99,7 @@ int ewah_serialize_to(struct ewah_bitmap *self,
98
99
void * out );
99
100
int ewah_serialize (struct ewah_bitmap * self , int fd );
100
101
int ewah_serialize_native (struct ewah_bitmap * self , int fd );
102
+ int ewah_serialize_strbuf (struct ewah_bitmap * self , struct strbuf * );
101
103
102
104
int ewah_deserialize (struct ewah_bitmap * self , int fd );
103
105
int ewah_read_mmap (struct ewah_bitmap * self , const void * map , size_t len );
Original file line number Diff line number Diff line change @@ -41,22 +41,15 @@ int read_link_extension(struct index_state *istate,
41
41
return 0 ;
42
42
}
43
43
44
- static int write_strbuf (void * user_data , const void * data , size_t len )
45
- {
46
- struct strbuf * sb = user_data ;
47
- strbuf_add (sb , data , len );
48
- return len ;
49
- }
50
-
51
44
int write_link_extension (struct strbuf * sb ,
52
45
struct index_state * istate )
53
46
{
54
47
struct split_index * si = istate -> split_index ;
55
48
strbuf_add (sb , si -> base_sha1 , 20 );
56
49
if (!si -> delete_bitmap && !si -> replace_bitmap )
57
50
return 0 ;
58
- ewah_serialize_to (si -> delete_bitmap , write_strbuf , sb );
59
- ewah_serialize_to (si -> replace_bitmap , write_strbuf , sb );
51
+ ewah_serialize_strbuf (si -> delete_bitmap , sb );
52
+ ewah_serialize_strbuf (si -> replace_bitmap , sb );
60
53
return 0 ;
61
54
}
62
55
You can’t perform that action at this time.
0 commit comments