|  | @@ -22,9 +22,7 @@
 | 
	
		
			
				|  |  |  #include <zend_exceptions.h>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  zend_class_entry *grpc_ce_timeval;
 | 
	
		
			
				|  |  | -#if PHP_MAJOR_VERSION >= 7
 | 
	
		
			
				|  |  | -static zend_object_handlers timeval_ce_handlers;
 | 
	
		
			
				|  |  | -#endif
 | 
	
		
			
				|  |  | +PHP_GRPC_DECLARE_OBJECT_HANDLER(timeval_ce_handlers)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /* Frees and destroys an instance of wrapped_grpc_call */
 | 
	
		
			
				|  |  |  PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_timeval)
 | 
	
	
		
			
				|  | @@ -44,7 +42,8 @@ zval *grpc_php_wrap_timeval(gpr_timespec wrapped TSRMLS_DC) {
 | 
	
		
			
				|  |  |    zval *timeval_object;
 | 
	
		
			
				|  |  |    PHP_GRPC_MAKE_STD_ZVAL(timeval_object);
 | 
	
		
			
				|  |  |    object_init_ex(timeval_object, grpc_ce_timeval);
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *timeval = Z_WRAPPED_GRPC_TIMEVAL_P(timeval_object);
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *timeval =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, timeval_object);
 | 
	
		
			
				|  |  |    memcpy(&timeval->wrapped, &wrapped, sizeof(gpr_timespec));
 | 
	
		
			
				|  |  |    return timeval_object;
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -54,7 +53,8 @@ zval *grpc_php_wrap_timeval(gpr_timespec wrapped TSRMLS_DC) {
 | 
	
		
			
				|  |  |   * @param long $microseconds The number of microseconds in the interval
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  PHP_METHOD(Timeval, __construct) {
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *timeval = Z_WRAPPED_GRPC_TIMEVAL_P(getThis());
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *timeval =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, getThis());
 | 
	
		
			
				|  |  |    php_grpc_long microseconds;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    /* "l" == 1 long */
 | 
	
	
		
			
				|  | @@ -84,8 +84,10 @@ PHP_METHOD(Timeval, add) {
 | 
	
		
			
				|  |  |                           "add expects a Timeval", 1 TSRMLS_CC);
 | 
	
		
			
				|  |  |      return;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *self = Z_WRAPPED_GRPC_TIMEVAL_P(getThis());
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *other = Z_WRAPPED_GRPC_TIMEVAL_P(other_obj);
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *self =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, getThis());
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *other =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, other_obj);
 | 
	
		
			
				|  |  |    zval *sum =
 | 
	
		
			
				|  |  |      grpc_php_wrap_timeval(gpr_time_add(self->wrapped, other->wrapped)
 | 
	
		
			
				|  |  |                            TSRMLS_CC);
 | 
	
	
		
			
				|  | @@ -108,8 +110,10 @@ PHP_METHOD(Timeval, subtract) {
 | 
	
		
			
				|  |  |                           "subtract expects a Timeval", 1 TSRMLS_CC);
 | 
	
		
			
				|  |  |      return;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *self = Z_WRAPPED_GRPC_TIMEVAL_P(getThis());
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *other = Z_WRAPPED_GRPC_TIMEVAL_P(other_obj);
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *self =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, getThis());
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *other =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, other_obj);
 | 
	
		
			
				|  |  |    zval *diff =
 | 
	
		
			
				|  |  |      grpc_php_wrap_timeval(gpr_time_sub(self->wrapped, other->wrapped)
 | 
	
		
			
				|  |  |                            TSRMLS_CC);
 | 
	
	
		
			
				|  | @@ -135,8 +139,10 @@ PHP_METHOD(Timeval, compare) {
 | 
	
		
			
				|  |  |                           "compare expects two Timevals", 1 TSRMLS_CC);
 | 
	
		
			
				|  |  |      return;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *a = Z_WRAPPED_GRPC_TIMEVAL_P(a_obj);
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *b = Z_WRAPPED_GRPC_TIMEVAL_P(b_obj);
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *a =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, a_obj);
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *b =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, b_obj);
 | 
	
		
			
				|  |  |    long result = gpr_time_cmp(a->wrapped, b->wrapped);
 | 
	
		
			
				|  |  |    RETURN_LONG(result);
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -161,9 +167,12 @@ PHP_METHOD(Timeval, similar) {
 | 
	
		
			
				|  |  |                           "compare expects three Timevals", 1 TSRMLS_CC);
 | 
	
		
			
				|  |  |      return;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *a = Z_WRAPPED_GRPC_TIMEVAL_P(a_obj);
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *b = Z_WRAPPED_GRPC_TIMEVAL_P(b_obj);
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *thresh = Z_WRAPPED_GRPC_TIMEVAL_P(thresh_obj);
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *a =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, a_obj);
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *b =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, b_obj);
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *thresh =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, thresh_obj);
 | 
	
		
			
				|  |  |    int result = gpr_time_similar(a->wrapped, b->wrapped, thresh->wrapped);
 | 
	
		
			
				|  |  |    RETURN_BOOL(result);
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -212,7 +221,8 @@ PHP_METHOD(Timeval, infPast) {
 | 
	
		
			
				|  |  |   * @return void
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  PHP_METHOD(Timeval, sleepUntil) {
 | 
	
		
			
				|  |  | -  wrapped_grpc_timeval *this = Z_WRAPPED_GRPC_TIMEVAL_P(getThis());
 | 
	
		
			
				|  |  | +  wrapped_grpc_timeval *this =
 | 
	
		
			
				|  |  | +    PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, getThis());
 | 
	
		
			
				|  |  |    gpr_sleep_until(this->wrapped);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 |