git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: phillip.wood123@gmail.com
To: "René Scharfe" <l.s.r@web.de>, "Git List" <git@vger.kernel.org>
Cc: Jameson Miller <jamill@microsoft.com>,
	Phillip Wood <phillip.wood@dunelm.org.uk>,
	Elijah Newren <newren@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2] mem-pool: fix big allocations
Date: Thu, 28 Dec 2023 19:36:31 +0000	[thread overview]
Message-ID: <9bafdbfe-f451-43b1-806d-be3d70e21892@gmail.com> (raw)
In-Reply-To: <1c39c0e7-05b2-4726-a90c-f78df4356a41@web.de>

Hi René

On 28/12/2023 19:19, René Scharfe wrote:
> 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

  reply	other threads:[~2023-12-28 19:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 23:13 [PATCH] mem-pool: fix big allocations René Scharfe
2023-12-24  3:11 ` Elijah Newren
2023-12-24  9:30   ` René Scharfe
2023-12-28 15:10 ` Phillip Wood
2023-12-28 16:05   ` René Scharfe
2023-12-28 16:48     ` phillip.wood123
2023-12-28 18:56       ` René Scharfe
2023-12-28 19:34         ` phillip.wood123
2023-12-29  6:53           ` René Scharfe
2023-12-28 19:19 ` [PATCH v2] " René Scharfe
2023-12-28 19:36   ` phillip.wood123 [this message]
2024-01-02 22:29   ` Taylor Blau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9bafdbfe-f451-43b1-806d-be3d70e21892@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jamill@microsoft.com \
    --cc=l.s.r@web.de \
    --cc=newren@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).