changeset 22949:ca4a2b85b6f6

global: Use #ifdef instead of #if with WORDS_BIGENDIAN This is to not rely on undefined WORDS_BIGENDIAN being evaluated as 0.
author Martti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
date Fri, 27 Oct 2017 11:03:07 +0300
parents e48f732f0f39
children a9e689fe3ee2
files src/lib-index/mail-index-map-hdr.c src/lib-index/mail-index-map.c src/lib-index/mail-transaction-log-file.c src/lib/byteorder.h src/lib/sha1.c src/lib/test-byteorder.c
diffstat 6 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-map-hdr.c	Mon Apr 23 18:15:51 2018 -0400
+++ b/src/lib-index/mail-index-map-hdr.c	Fri Oct 27 11:03:07 2017 +0300
@@ -171,7 +171,7 @@
 {
         enum mail_index_header_compat_flags compat_flags = 0;
 
-#if !WORDS_BIGENDIAN
+#ifndef WORDS_BIGENDIAN
 	compat_flags |= MAIL_INDEX_COMPAT_LITTLE_ENDIAN;
 #endif
 
--- a/src/lib-index/mail-index-map.c	Mon Apr 23 18:15:51 2018 -0400
+++ b/src/lib-index/mail-index-map.c	Fri Oct 27 11:03:07 2017 +0300
@@ -239,7 +239,7 @@
 	hdr->header_size = sizeof(*hdr);
 	hdr->record_size = sizeof(struct mail_index_record);
 
-#if !WORDS_BIGENDIAN
+#ifndef WORDS_BIGENDIAN
 	hdr->compat_flags |= MAIL_INDEX_COMPAT_LITTLE_ENDIAN;
 #endif
 
--- a/src/lib-index/mail-transaction-log-file.c	Mon Apr 23 18:15:51 2018 -0400
+++ b/src/lib-index/mail-transaction-log-file.c	Fri Oct 27 11:03:07 2017 +0300
@@ -536,7 +536,7 @@
 		/* we have compatibility flags */
 		enum mail_index_header_compat_flags compat_flags = 0;
 
-#if !WORDS_BIGENDIAN
+#ifndef WORDS_BIGENDIAN
 		compat_flags |= MAIL_INDEX_COMPAT_LITTLE_ENDIAN;
 #endif
 		if (file->hdr.compat_flags != compat_flags) {
--- a/src/lib/byteorder.h	Mon Apr 23 18:15:51 2018 -0400
+++ b/src/lib/byteorder.h	Fri Oct 27 11:03:07 2017 +0300
@@ -244,7 +244,7 @@
 	return bswap;							\
 }
 
-#if WORDS_BIGENDIAN
+#ifdef WORDS_BIGENDIAN
 #define __GEN(from, size, to, be, le) ___GEN(from, size, to, be)
 #else
 #define __GEN(from, size, to, be, le) ___GEN(from, size, to, le)
--- a/src/lib/sha1.c	Mon Apr 23 18:15:51 2018 -0400
+++ b/src/lib/sha1.c	Fri Oct 27 11:03:07 2017 +0300
@@ -235,7 +235,7 @@
 
 	digest = (uint8_t *)digest0;
 	sha1_pad(ctxt);
-#if WORDS_BIGENDIAN
+#ifdef WORDS_BIGENDIAN
 	memmove(digest, &ctxt->h.b8[0], 20);
 #else
 	digest[0] = ctxt->h.b8[3]; digest[1] = ctxt->h.b8[2];
--- a/src/lib/test-byteorder.c	Mon Apr 23 18:15:51 2018 -0400
+++ b/src/lib/test-byteorder.c	Fri Oct 27 11:03:07 2017 +0300
@@ -103,7 +103,7 @@
 	uint32_t le32;
 	uint64_t le64;
 
-#if WORDS_BIGENDIAN
+#ifdef WORDS_BIGENDIAN
 #define cpu8 be8
 #define cpu16 be16
 #define cpu32 be32