From bedef7d12493e5785537c1f8e46ce32c3e34bf32 Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Tue, 3 May 2016 11:54:20 -0400 Subject: [PATCH] libsepol,checkpolicy,secilc: Replace #ifdef DARWIN with __APPLE__. As per discussion in https://android-review.googlesource.com/#/c/221980, we should be using #ifdef __APPLE__ rather than our own custom-defined DARWIN for building on MacOS X. Signed-off-by: Stephen Smalley --- checkpolicy/Android.mk | 4 ---- checkpolicy/checkpolicy.c | 2 +- checkpolicy/policy_define.c | 2 +- libsepol/Android.mk | 4 ---- libsepol/src/genbools.c | 4 ++-- libsepol/src/genusers.c | 4 ++-- libsepol/src/node_record.c | 4 ++-- libsepol/src/private.h | 4 ++-- secilc/Android.mk | 4 ---- 9 files changed, 10 insertions(+), 22 deletions(-) diff --git a/checkpolicy/Android.mk b/checkpolicy/Android.mk index 98f5168e..3b7ff8a2 100644 --- a/checkpolicy/Android.mk +++ b/checkpolicy/Android.mk @@ -12,10 +12,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS),darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/ \ $(LOCAL_PATH)/../libsepol/include/ \ diff --git a/checkpolicy/checkpolicy.c b/checkpolicy/checkpolicy.c index 7947c201..2d68316d 100644 --- a/checkpolicy/checkpolicy.c +++ b/checkpolicy/checkpolicy.c @@ -73,7 +73,7 @@ #include #include -#ifdef DARWIN +#ifdef __APPLE__ #include #endif diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c index 2068b710..100e5178 100644 --- a/checkpolicy/policy_define.c +++ b/checkpolicy/policy_define.c @@ -5140,7 +5140,7 @@ int define_ipv6_node_context(void) memset(newc, 0, sizeof(ocontext_t)); -#ifdef DARWIN +#ifdef __APPLE__ memcpy(&newc->u.node6.addr[0], &addr.s6_addr[0], 16); memcpy(&newc->u.node6.mask[0], &mask.s6_addr[0], 16); #else diff --git a/libsepol/Android.mk b/libsepol/Android.mk index 5d2c96ba..6d89f171 100644 --- a/libsepol/Android.mk +++ b/libsepol/Android.mk @@ -69,10 +69,6 @@ common_cflags := \ -Wshadow -Wmissing-noreturn \ -Wmissing-format-attribute -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/include/ \ $(LOCAL_PATH)/src/ \ diff --git a/libsepol/src/genbools.c b/libsepol/src/genbools.c index 6a06ec96..c81e8485 100644 --- a/libsepol/src/genbools.c +++ b/libsepol/src/genbools.c @@ -79,7 +79,7 @@ static int load_booleans(struct policydb *policydb, const char *path, if (boolf == NULL) goto localbool; -#ifdef DARWIN +#ifdef __APPLE__ if ((buffer = (char *)malloc(255 * sizeof(char))) == NULL) { ERR(NULL, "out of memory"); return -1; @@ -111,7 +111,7 @@ static int load_booleans(struct policydb *policydb, const char *path, boolf = fopen(localbools, "r"); if (boolf != NULL) { -#ifdef DARWIN +#ifdef __APPLE__ while(fgets(buffer, 255, boolf) != NULL) { #else diff --git a/libsepol/src/genusers.c b/libsepol/src/genusers.c index 7826b719..0b98a76e 100644 --- a/libsepol/src/genusers.c +++ b/libsepol/src/genusers.c @@ -7,7 +7,7 @@ #include -#ifndef DARWIN +#ifndef __APPLE__ #include #endif @@ -47,7 +47,7 @@ static int load_users(struct policydb *policydb, const char *path) if (fp == NULL) return -1; -#ifdef DARWIN +#ifdef __APPLE__ if ((buffer = (char *)malloc(255 * sizeof(char))) == NULL) { ERR(NULL, "out of memory"); return -1; diff --git a/libsepol/src/node_record.c b/libsepol/src/node_record.c index bd48ba00..21043b6a 100644 --- a/libsepol/src/node_record.c +++ b/libsepol/src/node_record.c @@ -70,7 +70,7 @@ static int node_parse_addr(sepol_handle_t * handle, return STATUS_ERR; } -#ifdef DARWIN +#ifdef __APPLE__ memcpy(addr_bytes, in_addr.s6_addr, 16); #else memcpy(addr_bytes, in_addr.s6_addr32, 16); @@ -162,7 +162,7 @@ static int node_expand_addr(sepol_handle_t * handle, { struct in6_addr addr; memset(&addr, 0, sizeof(struct in6_addr)); -#ifdef DARWIN +#ifdef __APPLE__ memcpy(&addr.s6_addr[0], addr_bytes, 16); #else memcpy(&addr.s6_addr32[0], addr_bytes, 16); diff --git a/libsepol/src/private.h b/libsepol/src/private.h index 8a6d4bb4..9c700c94 100644 --- a/libsepol/src/private.h +++ b/libsepol/src/private.h @@ -5,7 +5,7 @@ #include -#ifdef DARWIN +#ifdef __APPLE__ #include #include #else @@ -16,7 +16,7 @@ #include #include -#ifdef DARWIN +#ifdef __APPLE__ #define __BYTE_ORDER BYTE_ORDER #define __LITTLE_ENDIAN LITTLE_ENDIAN #endif diff --git a/secilc/Android.mk b/secilc/Android.mk index 3dd90233..6c7b9d32 100644 --- a/secilc/Android.mk +++ b/secilc/Android.mk @@ -6,10 +6,6 @@ common_cflags := \ -Wall -Wshadow -O2 \ -pipe -fno-strict-aliasing \ -ifeq ($(HOST_OS), darwin) -common_cflags += -DDARWIN -endif - common_includes := \ $(LOCAL_PATH)/../libsepol/cil/include/ \ $(LOCAL_PATH)/../libsepol/include/ \