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 <jamill@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jameson Miller committed Apr 11, 2018 at 18:37 UTC 7dc0656e2f1bddc07518273ccdb79a3d315f06a6
1 file changed +10 -10
fast-import.c
+10 -10
@@ -209,8 +209,8 @@ struct last_object {
209 unsigned no_swap : 1;
210 };
211
212 -struct mem_pool {
213 - struct mem_pool *next_pool;
212 +struct mp_block {
213 + struct mp_block *next_block;
214 char *next_free;
215 char *end;
216 uintmax_t space[FLEX_ARRAY]; /* more */
@@ -304,9 +304,9 @@ static int global_argc;
304 static const char **global_argv;
305
306 /* 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);
308 static size_t total_allocd;
309 -static struct mem_pool *mem_pool;
309 +static struct mp_block *mp_block_head;
310
311 /* Atom management */
312 static unsigned int atom_table_sz = 4451;
@@ -636,14 +636,14 @@ static unsigned int hc_str(const char *s, size_t len)
636
637 static void *pool_alloc(size_t len)
638 {
639 - struct mem_pool *p;
639 + struct mp_block *p;
640 void *r;
641
642 /* round up to a 'uintmax_t' alignment */
643 if (len & (sizeof(uintmax_t) - 1))
644 len += sizeof(uintmax_t) - (len & (sizeof(uintmax_t) - 1));
645
646 - for (p = mem_pool; p; p = p->next_pool)
646 + for (p = mp_block_head; p; p = p->next_block)
647 if ((p->end - p->next_free >= len))
648 break;
649
@@ -652,12 +652,12 @@ static void *pool_alloc(size_t len)
652 total_allocd += len;
653 return xmalloc(len);
654 }
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;
658 p->next_free = (char *) p->space;
659 p->end = p->next_free + mem_pool_alloc;
660 - mem_pool = p;
660 + mp_block_head = p;
661 }
662
663 r = p->next_free;