[njs] Separating private from public headers.

Dmitry Volyntsev xeioex at nginx.com
Mon Aug 5 15:18:06 UTC 2019


details:   https://hg.nginx.org/njs/rev/a07dc8b56fd3
branches:  
changeset: 1102:a07dc8b56fd3
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon Aug 05 17:36:09 2019 +0300
description:
Separating private from public headers.

diffstat:

 src/njs.h                       |   2 ++
 src/njs_clang.h                 |   1 -
 src/njs_diyfp.h                 |   3 ---
 src/njs_main.h                  |   3 +++
 src/njs_malloc.h                |  10 ----------
 src/njs_math.h                  |   3 ---
 src/njs_number.h                |   4 ----
 src/njs_pcre.c                  |   1 -
 src/njs_regexp_pattern.h        |   3 ---
 src/njs_string.h                |   1 -
 src/njs_types.h                 |   2 +-
 src/njs_unix.h                  |  13 ++++++++++---
 src/njs_value.h                 |  10 ----------
 src/test/njs_benchmark.c        |   1 -
 src/test/njs_interactive_test.c |   1 -
 15 files changed, 16 insertions(+), 42 deletions(-)

diffs (220 lines):

diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs.h
--- a/src/njs.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs.h	Mon Aug 05 17:36:09 2019 +0300
@@ -14,10 +14,12 @@
 #define NJS_VERSION                 "0.3.4"
 
 
+#include <unistd.h>                 /* STDOUT_FILENO, STDERR_FILENO */
 #include <njs_types.h>
 #include <njs_clang.h>
 #include <njs_str.h>
 #include <njs_lvlhsh.h>
+#include <njs_sprintf.h>
 
 
 typedef uintptr_t                   njs_index_t;
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_clang.h
--- a/src/njs_clang.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_clang.h	Mon Aug 05 17:36:09 2019 +0300
@@ -10,7 +10,6 @@
 
 #include <stdarg.h>
 #include <stddef.h>       /* offsetof(). */
-#include <unistd.h>       /* NULL. */
 
 
 #define njs_inline         static inline __attribute__((always_inline))
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_diyfp.h
--- a/src/njs_diyfp.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_diyfp.h	Mon Aug 05 17:36:09 2019 +0300
@@ -11,9 +11,6 @@
 #ifndef _NJS_DIYFP_H_INCLUDED_
 #define _NJS_DIYFP_H_INCLUDED_
 
