From 85d42a9baa5dcdcd1826dfe801df3ba89f9e0f72 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 14 Jul 2014 13:28:47 +0200 Subject: [PATCH] use php_pq_callback_recurse --- src/php_pqconn.c | 12 ++---------- src/php_pqstm.c | 12 ++---------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/php_pqconn.c b/src/php_pqconn.c index a1492f0..66b5d9f 100644 --- a/src/php_pqconn.c +++ b/src/php_pqconn.c @@ -906,12 +906,8 @@ static PHP_METHOD(pqconn, execAsync) { } else if (obj->intern->unbuffered && !PQsetSingleRowMode(obj->intern->conn)) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to enable unbuffered mode (%s)", PHP_PQerrorMessage(obj->intern->conn)); } else { + php_pq_callback_recurse(&obj->intern->onevent, &resolver TSRMLS_CC); obj->intern->poller = PQconsumeInput; - php_pq_callback_dtor(&obj->intern->onevent); - if (resolver.fci.size > 0) { - obj->intern->onevent = resolver; - php_pq_callback_addref(&obj->intern->onevent); - } php_pqconn_notify_listeners(obj TSRMLS_CC); } } @@ -999,12 +995,8 @@ static PHP_METHOD(pqconn, execParamsAsync) { } else if (obj->intern->unbuffered && !PQsetSingleRowMode(obj->intern->conn)) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to enable unbuffered mode (%s)", PHP_PQerrorMessage(obj->intern->conn)); } else { + php_pq_callback_recurse(&obj->intern->onevent, &resolver TSRMLS_CC); obj->intern->poller = PQconsumeInput; - php_pq_callback_dtor(&obj->intern->onevent); - if (resolver.fci.size > 0) { - obj->intern->onevent = resolver; - php_pq_callback_addref(&obj->intern->onevent); - } php_pqconn_notify_listeners(obj TSRMLS_CC); } } diff --git a/src/php_pqstm.c b/src/php_pqstm.c index 6be580c..d9ec1ea 100644 --- a/src/php_pqstm.c +++ b/src/php_pqstm.c @@ -244,11 +244,7 @@ static PHP_METHOD(pqstm, execAsync) { } else if (obj->intern->conn->intern->unbuffered && !PQsetSingleRowMode(obj->intern->conn->intern->conn)) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to enable unbuffered mode (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { - php_pq_callback_dtor(&obj->intern->conn->intern->onevent); - if (resolver.fci.size > 0) { - obj->intern->conn->intern->onevent = resolver; - php_pq_callback_addref(&obj->intern->conn->intern->onevent); - } + php_pq_callback_recurse(&obj->intern->conn->intern->onevent, &resolver TSRMLS_CC); obj->intern->conn->intern->poller = PQconsumeInput; } @@ -313,11 +309,7 @@ static PHP_METHOD(pqstm, descAsync) { } else if (!PQsendDescribePrepared(obj->intern->conn->intern->conn, obj->intern->name)) { throw_exce(EX_IO TSRMLS_CC, "Failed to describe statement: %s", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { - php_pq_callback_dtor(&obj->intern->conn->intern->onevent); - if (resolver.fci.size > 0) { - obj->intern->conn->intern->onevent = resolver; - php_pq_callback_addref(&obj->intern->conn->intern->onevent); - } + php_pq_callback_recurse(&obj->intern->conn->intern->onevent, &resolver TSRMLS_CC); obj->intern->conn->intern->poller = PQconsumeInput; php_pqconn_notify_listeners(obj->intern->conn TSRMLS_CC); } -- 2.30.2