@@ -261,18 +261,32 @@ struct commit_buffer {
261
261
unsigned long size ;
262
262
};
263
263
define_commit_slab (buffer_slab , struct commit_buffer );
264
- static struct buffer_slab buffer_slab = COMMIT_SLAB_INIT (1 , buffer_slab );
264
+
265
+ struct buffer_slab * allocate_commit_buffer_slab (void )
266
+ {
267
+ struct buffer_slab * bs = xmalloc (sizeof (* bs ));
268
+ init_buffer_slab (bs );
269
+ return bs ;
270
+ }
271
+
272
+ void free_commit_buffer_slab (struct buffer_slab * bs )
273
+ {
274
+ clear_buffer_slab (bs );
275
+ free (bs );
276
+ }
265
277
266
278
void set_commit_buffer_the_repository (struct commit * commit , void * buffer , unsigned long size )
267
279
{
268
- struct commit_buffer * v = buffer_slab_at (& buffer_slab , commit );
280
+ struct commit_buffer * v = buffer_slab_at (
281
+ the_repository -> parsed_objects -> buffer_slab , commit );
269
282
v -> buffer = buffer ;
270
283
v -> size = size ;
271
284
}
272
285
273
286
const void * get_cached_commit_buffer_the_repository (const struct commit * commit , unsigned long * sizep )
274
287
{
275
- struct commit_buffer * v = buffer_slab_peek (& buffer_slab , commit );
288
+ struct commit_buffer * v = buffer_slab_peek (
289
+ the_repository -> parsed_objects -> buffer_slab , commit );
276
290
if (!v ) {
277
291
if (sizep )
278
292
* sizep = 0 ;
@@ -304,14 +318,16 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)
304
318
305
319
void unuse_commit_buffer (const struct commit * commit , const void * buffer )
306
320
{
307
- struct commit_buffer * v = buffer_slab_peek (& buffer_slab , commit );
321
+ struct commit_buffer * v = buffer_slab_peek (
322
+ the_repository -> parsed_objects -> buffer_slab , commit );
308
323
if (!(v && v -> buffer == buffer ))
309
324
free ((void * )buffer );
310
325
}
311
326
312
327
void free_commit_buffer (struct commit * commit )
313
328
{
314
- struct commit_buffer * v = buffer_slab_peek (& buffer_slab , commit );
329
+ struct commit_buffer * v = buffer_slab_peek (
330
+ the_repository -> parsed_objects -> buffer_slab , commit );
315
331
if (v ) {
316
332
FREE_AND_NULL (v -> buffer );
317
333
v -> size = 0 ;
@@ -347,7 +363,8 @@ void release_commit_memory(struct commit *c)
347
363
348
364
const void * detach_commit_buffer (struct commit * commit , unsigned long * sizep )
349
365
{
350
- struct commit_buffer * v = buffer_slab_peek (& buffer_slab , commit );
366
+ struct commit_buffer * v = buffer_slab_peek (
367
+ the_repository -> parsed_objects -> buffer_slab , commit );
351
368
void * ret ;
352
369
353
370
if (!v ) {
0 commit comments