-#include <njs_types.h>
-#include <math.h>
-
 
 typedef struct {
     uint64_t    significand;
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_main.h
--- a/src/njs_main.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_main.h	Mon Aug 05 17:36:09 2019 +0300
@@ -31,6 +31,9 @@
 #include <njs_arr.h>
 #include <njs_sprintf.h>
 
+#include <njs_pcre.h>
+#include <njs_regex.h>
+
 #include <njs_md5.h>
 #include <njs_sha1.h>
 #include <njs_sha2.h>
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_malloc.h
--- a/src/njs_malloc.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_malloc.h	Mon Aug 05 17:36:09 2019 +0300
@@ -7,16 +7,6 @@
 #ifndef _NJS_MALLOC_H_INCLUDED_
 #define _NJS_MALLOC_H_INCLUDED_
 
-#include <stdlib.h>
-
-/*
- * alloca() is defined in stdlib.h in Linux, FreeBSD and MacOSX
- * and in alloca.h in Linux, Solaris and MacOSX.
- */
-#if (NJS_SOLARIS)
-#include <alloca.h>
-#endif
-
 
 #define njs_malloc(size)   malloc(size)
 #define njs_free(p)        free(p)
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_math.h
--- a/src/njs_math.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_math.h	Mon Aug 05 17:36:09 2019 +0300
@@ -8,9 +8,6 @@
 #define _NJS_MATH_H_INCLUDED_
 
 
-#include <math.h>
-
-
 extern const njs_object_init_t  njs_math_object_init;
 
 
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_number.h
--- a/src/njs_number.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_number.h	Mon Aug 05 17:36:09 2019 +0300
@@ -8,10 +8,6 @@
 #define _NJS_NUMBER_H_INCLUDED_
 
 
-#include <njs_string.h>
-#include <math.h>
-
-
 uint32_t njs_value_to_index(const njs_value_t *value);
 double njs_number_dec_parse(const u_char **start, const u_char *end);
 uint64_t njs_number_oct_parse(const u_char **start, const u_char *end);
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_pcre.c
--- a/src/njs_pcre.c	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_pcre.c	Mon Aug 05 17:36:09 2019 +0300
@@ -6,7 +6,6 @@
 
 
 #include <njs_main.h>
-#include <njs_pcre.h>
 
 
 static void *njs_pcre_malloc(size_t size);
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_regexp_pattern.h
--- a/src/njs_regexp_pattern.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_regexp_pattern.h	Mon Aug 05 17:36:09 2019 +0300
@@ -7,9 +7,6 @@
 #ifndef _NJS_REGEXP_PATTERN_H_INCLUDED_
 #define _NJS_REGEXP_PATTERN_H_INCLUDED_
 
-#include <njs_pcre.h>
-#include <njs_regex.h>
-
 
 typedef enum {
     NJS_REGEXP_BYTE = 0,
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_string.h
--- a/src/njs_string.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_string.h	Mon Aug 05 17:36:09 2019 +0300
@@ -7,7 +7,6 @@
 #ifndef _NJS_STRING_H_INCLUDED_
 #define _NJS_STRING_H_INCLUDED_
 
-#include <njs_utf8.h>
 
 /*
  * nJSVM supports two string variants:
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_types.h
--- a/src/njs_types.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_types.h	Mon Aug 05 17:36:09 2019 +0300
@@ -23,7 +23,7 @@
 
 /* u_char, u_int, int8_t, int32_t, int64_t, size_t, off_t. */
 #include <sys/types.h>
-#include <inttypes.h>
+#include <stdint.h>
 
 
 #if (__LP64__)
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_unix.h
--- a/src/njs_unix.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_unix.h	Mon Aug 05 17:36:09 2019 +0300
@@ -22,17 +22,24 @@
 
 #endif /* NJS_LINUX */
 
+
 #include <errno.h>
-#include <stdarg.h>
-#include <stddef.h>                 /* offsetof() */
+#include <stdlib.h>
 #include <stdio.h>
-#include <stdint.h>
 #include <string.h>
 #include <math.h>
 #include <float.h>
 #include <time.h>
 #include <fcntl.h>
 
+/*
+ * alloca() is defined in stdlib.h in Linux, FreeBSD and MacOSX
+ * and in alloca.h in Linux, Solaris and MacOSX.
+ */
+#if (NJS_SOLARIS)
+#include <alloca.h>
+#endif
+
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <sys/param.h>
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/njs_value.h
--- a/src/njs_value.h	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/njs_value.h	Mon Aug 05 17:36:09 2019 +0300
@@ -8,16 +8,6 @@
 #define _NJS_VALUE_H_INCLUDED_
 
 
-#include <njs_trace.h>
-#include <njs_queue.h>
-#include <njs_regex.h>
-#include <njs_random.h>
-#include <njs_djb_hash.h>
-#include <njs_mp.h>
-
-#include <math.h>
-
-
 /*
  * The order of the enum is used in njs_vmcode_typeof()
  * and njs_object_prototype_to_string().
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/test/njs_benchmark.c
--- a/src/test/njs_benchmark.c	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/test/njs_benchmark.c	Mon Aug 05 17:36:09 2019 +0300
@@ -5,7 +5,6 @@
  */
 
 #include <njs.h>
-#include <njs_sprintf.h>
 
 #include <string.h>
 #include <stdlib.h>
diff -r 04d7a5d93ae6 -r a07dc8b56fd3 src/test/njs_interactive_test.c
--- a/src/test/njs_interactive_test.c	Sun Aug 04 04:13:02 2019 -0400
+++ b/src/test/njs_interactive_test.c	Mon Aug 05 17:36:09 2019 +0300
@@ -5,7 +5,6 @@
  */
 
 #include <njs.h>
-#include <njs_sprintf.h>
 
 #include <string.h>
 #include <sys/resource.h>


More information about the nginx-devel mailing list