@@ -431,11 +431,8 @@ static void redis_destructor_redis_sock(zend_resource * rsrc TSRMLS_DC)
431
431
redis_free_socket (redis_sock );
432
432
}
433
433
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 )
439
436
{
440
437
zval * socket ;
441
438
@@ -466,6 +463,19 @@ PHP_REDIS_API int redis_sock_get(zval *id, RedisSock **redis_sock TSRMLS_DC,
466
463
}
467
464
return -1 ;
468
465
}
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
+
469
479
if ((* redis_sock )-> lazy_connect )
470
480
{
471
481
(* redis_sock )-> lazy_connect = 0 ;
@@ -2670,7 +2680,7 @@ PHP_METHOD(Redis, object)
2670
2680
PHP_METHOD (Redis , getOption ) {
2671
2681
RedisSock * redis_sock ;
2672
2682
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 ) {
2674
2684
RETURN_FALSE ;
2675
2685
}
2676
2686
@@ -2683,7 +2693,7 @@ PHP_METHOD(Redis, getOption) {
2683
2693
PHP_METHOD (Redis , setOption ) {
2684
2694
RedisSock * redis_sock ;
2685
2695
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 ) {
2687
2697
RETURN_FALSE ;
2688
2698
}
2689
2699
0 commit comments