[PATCH] getenv.c: Avoid check for unknown endianness.
Carlos O'Donell
carlos@redhat.com
Thu Jan 31 16:52:00 GMT 2013
This is a small code cleanup.
We only ever support big or little endian, and we should not
check for a weird 3rd byte order. If such an error check were to
happen it would happen in a central location or at configure
time.
The following patch removes check for the big endian case, and
makes it assume that !__LITTLE_ENDIAN == __BIG_ENDIAN.
No regressions on x86_64.
OK?
2012-01-31 Carlos O'Donell <carlos@redhat.com>
* stdlib/getenv.c (getenv): Assume __BIG_ENDIAN in the
else clause and remove check for non-standard endianness.
diff --git a/stdlib/getenv.c b/stdlib/getenv.c
index ee9d2b3..f33c22f 100644
--- a/stdlib/getenv.c
+++ b/stdlib/getenv.c
@@ -48,11 +48,7 @@ getenv (name)
#if __BYTE_ORDER == __LITTLE_ENDIAN || !_STRING_ARCH_unaligned
name_start = ('=' << 8) | *(const unsigned char *) name;
#else
-# if __BYTE_ORDER == __BIG_ENDIAN
name_start = '=' | ((*(const unsigned char *) name) << 8);
-# else
- #error "Funny byte order."
-# endif
#endif
for (ep = __environ; *ep != NULL; ++ep)
{
---
Cheers,
Carlos.
More information about the Libc-alpha
mailing list