Skip to content

Commit 7dc0656

Browse files
jamillgitster
authored andcommitted
fast-import: rename mem_pool type to mp_block
This is part of a patch series to extract the memory pool logic in fast-import into a more generalized version. The existing mem_pool type maps more closely to a "block of memory" (mp_block) in the more generalized memory pool. This commit renames the mem_pool to mp_block to reduce churn in future patches. Signed-off-by: Jameson Miller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 90bbd50 commit 7dc0656

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

fast-import.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ struct last_object {
209209
unsigned no_swap : 1;
210210
};
211211

212-
struct mem_pool {
213-
struct mem_pool *next_pool;
212+
struct mp_block {
213+
struct mp_block *next_block;
214214
char *next_free;
215215
char *end;
216216
uintmax_t space[FLEX_ARRAY]; /* more */
@@ -304,9 +304,9 @@ static int global_argc;
304304
static const char **global_argv;
305305

306306
/* Memory pools */
307-
static size_t mem_pool_alloc = 2*1024*1024 - sizeof(struct mem_pool);
307+
static size_t mem_pool_alloc = 2*1024*1024 - sizeof(struct mp_block);
308308
static size_t total_allocd;
309-
static struct mem_pool *mem_pool;
309+
static struct mp_block *mp_block_head;
310310

311311
/* Atom management */
312312
static unsigned int atom_table_sz = 4451;
@@ -636,14 +636,14 @@ static unsigned int hc_str(const char *s, size_t len)
636636

637637
static void *pool_alloc(size_t len)
638638
{
639-
struct mem_pool *p;
639+
struct mp_block *p;
640640
void *r;
641641

642642
/* round up to a 'uintmax_t' alignment */
643643
if (len & (sizeof(uintmax_t) - 1))
644644
len += sizeof(uintmax_t) - (len & (sizeof(uintmax_t) - 1));
645645

646-
for (p = mem_pool; p; p = p->next_pool)
646+
for (p = mp_block_head; p; p = p->next_block)
647647
if ((p->end - p->next_free >= len))
648648
break;
649649

@@ -652,12 +652,12 @@ static void *pool_alloc(size_t len)
652652
total_allocd += len;
653653
return xmalloc(len);
654654
}
655-
total_allocd += sizeof(struct mem_pool) + mem_pool_alloc;
656-
p = xmalloc(st_add(sizeof(struct mem_pool), mem_pool_alloc));
657-
p->next_pool = mem_pool;
655+
total_allocd += sizeof(struct mp_block) + mem_pool_alloc;
656+
p = xmalloc(st_add(sizeof(struct mp_block), mem_pool_alloc));
657+
p->next_block = mp_block_head;
658658
p->next_free = (char *) p->space;
659659
p->end = p->next_free + mem_pool_alloc;
660-
mem_pool = p;
660+
mp_block_head = p;
661661
}
662662

663663
r = p->next_free;

0 commit comments

Comments
 (0)