Merge pull request #15373 from thinkerou/del_include

PHP: remove invalid include-file and adjust include-file sort
diff --git a/src/php/ext/grpc/byte_buffer.c b/src/php/ext/grpc/byte_buffer.c
index 810cc81..474b7a6 100644
--- a/src/php/ext/grpc/byte_buffer.c
+++ b/src/php/ext/grpc/byte_buffer.c
@@ -16,23 +16,11 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
-#include <ext/spl/spl_exceptions.h>
-#include "php_grpc.h"
-
-#include <string.h>
 
 #include "byte_buffer.h"
 
-#include <grpc/grpc.h>
 #include <grpc/byte_buffer_reader.h>
-#include <grpc/slice.h>
 
 grpc_byte_buffer *string_to_byte_buffer(char *string, size_t length) {
   grpc_slice slice = grpc_slice_from_copied_buffer(string, length);
diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c
index 4a647ec..9a1dcb6 100644
--- a/src/php/ext/grpc/call.c
+++ b/src/php/ext/grpc/call.c
@@ -18,25 +18,12 @@
 
 #include "call.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include <ext/spl/spl_exceptions.h>
-#include "php_grpc.h"
-#include "call_credentials.h"
-
 #include <zend_exceptions.h>
-#include <zend_hash.h>
-
-#include <stdbool.h>
 
 #include <grpc/support/alloc.h>
-#include <grpc/grpc.h>
 
+#include "call_credentials.h"
 #include "completion_queue.h"
 #include "timeval.h"
 #include "channel.h"
diff --git a/src/php/ext/grpc/call.h b/src/php/ext/grpc/call.h
index bb73354..c07fb9b 100644
--- a/src/php/ext/grpc/call.h
+++ b/src/php/ext/grpc/call.h
@@ -19,17 +19,9 @@
 #ifndef NET_GRPC_PHP_GRPC_CALL_H_
 #define NET_GRPC_PHP_GRPC_CALL_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include "php_grpc.h"
-#include "channel.h"
 
-#include <grpc/grpc.h>
+#include "channel.h"
 
 /* Class entry for the Call PHP class */
 extern zend_class_entry *grpc_ce_call;
diff --git a/src/php/ext/grpc/call_credentials.c b/src/php/ext/grpc/call_credentials.c
index d96dc7f..12dcd46 100644
--- a/src/php/ext/grpc/call_credentials.c
+++ b/src/php/ext/grpc/call_credentials.c
@@ -16,28 +16,16 @@
  *
  */
 
-#include "channel_credentials.h"
 #include "call_credentials.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include <ext/spl/spl_exceptions.h>
-#include "php_grpc.h"
-#include "call.h"
-
 #include <zend_exceptions.h>
-#include <zend_hash.h>
 
-#include <grpc/grpc.h>
-#include <grpc/grpc_security.h>
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
+#include "call.h"
+
 zend_class_entry *grpc_ce_call_credentials;
 #if PHP_MAJOR_VERSION >= 7
 static zend_object_handlers call_credentials_ce_handlers;
diff --git a/src/php/ext/grpc/call_credentials.h b/src/php/ext/grpc/call_credentials.h
index 663cc68..1db90b9 100644
--- a/src/php/ext/grpc/call_credentials.h
+++ b/src/php/ext/grpc/call_credentials.h
@@ -19,17 +19,9 @@
 #ifndef NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_
 #define NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
 #include "php_grpc.h"
 
-#include "grpc/grpc.h"
-#include "grpc/grpc_security.h"
+#include <grpc/grpc_security.h>
 
 /* Class entry for the CallCredentials PHP class */
 extern zend_class_entry *grpc_ce_call_credentials;
diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c
index 6f3acc7..dc17e05 100644
--- a/src/php/ext/grpc/channel.c
+++ b/src/php/ext/grpc/channel.c
@@ -18,13 +18,6 @@
 
 #include "channel.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include <ext/standard/php_var.h>
 #include <ext/standard/sha1.h>
 #if PHP_MAJOR_VERSION < 7
@@ -33,19 +26,13 @@
 #include <zend_smart_str.h>
 #endif
 #include <ext/spl/spl_exceptions.h>
-#include "php_grpc.h"
-
 #include <zend_exceptions.h>
 
-#include <stdbool.h>
-
-#include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 #include <grpc/support/alloc.h>
 
 #include "completion_queue.h"
 #include "channel_credentials.h"
-#include "server.h"
 #include "timeval.h"
 
 zend_class_entry *grpc_ce_channel;
diff --git a/src/php/ext/grpc/channel.h b/src/php/ext/grpc/channel.h
index 7aad59a..c0bd8c7 100644
--- a/src/php/ext/grpc/channel.h
+++ b/src/php/ext/grpc/channel.h
@@ -19,17 +19,8 @@
 #ifndef NET_GRPC_PHP_GRPC_CHANNEL_H_
 #define NET_GRPC_PHP_GRPC_CHANNEL_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include "php_grpc.h"
 
-#include <grpc/grpc.h>
-
 /* Class entry for the PHP Channel class */
 extern zend_class_entry *grpc_ce_channel;
 
diff --git a/src/php/ext/grpc/channel_credentials.c b/src/php/ext/grpc/channel_credentials.c
index 624d7cc..8bda64c 100644
--- a/src/php/ext/grpc/channel_credentials.c
+++ b/src/php/ext/grpc/channel_credentials.c
@@ -17,27 +17,16 @@
  */
 
 #include "channel_credentials.h"
-#include "call_credentials.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include <ext/standard/sha1.h>
 #include <ext/spl/spl_exceptions.h>
-#include "channel.h"
-#include "php_grpc.h"
-
 #include <zend_exceptions.h>
-#include <zend_hash.h>
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/string_util.h>
-#include <grpc/grpc.h>
-#include <grpc/grpc_security.h>
+
+#include "call_credentials.h"
+#include "channel.h"
 
 zend_class_entry *grpc_ce_channel_credentials;
 #if PHP_MAJOR_VERSION >= 7
diff --git a/src/php/ext/grpc/channel_credentials.h b/src/php/ext/grpc/channel_credentials.h
index 357d732..ef312be 100644
--- a/src/php/ext/grpc/channel_credentials.h
+++ b/src/php/ext/grpc/channel_credentials.h
@@ -19,17 +19,9 @@
 #ifndef NET_GRPC_PHP_GRPC_CHANNEL_CREDENTIALS_H_
 #define NET_GRPC_PHP_GRPC_CHANNEL_CREDENTIALS_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
 #include "php_grpc.h"
 
-#include "grpc/grpc.h"
-#include "grpc/grpc_security.h"
+#include <grpc/grpc_security.h>
 
 /* Class entry for the ChannelCredentials PHP class */
 extern zend_class_entry *grpc_ce_channel_credentials;
diff --git a/src/php/ext/grpc/completion_queue.c b/src/php/ext/grpc/completion_queue.c
index f54089b..e7a2fa6 100644
--- a/src/php/ext/grpc/completion_queue.c
+++ b/src/php/ext/grpc/completion_queue.c
@@ -18,8 +18,6 @@
 
 #include "completion_queue.h"
 
-#include <php.h>
-
 grpc_completion_queue *completion_queue;
 
 void grpc_php_init_completion_queue(TSRMLS_D) {
diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c
index 1dd1f4f..fabd989 100644
--- a/src/php/ext/grpc/php_grpc.c
+++ b/src/php/ext/grpc/php_grpc.c
@@ -16,6 +16,8 @@
  *
  */
 
+#include "php_grpc.h"
+
 #include "call.h"
 #include "channel.h"
 #include "server.h"
@@ -25,15 +27,6 @@
 #include "server_credentials.h"
 #include "completion_queue.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
-#include "php_grpc.h"
-
 ZEND_DECLARE_MODULE_GLOBALS(grpc)
 static PHP_GINIT_FUNCTION(grpc);
 HashTable grpc_persistent_list;
diff --git a/src/php/ext/grpc/php_grpc.h b/src/php/ext/grpc/php_grpc.h
index e30f011..ecf5eba 100644
--- a/src/php/ext/grpc/php_grpc.h
+++ b/src/php/ext/grpc/php_grpc.h
@@ -20,8 +20,21 @@
 #ifndef PHP_GRPC_H
 #define PHP_GRPC_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdbool.h>
 
+#include <php.h>
+#include <php_ini.h>
+#include <ext/standard/info.h>
+
+#include <grpc/grpc.h>
+
+#include "php7_wrapper.h"
+#include "version.h"
+
 extern zend_module_entry grpc_module_entry;
 #define phpext_grpc_ptr &grpc_module_entry
 
@@ -37,11 +50,6 @@
 #include "TSRM.h"
 #endif
 
-#include "php.h"
-#include "php7_wrapper.h"
-#include "grpc/grpc.h"
-#include "version.h"
-
 /* These are all function declarations */
 /* Code that runs at module initialization */
 PHP_MINIT_FUNCTION(grpc);
diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c
index 292d512..ece7b00 100644
--- a/src/php/ext/grpc/server.c
+++ b/src/php/ext/grpc/server.c
@@ -16,29 +16,17 @@
  *
  */
 
-#include "call.h"
+#include "server.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include <ext/spl/spl_exceptions.h>
-#include "php_grpc.h"
-
 #include <zend_exceptions.h>
 
-#include <stdbool.h>
-
-#include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 #include <grpc/slice.h>
 #include <grpc/support/alloc.h>
 
+#include "call.h"
 #include "completion_queue.h"
-#include "server.h"
 #include "channel.h"
 #include "server_credentials.h"
 #include "timeval.h"
diff --git a/src/php/ext/grpc/server.h b/src/php/ext/grpc/server.h
index 366f5d0..ca70589 100644
--- a/src/php/ext/grpc/server.h
+++ b/src/php/ext/grpc/server.h
@@ -19,17 +19,8 @@
 #ifndef NET_GRPC_PHP_GRPC_SERVER_H_
 #define NET_GRPC_PHP_GRPC_SERVER_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include "php_grpc.h"
 
-#include <grpc/grpc.h>
-
 /* Class entry for the Server PHP class */
 extern zend_class_entry *grpc_ce_server;
 
diff --git a/src/php/ext/grpc/server_credentials.c b/src/php/ext/grpc/server_credentials.c
index 212486e..d143217 100644
--- a/src/php/ext/grpc/server_credentials.c
+++ b/src/php/ext/grpc/server_credentials.c
@@ -18,21 +18,8 @@
 
 #include "server_credentials.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include <ext/spl/spl_exceptions.h>
-#include "php_grpc.h"
-
 #include <zend_exceptions.h>
-#include <zend_hash.h>
-
-#include <grpc/grpc.h>
-#include <grpc/grpc_security.h>
 
 zend_class_entry *grpc_ce_server_credentials;
 #if PHP_MAJOR_VERSION >= 7
diff --git a/src/php/ext/grpc/server_credentials.h b/src/php/ext/grpc/server_credentials.h
index 310c28d..68e505c 100644
--- a/src/php/ext/grpc/server_credentials.h
+++ b/src/php/ext/grpc/server_credentials.h
@@ -26,9 +26,9 @@
 #include <php.h>
 #include <php_ini.h>
 #include <ext/standard/info.h>
+
 #include "php_grpc.h"
 
-#include <grpc/grpc.h>
 #include <grpc/grpc_security.h>
 
 /* Class entry for the Server_Credentials PHP class */
diff --git a/src/php/ext/grpc/timeval.c b/src/php/ext/grpc/timeval.c
index 7280dde..77a5ffa 100644
--- a/src/php/ext/grpc/timeval.c
+++ b/src/php/ext/grpc/timeval.c
@@ -18,23 +18,9 @@
 
 #include "timeval.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include <ext/spl/spl_exceptions.h>
-#include "php_grpc.h"
-
 #include <zend_exceptions.h>
 
-#include <stdbool.h>
-
-#include <grpc/grpc.h>
-#include <grpc/support/time.h>
-
 zend_class_entry *grpc_ce_timeval;
 #if PHP_MAJOR_VERSION >= 7
 static zend_object_handlers timeval_ce_handlers;
diff --git a/src/php/ext/grpc/timeval.h b/src/php/ext/grpc/timeval.h
index f4d267f..23f5c1e 100644
--- a/src/php/ext/grpc/timeval.h
+++ b/src/php/ext/grpc/timeval.h
@@ -19,18 +19,8 @@
 #ifndef NET_GRPC_PHP_GRPC_TIMEVAL_H_
 #define NET_GRPC_PHP_GRPC_TIMEVAL_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h>
-#include <ext/standard/info.h>
 #include "php_grpc.h"
 
-#include <grpc/grpc.h>
-#include <grpc/support/time.h>
-
 /* Class entry for the Timeval PHP Class */
 extern zend_class_entry *grpc_ce_timeval;