diff options
Diffstat (limited to 'src/php/ext/grpc/call_credentials.h')
-rwxr-xr-x | src/php/ext/grpc/call_credentials.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/php/ext/grpc/call_credentials.h b/src/php/ext/grpc/call_credentials.h index d2f6a92449..c1d85c0fb2 100755 --- a/src/php/ext/grpc/call_credentials.h +++ b/src/php/ext/grpc/call_credentials.h @@ -51,11 +51,27 @@ extern zend_class_entry *grpc_ce_call_credentials; /* Wrapper struct for grpc_call_credentials that can be associated * with a PHP object */ -typedef struct wrapped_grpc_call_credentials { - zend_object std; - +PHP_GRPC_WRAP_OBJECT_START(wrapped_grpc_call_credentials) grpc_call_credentials *wrapped; -} wrapped_grpc_call_credentials; +PHP_GRPC_WRAP_OBJECT_END(wrapped_grpc_call_credentials) + +#if PHP_MAJOR_VERSION < 7 + +#define Z_WRAPPED_GRPC_CALL_CREDS_P(zv) \ + (wrapped_grpc_call_credentials *)zend_object_store_get_object(zv TSRMLS_CC) + +#else + +static inline wrapped_grpc_call_credentials +*wrapped_grpc_call_credentials_from_obj(zend_object *obj) { + return (wrapped_grpc_call_credentials*)( + (char*)(obj) - XtOffsetOf(wrapped_grpc_call_credentials, std)); +} + +#define Z_WRAPPED_GRPC_CALL_CREDS_P(zv) \ + wrapped_grpc_call_credentials_from_obj(Z_OBJ_P((zv))) + +#endif /* PHP_MAJOR_VERSION */ /* Struct to hold callback function for plugin creds API */ typedef struct plugin_state { |