@@ -431,11 +431,8 @@ static void redis_destructor_redis_sock(zend_resource * rsrc TSRMLS_DC)
431431 redis_free_socket (redis_sock );
432432}
433433
434- /**
435- * redis_sock_get
436- */
437- PHP_REDIS_API int redis_sock_get (zval * id , RedisSock * * redis_sock TSRMLS_DC ,
438- int no_throw )
434+ static zend_always_inline int
435+ redis_sock_get_instance (zval * id , RedisSock * * redis_sock TSRMLS_DC , int no_throw )
439436{
440437 zval * socket ;
441438
@@ -466,6 +463,19 @@ PHP_REDIS_API int redis_sock_get(zval *id, RedisSock **redis_sock TSRMLS_DC,
466463 }
467464 return -1 ;
468465 }
466+ return 0 ;
467+ }
468+
469+ /**
470+ * redis_sock_get
471+ */
472+ PHP_REDIS_API int
473+ redis_sock_get (zval * id , RedisSock * * redis_sock TSRMLS_DC , int no_throw )
474+ {
475+ if (redis_sock_get_instance (id , redis_sock TSRMLS_CC , no_throw ) < 0 ) {
476+ return -1 ;
477+ }
478+
469479 if ((* redis_sock )-> lazy_connect )
470480 {
471481 (* redis_sock )-> lazy_connect = 0 ;
@@ -2670,7 +2680,7 @@ PHP_METHOD(Redis, object)
26702680PHP_METHOD (Redis , getOption ) {
26712681 RedisSock * redis_sock ;
26722682
2673- if (redis_sock_get (getThis (), & redis_sock TSRMLS_CC , 0 ) < 0 ) {
2683+ if (redis_sock_get_instance (getThis (), & redis_sock TSRMLS_CC , 0 ) < 0 ) {
26742684 RETURN_FALSE ;
26752685 }
26762686
@@ -2683,7 +2693,7 @@ PHP_METHOD(Redis, getOption) {
26832693PHP_METHOD (Redis , setOption ) {
26842694 RedisSock * redis_sock ;
26852695
2686- if ( redis_sock_get (getThis (), & redis_sock TSRMLS_CC , 0 )< 0 ) {
2696+ if ( redis_sock_get_instance (getThis (), & redis_sock TSRMLS_CC , 0 ) < 0 ) {
26872697 RETURN_FALSE ;
26882698 }
26892699
0 commit comments