Skip to content

Commit

Permalink
global: Use #ifdef instead of #if with WORDS_BIGENDIAN
Browse files Browse the repository at this point in the history
This is to not rely on undefined WORDS_BIGENDIAN being evaluated as 0.
  • Loading branch information
mrannanj authored and cmouse committed May 11, 2018
1 parent 75733dd commit ad55c19
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lib-index/mail-index-map-hdr.c
Expand Up @@ -171,7 +171,7 @@ bool mail_index_check_header_compat(struct mail_index *index,
{
enum mail_index_header_compat_flags compat_flags = 0;

#if !WORDS_BIGENDIAN
#ifndef WORDS_BIGENDIAN
compat_flags |= MAIL_INDEX_COMPAT_LITTLE_ENDIAN;
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/lib-index/mail-index-map.c
Expand Up @@ -239,7 +239,7 @@ static void mail_index_header_init(struct mail_index *index,
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

Expand Down
2 changes: 1 addition & 1 deletion src/lib-index/mail-transaction-log-file.c
Expand Up @@ -536,7 +536,7 @@ mail_transaction_log_file_read_hdr(struct mail_transaction_log_file *file,
/* 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) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/byteorder.h
Expand Up @@ -244,7 +244,7 @@ static inline uint##size##_t from##size##_to_##to(uint##size##_t x) \
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)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/sha1.c
Expand Up @@ -235,7 +235,7 @@ sha1_result(struct sha1_ctxt *ctxt, void *digest0)

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];
Expand Down
2 changes: 1 addition & 1 deletion src/lib/test-byteorder.c
Expand Up @@ -103,7 +103,7 @@ struct unaligned_run {
uint32_t le32;
uint64_t le64;

#if WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
#define cpu8 be8
#define cpu16 be16
#define cpu32 be32
Expand Down

0 comments on commit ad55c19

Please sign in to comment.