Skip to content

Commit 13693aa

Browse files
committed
Use ZEND_ASSERT() instead of plain assert()
1 parent 6569aed commit 13693aa

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

ext/pgsql/pgsql.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4520,8 +4520,7 @@ static int php_pgsql_add_quotes(zval *src, bool should_free)
45204520
{
45214521
smart_str str = {0};
45224522

4523-
assert(Z_TYPE_P(src) == IS_STRING);
4524-
assert(should_free == 1 || should_free == 0);
4523+
ZEND_ASSERT(Z_TYPE_P(src) == IS_STRING);
45254524

45264525
smart_str_appendc(&str, 'E');
45274526
smart_str_appendc(&str, '\'');
@@ -5315,9 +5314,9 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
53155314
int ret = FAILURE;
53165315
zend_string *fld;
53175316

5318-
assert(pg_link != NULL);
5319-
assert(table != NULL);
5320-
assert(Z_TYPE_P(var_array) == IS_ARRAY);
5317+
ZEND_ASSERT(pg_link != NULL);
5318+
ZEND_ASSERT(table != NULL);
5319+
ZEND_ASSERT(Z_TYPE_P(var_array) == IS_ARRAY);
53215320

53225321
ZVAL_UNDEF(&converted);
53235322
if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0) {
@@ -5578,11 +5577,11 @@ PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var
55785577
smart_str querystr = {0};
55795578
int ret = FAILURE;
55805579

5581-
assert(pg_link != NULL);
5582-
assert(table != NULL);
5583-
assert(Z_TYPE_P(var_array) == IS_ARRAY);
5584-
assert(Z_TYPE_P(ids_array) == IS_ARRAY);
5585-
assert(!(opt & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)));
5580+
ZEND_ASSERT(pg_link != NULL);
5581+
ZEND_ASSERT(table != NULL);
5582+
ZEND_ASSERT(Z_TYPE_P(var_array) == IS_ARRAY);
5583+
ZEND_ASSERT(Z_TYPE_P(ids_array) == IS_ARRAY);
5584+
ZEND_ASSERT(!(opt & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)));
55865585

55875586
if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0
55885587
|| zend_hash_num_elements(Z_ARRVAL_P(ids_array)) == 0) {
@@ -5688,10 +5687,10 @@ PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids
56885687
smart_str querystr = {0};
56895688
int ret = FAILURE;
56905689

5691-
assert(pg_link != NULL);
5692-
assert(table != NULL);
5693-
assert(Z_TYPE_P(ids_array) == IS_ARRAY);
5694-
assert(!(opt & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_EXEC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)));
5690+
ZEND_ASSERT(pg_link != NULL);
5691+
ZEND_ASSERT(table != NULL);
5692+
ZEND_ASSERT(Z_TYPE_P(ids_array) == IS_ARRAY);
5693+
ZEND_ASSERT(!(opt & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_EXEC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)));
56955694

56965695
if (zend_hash_num_elements(Z_ARRVAL_P(ids_array)) == 0) {
56975696
return FAILURE;
@@ -5785,7 +5784,8 @@ PHP_PGSQL_API void php_pgsql_result2array(PGresult *pg_result, zval *ret_array,
57855784
size_t num_fields;
57865785
int pg_numrows, pg_row;
57875786
uint32_t i;
5788-
assert(Z_TYPE_P(ret_array) == IS_ARRAY);
5787+
5788+
ZEND_ASSERT(Z_TYPE_P(ret_array) == IS_ARRAY);
57895789

57905790
pg_numrows = PQntuples(pg_result);
57915791
for (pg_row = 0; pg_row < pg_numrows; pg_row++) {
@@ -5825,11 +5825,11 @@ PHP_PGSQL_API void php_pgsql_result2array(PGresult *pg_result, zval *ret_array,
58255825
int ret = FAILURE;
58265826
PGresult *pg_result;
58275827

5828-
assert(pg_link != NULL);
5829-
assert(table != NULL);
5830-
assert(Z_TYPE_P(ids_array) == IS_ARRAY);
5831-
assert(Z_TYPE_P(ret_array) == IS_ARRAY);
5832-
assert(!(opt & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)));
5828+
ZEND_ASSERT(pg_link != NULL);
5829+
ZEND_ASSERT(table != NULL);
5830+
ZEND_ASSERT(Z_TYPE_P(ids_array) == IS_ARRAY);
5831+
ZEND_ASSERT(Z_TYPE_P(ret_array) == IS_ARRAY);
5832+
ZEND_ASSERT(!(opt & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)));
58335833

58345834
if (zend_hash_num_elements(Z_ARRVAL_P(ids_array)) == 0) {
58355835
return FAILURE;

0 commit comments

Comments
 (0)