All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Eric Wong <e@80x24.org>,  git@vger.kernel.org
Subject: Re: [PATCH 2/3] treewide: switch to khashl for memory savings
Date: Wed, 27 Mar 2024 14:54:18 -0700	[thread overview]
Message-ID: <xmqq7chn1gtx.fsf@gitster.g> (raw)
In-Reply-To: <20240327093710.GA847433@coredump.intra.peff.net> (Jeff King's message of "Wed, 27 Mar 2024 05:37:10 -0400")

Jeff King <peff@peff.net> writes:

> On Tue, Mar 26, 2024 at 10:48:40AM -0700, Junio C Hamano wrote:
>
>> $ make builtin/fast-import.sp ;# part of make sparse
>>     SP builtin/fast-import.c
>> builtin/fast-import.c: note: in included file (through oidset.h, packfile.h):
>> khashl.h:516:1: error: Using plain integer as NULL pointer
>> khashl.h:516:1: error: Using plain integer as NULL pointer
>> make: *** [Makefile:3237: builtin/fast-import.sp] Error 1
>> 
>> I found IMPL_GET and IMPL_DEL's use of (h->keys == 0) were giving
>> one of these two, and managed to reduce the error to just one with
>> the attached patch, but I don't know what the other error is coming
>> from.
>
> Probably:
>
> diff --git a/khashl.h b/khashl.h
> index 8fcebed237..1e724bbf88 100644
> --- a/khashl.h
> +++ b/khashl.h
> @@ -116,7 +116,7 @@ static kh_inline khint_t __kh_h2b(khint_t hash, khint_t bits) { return hash * 26
>  
>  #define __KHASHL_IMPL_RESIZE(SCOPE, HType, prefix, khkey_t, __hash_fn, __hash_eq) \
>  	SCOPE void prefix##_resize(HType *h, khint_t new_n_buckets) { \
> -		khint32_t *new_used = 0; \
> +		khint32_t *new_used = NULL; \
>  		khint_t j = 0, x = new_n_buckets, n_buckets, new_bits, new_mask; \
>  		while ((x >>= 1) != 0) ++j; \
>  		if (new_n_buckets & (new_n_buckets - 1)) ++j; \
>
> -Peff

Spot on.  With this (and the other two 0 -> NULL fixes), and with
the SWAP() thing in brian's credential series fixed, the tip of
'seen' passes the static-analysis and sparse CI jobs again.

Thanks.

  reply	other threads:[~2024-03-27 21:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 23:07 [PATCH 0/3] switch to tombstone-free khashl table Eric Wong
2024-03-25 23:07 ` [PATCH 1/3] list-objects-filter: use kh_size API Eric Wong
2024-03-25 23:07 ` [PATCH 2/3] treewide: switch to khashl for memory savings Eric Wong
2024-03-26 17:48   ` Junio C Hamano
2024-03-27  9:37     ` Jeff King
2024-03-27 21:54       ` Junio C Hamano [this message]
2024-03-25 23:07 ` [PATCH 3/3] khashl: fix ensemble lookups on empty table Eric Wong
2024-03-25 23:07 ` [REJECT 4/3] switch to khashl ensemble Eric Wong
2024-03-26 17:40 ` [PATCH 0/3] switch to tombstone-free khashl table Junio C Hamano
2024-04-19 21:31   ` Junio C Hamano
2024-04-19 21:46     ` Eric Wong
  -- strict thread matches above, loose matches on Subject: below --
2024-03-28 10:13 Eric Wong
2024-03-28 10:13 ` [PATCH 2/3] treewide: switch to khashl for memory savings Eric Wong

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=xmqq7chn1gtx.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.