Skip to content

Commit 5959dae

Browse files
committed
ext/pgsql: Stop using useless convert_to_boolean() API
There are better ways of handling this than casting the zval in place
1 parent c789e9c commit 5959dae

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ext/pgsql/pgsql.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3879,16 +3879,18 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
38793879
switch(entry_type) {
38803880
case PHP_PG_ASYNC_IS_BUSY:
38813881
PQconsumeInput(pgsql);
3882-
RETVAL_LONG(PQisBusy(pgsql));
3882+
RETVAL_BOOL(PQisBusy(pgsql));
38833883
break;
38843884
case PHP_PG_ASYNC_REQUEST_CANCEL: {
38853885
PGcancel *c;
38863886
char err[256];
38873887
int rc;
38883888

38893889
c = PQgetCancel(pgsql);
3890-
RETVAL_LONG((rc = PQcancel(c, err, sizeof(err))));
3890+
rc = PQcancel(c, err, sizeof(err);
3891+
RETVAL_BOOL(rc);
38913892
if (rc < 0) {
3893+
RETVAL_FALSE;
38923894
zend_error(E_WARNING, "cannot cancel the query: %s", err);
38933895
}
38943896
while ((pgsql_result = PQgetResult(pgsql))) {
@@ -3902,7 +3904,6 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
39023904
if (PQsetnonblocking(pgsql, 0)) {
39033905
php_error_docref(NULL, E_NOTICE, "Cannot set connection to blocking mode");
39043906
}
3905-
convert_to_boolean(return_value);
39063907
}
39073908
/* }}} */
39083909

@@ -4923,8 +4924,7 @@ PHP_PGSQL_API zend_result php_pgsql_convert(PGconn *pg_link, const zend_string *
49234924
break; /* break out for() */
49244925
}
49254926

4926-
convert_to_boolean(is_enum);
4927-
if (Z_TYPE_P(is_enum) == IS_TRUE) {
4927+
if (zval_is_true(is_enum)) {
49284928
/* enums need to be treated like strings */
49294929
data_type = PG_TEXT;
49304930
} else {

0 commit comments

Comments
 (0)