Re: [PATCH v4 1/7] bulk-checkin: extract abstract `bulk_checkin_source`
- From
Jeff King <peff@peff.net>
- Date
- Oct 20, 2023, 07:35 UTC
- Message-ID
- <20231020073500.GE1642714@coredump.intra.peff.net>
- In-Reply-To
- <97bb6e9f59e5092f0519c7d1141d0673313fdc33.1697736516.git.me@ttaylorr.com>
On Thu, Oct 19, 2023 at 01:28:42PM -0400, Taylor Blau wrote:
Show 10 quoted lines
> +struct bulk_checkin_source {
> + enum { SOURCE_FILE } type;
> +
> + /* SOURCE_FILE fields */
> + int fd;
> +
> + /* common fields */
> + size_t size;
> + const char *path;
> +};This is a pretty minor nit, but we may find that "SOURCE_FILE" is not sufficiently name-spaced. Enum tags are in the global namespace, so the compiler will barf if there are any conflicts.
It might be OK here, since this is local to a single C file (so we at least are not hurting other code), but we may be in trouble if code in a header file is less careful. There is already a near-miss here with GREP_SOURCE_FILE, but fortunately grep.h is indeed careful. :)
(I notice that ref-filter.c similarly uses SOURCE_* for an internal enum).
-Peff