curses: le16enc/le32enc only where the libc has none

NetBSD's <sys/endian.h> defines le16dec, le32dec, le16enc and le32enc, and
the vendored replacement redefined them -- "redefinition of 'le16enc'",
which stopped the cross build at tic/tic.o
(build/logs/release-2026-11-23i-cross.log:94).

Test: x86_64--netbsd-gcc -std=gnu11 -I. -I./libterminfo -I build/obj/destdir.amd64/usr/include -c tic/tic.c -> rc=0.
This commit is contained in:
lotherk committed 2026-11-23 12:52:10 +00:00
1 parent 4ff2844955
commit 7fecc7d153
1 file changed
+7
+7
View File
@@ -33,6 +33,12 @@ static __inline uint16_t nbs_bswap16(uint16_t __x)
#endif
#define __CAST(__dt, __st) ((__dt)(__st))
/* NetBSD's own <sys/endian.h> already defines le16dec, le32dec, le16enc and
* le32enc (as inline functions since 1998), so this replacement contradicts it
* -- "redefinition of 'le16enc'", which stopped the cross build
* (build/logs/release-2026-11-23i-cross.log:94). Only a libc without them
* needs the block; the guard asks the header that provides them. */
#ifndef __NetBSD__
static inline uint16_t
le16dec(const void *buf)
{
@@ -66,6 +72,7 @@ le32enc(void *buf, uint32_t u)
p[2] = __CAST(uint8_t, ((u >> 16) & 0xff));
p[3] = __CAST(uint8_t, ((u >> 24) & 0xff));
}
#endif /* !__NetBSD__ */
#endif