Skip to content

Commit c66dde1

Browse files
committed
ext/sqlite3: compare php_sqlite3_stmt pointers consistently.
The comparator and all call sites now use php_sqlite3_stmt pointers, matching the type stored in the free list.
1 parent 18d287e commit c66dde1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ext/sqlite3/sqlite3.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ZEND_DECLARE_MODULE_GLOBALS(sqlite3)
3838
static PHP_GINIT_FUNCTION(sqlite3);
3939
static int php_sqlite3_authorizer(void *autharg, int action, const char *arg1, const char *arg2, const char *arg3, const char *arg4);
4040
static void sqlite3_param_dtor(zval *data);
41-
static int php_sqlite3_compare_stmt_free(php_sqlite3_stmt **stmt_obj_ptr, sqlite3_stmt *statement);
41+
static int php_sqlite3_compare_stmt_free(php_sqlite3_stmt **stmt_obj_ptr, php_sqlite3_stmt *statement);
4242
static zend_always_inline void php_sqlite3_fetch_one(int n_cols, php_sqlite3_result *result_obj, zend_long mode, zval *result);
4343

4444
#define SQLITE3_CHECK_INITIALIZED(db_obj, member, class_name) \
@@ -1415,7 +1415,7 @@ PHP_METHOD(SQLite3Stmt, close)
14151415

14161416
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
14171417

1418-
zend_llist_del_element(&(stmt_obj->db_obj->free_list), stmt_obj->stmt, (int (*)(void *, void *)) php_sqlite3_compare_stmt_free);
1418+
zend_llist_del_element(&(stmt_obj->db_obj->free_list), stmt_obj, (int (*)(void *, void *)) php_sqlite3_compare_stmt_free);
14191419

14201420
RETURN_TRUE;
14211421
}
@@ -2145,7 +2145,7 @@ PHP_METHOD(SQLite3Result, finalize)
21452145

21462146
/* We need to finalize an internal statement */
21472147
if (!result_obj->is_prepared_statement) {
2148-
zend_llist_del_element(&(result_obj->db_obj->free_list), result_obj->stmt_obj->stmt,
2148+
zend_llist_del_element(&(result_obj->db_obj->free_list), result_obj->stmt_obj,
21492149
(int (*)(void *, void *)) php_sqlite3_compare_stmt_free);
21502150
} else {
21512151
sqlite3_reset(result_obj->stmt_obj->stmt);
@@ -2260,9 +2260,9 @@ static void php_sqlite3_free_list_dtor(void **item)
22602260
}
22612261
/* }}} */
22622262

2263-
static int php_sqlite3_compare_stmt_free(php_sqlite3_stmt **stmt_obj_ptr, sqlite3_stmt *statement ) /* {{{ */
2263+
static int php_sqlite3_compare_stmt_free(php_sqlite3_stmt **stmt_obj_ptr, php_sqlite3_stmt *statement ) /* {{{ */
22642264
{
2265-
return ((*stmt_obj_ptr)->initialised && statement == (*stmt_obj_ptr)->stmt);
2265+
return ((*stmt_obj_ptr)->initialised && statement == *stmt_obj_ptr);
22662266
}
22672267
/* }}} */
22682268

@@ -2376,7 +2376,7 @@ static void php_sqlite3_stmt_object_free_storage(zend_object *object) /* {{{ */
23762376
}
23772377

23782378
if (intern->initialised) {
2379-
zend_llist_del_element(&(intern->db_obj->free_list), intern->stmt,
2379+
zend_llist_del_element(&(intern->db_obj->free_list), intern,
23802380
(int (*)(void *, void *)) php_sqlite3_compare_stmt_free);
23812381
}
23822382

0 commit comments

Comments
 (0)