projects
/
m6w6
/
ext-pq
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
fix ZTS
[m6w6/ext-pq]
/
src
/
php_pqconn.c
diff --git
a/src/php_pqconn.c
b/src/php_pqconn.c
index e869d92acd9000ac7f8a2c10561cc96ceb2bca7d..b65023ce9fea366e7109aa2320b5531544176c61 100644
(file)
--- a/
src/php_pqconn.c
+++ b/
src/php_pqconn.c
@@
-573,7
+573,7
@@
static inline PGresult *unlisten(PGconn *conn, const char *channel_str, size_t c
static int apply_unlisten(void *p TSRMLS_DC, int argc, va_list argv, zend_hash_key *key)
{
php_pqconn_object_t *obj = va_arg(argv, php_pqconn_object_t *);
static int apply_unlisten(void *p TSRMLS_DC, int argc, va_list argv, zend_hash_key *key)
{
php_pqconn_object_t *obj = va_arg(argv, php_pqconn_object_t *);
- PGresult *res = unlisten(obj->intern->conn, key->arKey, key->nKeyLength - 1);
+ PGresult *res = unlisten(obj->intern->conn, key->arKey, key->nKeyLength - 1
TSRMLS_CC
);
if (res) {
PHP_PQclear(res);
if (res) {
PHP_PQclear(res);
@@
-758,7
+758,7
@@
static PHP_METHOD(pqconn, unlisten)
if (!obj->intern) {
throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
} else if (SUCCESS == zend_hash_del(&obj->intern->listeners, channel_str, channel_len + 1)) {
if (!obj->intern) {
throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
} else if (SUCCESS == zend_hash_del(&obj->intern->listeners, channel_str, channel_len + 1)) {
- PGresult *res = unlisten(obj->intern->conn, channel_str, channel_len);
+ PGresult *res = unlisten(obj->intern->conn, channel_str, channel_len
TSRMLS_CC
);
if (res) {
php_pqres_success(res TSRMLS_CC);
if (res) {
php_pqres_success(res TSRMLS_CC);
@@
-1830,20
+1830,25
@@
static PHP_METHOD(pqconn, on) {
}
}
}
}
-static int apply_set_converter(void *p TSRMLS_DC, int argc, va_list argv, zend_hash_key *key)
+struct apply_set_converter_arg {
+ HashTable *ht;
+ zval **zconv;
+ unsigned add:1;
+};
+
+static int apply_set_converter(void *p, void *a TSRMLS_DC)
{
{
- zval *tmp, **zoid = p, **zcnv = va_arg(argv, zval **);
- HashTable *converters = va_arg(argv, HashTable *);
- int add = va_arg(argv, int);
+ zval *tmp, **zoid = p;
+ struct apply_set_converter_arg *arg = a;
tmp = *zoid;
Z_ADDREF_P(tmp);
convert_to_long_ex(&tmp);
tmp = *zoid;
Z_ADDREF_P(tmp);
convert_to_long_ex(&tmp);
- if (add) {
- Z_ADDREF_PP(
zc
nv);
- zend_hash_index_update(
converters, Z_LVAL_P(tmp), zc
nv, sizeof(zval *), NULL);
+ if (a
rg->a
dd) {
+ Z_ADDREF_PP(
arg->zco
nv);
+ zend_hash_index_update(
arg->ht, Z_LVAL_P(tmp), arg->zco
nv, sizeof(zval *), NULL);
} else {
} else {
- zend_hash_index_del(
converters
, Z_LVAL_P(tmp));
+ zend_hash_index_del(
arg->ht
, Z_LVAL_P(tmp));
}
zval_ptr_dtor(&tmp);
}
zval_ptr_dtor(&tmp);
@@
-1851,7
+1856,7
@@
static int apply_set_converter(void *p TSRMLS_DC, int argc, va_list argv, zend_h
}
ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_set_converter, 0, 0, 1)
}
ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_set_converter, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, converter, pq\\Converter
Interface
, 0)
+ ZEND_ARG_OBJ_INFO(0, converter, pq\\Converter, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(pqconn, setConverter) {
STATUS rv;
ZEND_END_ARG_INFO();
static PHP_METHOD(pqconn, setConverter) {
STATUS rv;
@@
-1869,12
+1874,19
@@
static PHP_METHOD(pqconn, setConverter) {
throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
} else {
zval *tmp, *zoids = NULL;
throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
} else {
zval *tmp, *zoids = NULL;
+ struct apply_set_converter_arg arg = {NULL};
zend_call_method_with_0_params(&zcnv, NULL, NULL, "converttypes", &zoids);
tmp = zoids;
Z_ADDREF_P(tmp);
convert_to_array_ex(&tmp);
zend_call_method_with_0_params(&zcnv, NULL, NULL, "converttypes", &zoids);
tmp = zoids;
Z_ADDREF_P(tmp);
convert_to_array_ex(&tmp);
- zend_hash_apply_with_arguments(Z_ARRVAL_P(tmp) TSRMLS_CC, apply_set_converter, 3, &zcnv, &obj->intern->converters, 1);
+
+ arg.ht = &obj->intern->converters;
+ arg.zconv = &zcnv;
+ arg.add = 1;
+
+ zend_hash_apply_with_argument(Z_ARRVAL_P(tmp), apply_set_converter, &arg TSRMLS_CC);
+
zval_ptr_dtor(&tmp);
zval_ptr_dtor(&zoids);
}
zval_ptr_dtor(&tmp);
zval_ptr_dtor(&zoids);
}
@@
-1882,7
+1894,7
@@
static PHP_METHOD(pqconn, setConverter) {
}
ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_unset_converter, 0, 0, 1)
}
ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_unset_converter, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, converter, pq\\Converter
Interface
, 0)
+ ZEND_ARG_OBJ_INFO(0, converter, pq\\Converter, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(pqconn, unsetConverter) {
STATUS rv;
ZEND_END_ARG_INFO();
static PHP_METHOD(pqconn, unsetConverter) {
STATUS rv;
@@
-1900,12
+1912,19
@@
static PHP_METHOD(pqconn, unsetConverter) {
throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
} else {
zval *tmp, *zoids = NULL;
throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Connection not initialized");
} else {
zval *tmp, *zoids = NULL;
+ struct apply_set_converter_arg arg = {NULL};
zend_call_method_with_0_params(&zcnv, NULL, NULL, "converttypes", &zoids);
tmp = zoids;
Z_ADDREF_P(tmp);
convert_to_array_ex(&tmp);
zend_call_method_with_0_params(&zcnv, NULL, NULL, "converttypes", &zoids);
tmp = zoids;
Z_ADDREF_P(tmp);
convert_to_array_ex(&tmp);
- zend_hash_apply_with_arguments(Z_ARRVAL_P(tmp) TSRMLS_CC, apply_set_converter, 3, &zcnv, &obj->intern->converters, 0);
+
+ arg.ht = &obj->intern->converters;
+ arg.zconv = &zcnv;
+ arg.add = 0;
+
+ zend_hash_apply_with_argument(Z_ARRVAL_P(tmp), apply_set_converter, &arg TSRMLS_CC);
+
zval_ptr_dtor(&tmp);
zval_ptr_dtor(&zoids);
}
zval_ptr_dtor(&tmp);
zval_ptr_dtor(&zoids);
}
@@
-1970,7
+1989,7
@@
PHP_MINIT_FUNCTION(pqconn)
php_pqconn_object_handlers.get_properties = php_pq_object_properties;
php_pqconn_object_handlers.get_debug_info = php_pq_object_debug_info;
php_pqconn_object_handlers.get_properties = php_pq_object_properties;
php_pqconn_object_handlers.get_debug_info = php_pq_object_debug_info;
- zend_hash_init(&php_pqconn_object_prophandlers, 1
4
, NULL, NULL, 1);
+ zend_hash_init(&php_pqconn_object_prophandlers, 1
9
, NULL, NULL, 1);
zend_declare_property_long(php_pqconn_class_entry, ZEND_STRL("status"), CONNECTION_BAD, ZEND_ACC_PUBLIC TSRMLS_CC);
ph.read = php_pqconn_object_read_status;
zend_declare_property_long(php_pqconn_class_entry, ZEND_STRL("status"), CONNECTION_BAD, ZEND_ACC_PUBLIC TSRMLS_CC);
ph.read = php_pqconn_object_read_status;