From c20de902875dcaebde0ccd0b7a8351598f254d4c Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Thu, 20 Mar 2014 15:21:32 +0000 Subject: [PATCH] Remove ALIGNBYTES and ALIGN from There are only three users of bionic definition of ALIGN and keeping it in sys/param.h polutes the namespace. I inline the definition in the the three places that's used. Bug: 13400663 Change-Id: I565008e8426c38ffb07422f42cd8e547d53044e9 --- libc/bionic/fts.c | 3 +++ libc/dns/gethnamaddr.c | 3 +++ libc/include/sys/param.h | 10 ---------- libc/stdio/findfp.c | 3 +++ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/libc/bionic/fts.c b/libc/bionic/fts.c index 177652fd9..ec0baf75a 100644 --- a/libc/bionic/fts.c +++ b/libc/bionic/fts.c @@ -51,6 +51,9 @@ static FTSENT *fts_sort(FTS *, FTSENT *, int); static u_short fts_stat(FTS *, FTSENT *, int); static int fts_safe_changedir(FTS *, FTSENT *, int, char *); +#define ALIGNBYTES (sizeof(uintptr_t) - 1) +#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES) + #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) #define CLR(opt) (sp->fts_options &= ~(opt)) diff --git a/libc/dns/gethnamaddr.c b/libc/dns/gethnamaddr.c index 2d2cb71ae..2234c7ce3 100644 --- a/libc/dns/gethnamaddr.c +++ b/libc/dns/gethnamaddr.c @@ -72,6 +72,9 @@ #include #include +#define ALIGNBYTES (sizeof(uintptr_t) - 1) +#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES) + #ifndef LOG_AUTH # define LOG_AUTH 0 #endif diff --git a/libc/include/sys/param.h b/libc/include/sys/param.h index 37c64271b..e64d6ce3c 100644 --- a/libc/include/sys/param.h +++ b/libc/include/sys/param.h @@ -34,16 +34,6 @@ #define MAXPATHLEN PATH_MAX #define MAXSYMLINKS 8 -#if __LP64__ -#define ALIGNBYTES 7 -#else -#define ALIGNBYTES 3 -#endif - -#ifndef ALIGN -#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES) -#endif - /* Macros for counting and rounding. */ #ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) diff --git a/libc/stdio/findfp.c b/libc/stdio/findfp.c index 943c90a5f..926e5a18d 100644 --- a/libc/stdio/findfp.c +++ b/libc/stdio/findfp.c @@ -41,6 +41,9 @@ #include "glue.h" #include "private/thread_private.h" +#define ALIGNBYTES (sizeof(uintptr_t) - 1) +#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES) + int __sdidinit; #define NDYNAMIC 10 /* add ten more whenever necessary */