git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] mem-pool: fix big allocations

From
Pphillip.wood123@gmail.com <phillip.wood123@gmail.com>
Date
Dec 28, 2023, 19:36 UTC
Message-ID
<9bafdbfe-f451-43b1-806d-be3d70e21892@gmail.com>
In-Reply-To
<1c39c0e7-05b2-4726-a90c-f78df4356a41@web.de>
Hi René
On 28/12/2023 19:19, René Scharfe wrote:
Show 27 quoted lines
> Interdiff against v1:
>    diff --git a/t/unit-tests/t-mem-pool.c b/t/unit-tests/t-mem-pool.c
>    index 2295779b0b..a0d57df761 100644
>    --- a/t/unit-tests/t-mem-pool.c
>    +++ b/t/unit-tests/t-mem-pool.c
>    @@ -1,8 +1,6 @@
>     #include "test-lib.h"
>     #include "mem-pool.h"
> 
>    -#define check_ptr(a, op, b) check_int(((a) op (b)), ==, 1)
>    -
>     static void setup_static(void (*f)(struct mem_pool *), size_t block_alloc)
>     {
>     	struct mem_pool pool = { .block_alloc = block_alloc };
>    @@ -16,11 +14,10 @@ static void t_calloc_100(struct mem_pool *pool)
>     	char *buffer = mem_pool_calloc(pool, 1, size);
>     	for (size_t i = 0; i < size; i++)
>     		check_int(buffer[i], ==, 0);
>    -	if (!check_ptr(pool->mp_block, !=, NULL))
>    +	if (!check(pool->mp_block != NULL))
>     		return;
>    -	check_ptr(pool->mp_block->next_free, <=, pool->mp_block->end);
>    -	check_ptr(pool->mp_block->next_free, !=, NULL);
>    -	check_ptr(pool->mp_block->end, !=, NULL);
>    +	check(pool->mp_block->next_free != NULL);
>    +	check(pool->mp_block->end != NULL);
>     }

The changes to the unit tests look good to me (I haven't really looked at the actual bug fix in the mem_pool code).

Best Wishes
Phillip
Previous: René ScharfeNext: Taylor Blau
Message 11 of 12 in “mem-pool: fix big allocations”
  1. mem-pool: fix big allocationsRené Scharfe, Dec 21, 2023
  2. Elijah NewrenDec 24, 2023
  3. René ScharfeDec 24, 2023
  4. Phillip WoodDec 28, 2023
  5. René ScharfeDec 28, 2023
  6. phillip.wood123@gmail.comDec 28, 2023
  7. René ScharfeDec 28, 2023
  8. phillip.wood123@gmail.comDec 28, 2023
  9. René ScharfeDec 29, 2023
  10. mem-pool: fix big allocationsRené Scharfe, Dec 28, 2023
  11. phillip.wood123@gmail.comDec 28, 2023
  12. Taylor BlauJan 2, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.