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 1919 */
2020#include "git-compat-util.h"
2121#include "ewok.h"
22+ #include "strbuf.h"
2223
2324int ewah_serialize_native (struct ewah_bitmap * self , int fd )
2425{
@@ -110,6 +111,18 @@ int ewah_serialize(struct ewah_bitmap *self, int fd)
110111 return ewah_serialize_to (self , write_helper , (void * )(intptr_t )fd );
111112}
112113
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+
113126int ewah_read_mmap (struct ewah_bitmap * self , const void * map , size_t len )
114127{
115128 const uint8_t * ptr = map ;
Original file line number Diff line number Diff line change 3030# define ewah_calloc xcalloc
3131#endif
3232
33+ struct strbuf ;
3334typedef uint64_t eword_t ;
3435#define BITS_IN_WORD (sizeof(eword_t) * 8)
3536
@@ -98,6 +99,7 @@ int ewah_serialize_to(struct ewah_bitmap *self,
9899 void * out );
99100int ewah_serialize (struct ewah_bitmap * self , int fd );
100101int ewah_serialize_native (struct ewah_bitmap * self , int fd );
102+ int ewah_serialize_strbuf (struct ewah_bitmap * self , struct strbuf * );
101103
102104int ewah_deserialize (struct ewah_bitmap * self , int fd );
103105int 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,
4141 return 0 ;
4242}
4343
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-
5144int write_link_extension (struct strbuf * sb ,
5245 struct index_state * istate )
5346{
5447 struct split_index * si = istate -> split_index ;
5548 strbuf_add (sb , si -> base_sha1 , 20 );
5649 if (!si -> delete_bitmap && !si -> replace_bitmap )
5750 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 );
6053 return 0 ;
6154}
6255
You can’t perform that action at this time.
0 commit comments