aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/ext/grpc/channel.h
diff options
context:
space:
mode:
authorGravatar thinkerou <thinkerou@gmail.com>2016-07-27 03:19:03 +0800
committerGravatar thinkerou <thinkerou@gmail.com>2016-07-27 03:19:03 +0800
commit6f9d30bf086637594f3c2d5970a4eafc410a7f39 (patch)
treee4c37dfefe2a3c454e4a3b97c16aba6c0659ddea /src/php/ext/grpc/channel.h
parent39e151b0f86d768b8e6718961466015065736d37 (diff)
add macro to php7_wrapper for reduce duplicate code
Diffstat (limited to 'src/php/ext/grpc/channel.h')
-rwxr-xr-xsrc/php/ext/grpc/channel.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/php/ext/grpc/channel.h b/src/php/ext/grpc/channel.h
index 94c633408e..0b815657d3 100755
--- a/src/php/ext/grpc/channel.h
+++ b/src/php/ext/grpc/channel.h
@@ -48,32 +48,25 @@
/* Class entry for the PHP Channel class */
extern zend_class_entry *grpc_ce_channel;
-#if PHP_MAJOR_VERSION < 7
-
/* Wrapper struct for grpc_channel that can be associated with a PHP object */
-typedef struct wrapped_grpc_channel {
- zend_object std;
+PHP_GRPC_WRAP_OBJECT_START(wrapped_grpc_channel)
grpc_channel *wrapped;
-} wrapped_grpc_channel;
+PHP_GRPC_WRAP_OBJECT_END(wrapped_grpc_channel)
+
+#if PHP_MAJOR_VERSION < 7
#define Z_WRAPPED_GRPC_CHANNEL_P(zv) \
(wrapped_grpc_channel *)zend_object_store_get_object(zv TSRMLS_CC)
#else
-/* Wrapper struct for grpc_channel that can be associated with a PHP object */
-typedef struct wrapped_grpc_channel {
- grpc_channel *wrapped;
- zend_object std;
-} wrapped_grpc_channel;
-
static inline wrapped_grpc_channel
*wrapped_grpc_channel_from_obj(zend_object *obj) {
return (wrapped_grpc_channel*)((char*)(obj) -
XtOffsetOf(wrapped_grpc_channel, std));
}
-#define Z_WRAPPED_GRPC_CHANNEL_P(zv) \
+#define Z_WRAPPED_GRPC_CHANNEL_P(zv) \
wrapped_grpc_channel_from_obj(Z_OBJ_P((zv)))
#endif /* PHP_MAJOR_VERSION */