[njs] Merging njs_alignment.h into njs_clang.h.

Dmitry Volyntsev xeioex at nginx.com
Thu Aug 1 18:01:32 UTC 2019


details:   https://hg.nginx.org/njs/rev/7356d868d2cd
branches:  
changeset: 1091:7356d868d2cd
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Aug 01 18:49:29 2019 +0300
description:
Merging njs_alignment.h into njs_clang.h.

diffstat:

 src/njs_alignment.h |  49 -------------------------------------------------
 src/njs_clang.h     |  38 ++++++++++++++++++++++++++++++++++++++
 src/njs_main.h      |   1 -
 src/njs_mp.c        |   1 -
 4 files changed, 38 insertions(+), 51 deletions(-)

diffs (121 lines):

diff -r b0823626551d -r 7356d868d2cd src/njs_alignment.h
--- a/src/njs_alignment.h	Thu Aug 01 18:49:28 2019 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-
-/*
- * Copyright (C) Igor Sysoev
- * Copyright (C) NGINX, Inc.
- */
-
-#ifndef _NJS_ALIGNMENT_H_INCLUDED_
-#define _NJS_ALIGNMENT_H_INCLUDED_
-
-
-#ifndef NJS_MAX_ALIGNMENT
-
-#if (NJS_SOLARIS)
-/* x86_64: 16, i386: 4, sparcv9: 16, sparcv8: 8. */
-#define NJS_MAX_ALIGNMENT  _MAX_ALIGNMENT
-
-#elif (NJS_WINDOWS)
-/* Win64: 16, Win32: 8. */
-#define NJS_MAX_ALIGNMENT  MEMORY_ALLOCATION_ALIGNMENT
-
-#elif (__amd64__)
-#define NJS_MAX_ALIGNMENT  16
-
-#elif (__i386__ || __i386)
-#define NJS_MAX_ALIGNMENT  4
-
-#elif (__arm__)
-#define NJS_MAX_ALIGNMENT  16
-
-#else
-#define NJS_MAX_ALIGNMENT  16
-#endif
-
-#endif
-
-
-#define njs_align_size(size, a)                                               \
-    (((size) + ((size_t) (a) - 1)) & ~((size_t) (a) - 1))
-
-
-#define njs_align_ptr(p, a)                                                   \
-    (u_char *) (((uintptr_t) (p) + ((uintptr_t) (a) - 1))                     \
-                 & ~((uintptr_t) (a) - 1))
-
-#define njs_trunc_ptr(p, a)                                                   \
-    (u_char *) ((uintptr_t) (p) & ~((uintptr_t) (a) - 1))
-
-
-#endif /* _NJS_ALIGNMENT_H_INCLUDED_ */
diff -r b0823626551d -r 7356d868d2cd src/njs_clang.h
--- a/src/njs_clang.h	Thu Aug 01 18:49:28 2019 +0300
+++ b/src/njs_clang.h	Thu Aug 01 18:49:29 2019 +0300
@@ -157,4 +157,42 @@ njs_leading_zeros64(uint64_t x)
 #endif
 
 
+#ifndef NJS_MAX_ALIGNMENT
+
+#if (NJS_SOLARIS)
+/* x86_64: 16, i386: 4, sparcv9: 16, sparcv8: 8. */
+#define NJS_MAX_ALIGNMENT  _MAX_ALIGNMENT
+
+#elif (NJS_WINDOWS)
+/* Win64: 16, Win32: 8. */
+#define NJS_MAX_ALIGNMENT  MEMORY_ALLOCATION_ALIGNMENT
+
+#elif (__amd64__)
+#define NJS_MAX_ALIGNMENT  16
+
+#elif (__i386__ || __i386)
+#define NJS_MAX_ALIGNMENT  4
+
+#elif (__arm__)
+#define NJS_MAX_ALIGNMENT  16
+
+#else
+#define NJS_MAX_ALIGNMENT  16
+#endif
+
+#endif
+
+
+#define njs_align_size(size, a)                                               \
+    (((size) + ((size_t) (a) - 1)) & ~((size_t) (a) - 1))
+
+
+#define njs_align_ptr(p, a)                                                   \
+    (u_char *) (((uintptr_t) (p) + ((uintptr_t) (a) - 1))                     \
+                 & ~((uintptr_t) (a) - 1))
+
+#define njs_trunc_ptr(p, a)                                                   \
+    (u_char *) ((uintptr_t) (p) & ~((uintptr_t) (a) - 1))
+
+
 #endif /* _NJS_CLANG_H_INCLUDED_ */
diff -r b0823626551d -r 7356d868d2cd src/njs_main.h
--- a/src/njs_main.h	Thu Aug 01 18:49:28 2019 +0300
+++ b/src/njs_main.h	Thu Aug 01 18:49:29 2019 +0300
@@ -13,7 +13,6 @@
 #include <njs_unix.h>
 #include <njs_types.h>
 #include <njs_clang.h>
-#include <njs_alignment.h>
 #include <njs_str.h>
 #include <njs_stub.h>
 #include <njs_utf8.h>
diff -r b0823626551d -r 7356d868d2cd src/njs_mp.c
--- a/src/njs_mp.c	Thu Aug 01 18:49:28 2019 +0300
+++ b/src/njs_mp.c	Thu Aug 01 18:49:29 2019 +0300
@@ -7,7 +7,6 @@
 #include <njs_auto_config.h>
 #include <njs_types.h>
 #include <njs_clang.h>
-#include <njs_alignment.h>
 #include <njs_stub.h>
 #include <njs_str.h>
 #include <njs_queue.h>


More information about the nginx-devel mailing list