This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] getenv.c: Avoid check for unknown endianness.

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

The following patch removes check for the big endian case, and
makes it assume that !__LITTLE_ENDIAN == __BIG_ENDIAN.

No regressions on x86_64.


2012-01-31  Carlos O'Donell  <>

	* 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;
       name_start = '=' | ((*(const unsigned char *) name) << 8);
-# else
- #error "Funny byte order."
-# endif
       for (ep = __environ; *ep != NULL; ++ep)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]