Permalink
Browse files

move OSX compatible <endian.h> exception to a common "endian_compat.h…

…" header
  • Loading branch information...
1 parent 329a13e commit bcde0fc7217091410941eb53267ebf4faac395fd @amery committed Aug 7, 2012
Showing with 18 additions and 11 deletions.
  1. +1 −9 fel.c
  2. +14 −0 include/endian_compat.h
  3. +2 −1 phoenix_info.c
  4. +1 −1 pio.c
View
10 fel.c
@@ -29,15 +29,7 @@
#include <stdio.h>
#include <errno.h>
-#ifdef __APPLE__
-#include <CoreFoundation/CoreFoundation.h>
-#define htole32(x) CFSwapInt32HostToLittle(x)
-#define le32toh(x) CFSwapInt32LittleToHost(x)
-#define htole16(x) CFSwapInt16HostToLittle(x)
-#define le16toh(x) CFSwapInt16LittleToHost(x)
-#else
-#include <endian.h>
-#endif
+#include "endian_compat.h"
int errno;
View
14 include/endian_compat.h
@@ -0,0 +1,14 @@
+#ifndef SUNXI_ENDIAN_COMPAT_H_
+#define SUNXI_ENDIAN_COMPAT_H_
+
+#ifdef __APPLE__
+#include <CoreFoundation/CoreFoundation.h>
+#define htole32(x) CFSwapInt32HostToLittle(x)
+#define le32toh(x) CFSwapInt32LittleToHost(x)
+#define htole16(x) CFSwapInt16HostToLittle(x)
+#define le16toh(x) CFSwapInt16LittleToHost(x)
+#else
+#include <endian.h>
+#endif
+
+#endif
View
3 phoenix_info.c
@@ -21,9 +21,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <endian.h>
#include <unistd.h>
+#include "endian_compat.h"
+
struct phoenix_ptable {
char signature[16]; /* "PHOENIX_CARD_IMG" */
unsigned int unknown1; /* 0x00200100 */
View
2 pio.c
@@ -9,7 +9,7 @@
#include <stdlib.h>
#include <errno.h>
-#include <endian.h>
+#include "endian_compat.h"
#define PIO_REG_SIZE 0x228 /*0x300*/
#define PIO_PORT_SIZE 0x24

0 comments on commit bcde0fc

Please sign in to comment.