From: Collin Funk <collin.funk1@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Jacob Keller" <jacob.keller@gmail.com>,
"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: Re: [PATCH] diff-no-index: do not reference .d_type member of struct dirent
Date: Wed, 18 Jun 2025 13:37:42 -0700 [thread overview]
Message-ID: <874iwcss4p.fsf@gmail.com> (raw)
In-Reply-To: <xmqqh60ces03.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
> Some platforms like AIX lack .d_type member in "struct dirent"; use
> the DTYPE(e) macro instead of a direct reference to e->d_type and
> when it yields DT_UNKNOWN, find the real type with get_dtype().
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> * get_dtype() was designed for a typical
>
> - prepare the path in a strbuf B
> - opendir(B)
> - loop over readdir(B)
> - do things to path (B + e->d_name)
>
> code structure, but because this code path does not use a strbuf
> (instead the path given to opendir is a "const char *"), the
> entire thing becomes messier than necessary. get_dtype() has a
> short-cut to avoid having to concatenate path+e->d_name and run
> (l)stat() when e->d_type exists and known, but we need to open
> code it here.
>
> diff-no-index.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
Tested on AIX 7.3 like the previous patch just to be safe and it works
as expected.
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Tested-by: Collin Funk <collin.funk1@gmail.com>
Thanks,
Collin
prev parent reply other threads:[~2025-06-18 20:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 20:04 [PATCH] diff-no-index: do not reference .d_type member of struct dirent Junio C Hamano
2025-06-18 20:37 ` Collin Funk [this message]
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=874iwcss4p.fsf@gmail.com \
--to=collin.funk1@gmail.com \
--cc=carenas@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.keller@gmail.com \
/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).