OSDN Git Service

Remove ALIGNBYTES and ALIGN from <sys/param.h>
authorCalin Juravle <calin@google.com>
Thu, 20 Mar 2014 15:21:32 +0000 (15:21 +0000)
committerCalin Juravle <calin@google.com>
Fri, 21 Mar 2014 09:59:34 +0000 (09:59 +0000)
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
libc/dns/gethnamaddr.c
libc/include/sys/param.h
libc/stdio/findfp.c

index 177652f..ec0baf7 100644 (file)
@@ -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))
index 2d2cb71..2234c7c 100644 (file)
@@ -72,6 +72,9 @@
 #include <syslog.h>
 #include <unistd.h>
 
+#define ALIGNBYTES (sizeof(uintptr_t) - 1)
+#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+
 #ifndef LOG_AUTH
 # define LOG_AUTH 0
 #endif
index 37c6427..e64d6ce 100644 (file)
 #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))
index 943c90a..926e5a1 100644 (file)
@@ -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 */