[PATCH] compat/bswap: add include header guards
- From
Jeff King <peff@peff.net>
- Date
- Mar 6, 2019, 19:05 UTC
- Message-ID
- <20190306190509.GA18239@sigill.intra.peff.net>
- In-Reply-To
- <xmqqd0n4r2qm.fsf@gitster-ct.c.googlers.com>
On Wed, Mar 06, 2019 at 02:28:01PM +0900, Junio C Hamano wrote:
Show 5 quoted lines
> > +#ifndef COMPAT_BSWAP_H > > +#define COMPAT_BSWAP_H > [...] > > This probably is worth having as an independent clean-up.
Yeah, let's do that now before we forget.
-- >8 -- Subject: [PATCH] compat/bswap: add include header guards
Our compat/bswap.h lacks the usual preprocessor guards against multiple inclusion. This usually isn't an issue since it only gets included from git-compat-util.h, which has its own guards. But it would produce redeclaration errors if any file included it separately.
Our hdr-check target would complain about this, except that it currently skips items in compat/ entirely.
Signed-off-by: Jeff King <peff@peff.net> --- compat/bswap.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/compat/bswap.h b/compat/bswap.h index 5078ce5ecc..e4e25735ce 100644 --- a/compat/bswap.h +++ b/compat/bswap.h @@ -1,3 +1,6 @@ +#ifndef COMPAT_BSWAP_H +#define COMPAT_BSWAP_H + /* * Let's make sure we always have a sane definition for ntohl()/htonl(). * Some libraries define those as a function call, just to perform byte @@ -210,3 +213,5 @@ static inline void put_be64(void *ptr, uint64_t value) } #endif + +#endif /* COMPAT_BSWAP_H */
-- 2.21.0.699.ge1748d4d73