Subject: Re: [PATCH 01/10] ivec: introduce the C side of ivec

From: Junio C Hamano <[email-masked]>
Date: Sun, 04 Jan 2026 14:32:33 +0900

"Ezekiel Newren via GitGitGadget" <[email-masked]> writes:

> +	if (new_capacity == 0) {
> +		free(self->ptr);
> +		self->ptr = NULL;

	if (!new_capacity)
		FREE_AND_NULL(self->ptr);
	else
		...;

> +void ivec_free(void *self_)
> +{
> +	struct IVec_c_void *self = self_;
> +
> +	free(self->ptr);
> +	self->ptr = NULL;

Likewise.  Otherwise the code will fail coccicheck.

> +	self->length = 0;
> +	self->capacity = 0;
> +	// DO NOT MODIFY element_size!!!

	/* A single-liner comment in our codebase looks like this */