From 0d484172fe7b35beae14ae777c2bda9cf120b55c Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 14 Dec 2017 22:59:58 +0300 Subject: [PATCH] Turn "pdo_stmt_methods" into constants. --- ext/pdo/php_pdo_driver.h | 2 +- ext/pdo_dblib/dblib_stmt.c | 2 +- ext/pdo_dblib/php_pdo_dblib_int.h | 2 +- ext/pdo_firebird/firebird_statement.c | 2 +- ext/pdo_firebird/php_pdo_firebird_int.h | 2 +- ext/pdo_mysql/mysql_statement.c | 2 +- ext/pdo_mysql/php_pdo_mysql_int.h | 2 +- ext/pdo_oci/oci_statement.c | 2 +- ext/pdo_oci/php_pdo_oci_int.h | 2 +- ext/pdo_odbc/odbc_stmt.c | 2 +- ext/pdo_odbc/php_pdo_odbc_int.h | 2 +- ext/pdo_pgsql/pgsql_statement.c | 2 +- ext/pdo_pgsql/php_pdo_pgsql_int.h | 2 +- ext/pdo_sqlite/php_pdo_sqlite_int.h | 2 +- ext/pdo_sqlite/sqlite_statement.c | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index 578f3a3ac1..52c64cda1c 100644 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -563,7 +563,7 @@ struct pdo_bound_param_data { /* represents a prepared statement */ struct _pdo_stmt_t { /* driver specifics */ - struct pdo_stmt_methods *methods; + const struct pdo_stmt_methods *methods; void *driver_data; /* if true, we've already successfully executed this statement at least diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index b4e4372821..dd58207f11 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -554,7 +554,7 @@ static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, zva } -struct pdo_stmt_methods dblib_stmt_methods = { +const struct pdo_stmt_methods dblib_stmt_methods = { pdo_dblib_stmt_dtor, pdo_dblib_stmt_execute, pdo_dblib_stmt_fetch, diff --git a/ext/pdo_dblib/php_pdo_dblib_int.h b/ext/pdo_dblib/php_pdo_dblib_int.h index 91fe464daf..d14bc5c780 100644 --- a/ext/pdo_dblib/php_pdo_dblib_int.h +++ b/ext/pdo_dblib/php_pdo_dblib_int.h @@ -105,7 +105,7 @@ int pdo_dblib_msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, DBUSMALLINT line); extern const pdo_driver_t pdo_dblib_driver; -extern struct pdo_stmt_methods dblib_stmt_methods; +extern const struct pdo_stmt_methods dblib_stmt_methods; typedef struct { int severity; diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 1061785a53..952080688e 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -761,7 +761,7 @@ static int firebird_stmt_cursor_closer(pdo_stmt_t *stmt) /* {{{ */ /* }}} */ -struct pdo_stmt_methods firebird_stmt_methods = { /* {{{ */ +const struct pdo_stmt_methods firebird_stmt_methods = { /* {{{ */ firebird_stmt_dtor, firebird_stmt_execute, firebird_stmt_fetch, diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h index 47bfc18e4b..0ae59358f2 100644 --- a/ext/pdo_firebird/php_pdo_firebird_int.h +++ b/ext/pdo_firebird/php_pdo_firebird_int.h @@ -132,7 +132,7 @@ typedef struct { extern const pdo_driver_t pdo_firebird_driver; -extern struct pdo_stmt_methods firebird_stmt_methods; +extern const struct pdo_stmt_methods firebird_stmt_methods; void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, zend_long line); diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index c390a7575e..5d820ff289 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -923,7 +923,7 @@ static int pdo_mysql_stmt_cursor_closer(pdo_stmt_t *stmt) /* {{{ */ } /* }}} */ -struct pdo_stmt_methods mysql_stmt_methods = { +const struct pdo_stmt_methods mysql_stmt_methods = { pdo_mysql_stmt_dtor, pdo_mysql_stmt_execute, pdo_mysql_stmt_fetch, diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h index 6e7d840d7a..9e0fab3ad8 100644 --- a/ext/pdo_mysql/php_pdo_mysql_int.h +++ b/ext/pdo_mysql/php_pdo_mysql_int.h @@ -155,7 +155,7 @@ extern int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, #define pdo_mysql_error(s) _pdo_mysql_error(s, NULL, __FILE__, __LINE__) #define pdo_mysql_error_stmt(s) _pdo_mysql_error(stmt->dbh, stmt, __FILE__, __LINE__) -extern struct pdo_stmt_methods mysql_stmt_methods; +extern const struct pdo_stmt_methods mysql_stmt_methods; enum { PDO_MYSQL_ATTR_USE_BUFFERED_QUERY = PDO_ATTR_DRIVER_SPECIFIC, diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index 02c8df161c..75ce4f2666 100644 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -795,7 +795,7 @@ static int oci_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, size_t *len } } /* }}} */ -struct pdo_stmt_methods oci_stmt_methods = { +const struct pdo_stmt_methods oci_stmt_methods = { oci_stmt_dtor, oci_stmt_execute, oci_stmt_fetch, diff --git a/ext/pdo_oci/php_pdo_oci_int.h b/ext/pdo_oci/php_pdo_oci_int.h index 88f9458e32..b9be4dc5b7 100644 --- a/ext/pdo_oci/php_pdo_oci_int.h +++ b/ext/pdo_oci/php_pdo_oci_int.h @@ -93,7 +93,7 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor #define oci_drv_error(w) _oci_error(H->err, dbh, NULL, w, H->last_err, FALSE, __FILE__, __LINE__) #define oci_stmt_error(w) _oci_error(S->err, stmt->dbh, stmt, w, S->last_err, FALSE, __FILE__, __LINE__) -extern struct pdo_stmt_methods oci_stmt_methods; +extern const struct pdo_stmt_methods oci_stmt_methods; /* Default prefetch size in number of rows */ #define PDO_OCI_PREFETCH_DEFAULT 100 diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index ec69dd68df..bf5e9fc31a 100644 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -856,7 +856,7 @@ static int odbc_stmt_next_rowset(pdo_stmt_t *stmt) return 1; } -struct pdo_stmt_methods odbc_stmt_methods = { +const struct pdo_stmt_methods odbc_stmt_methods = { odbc_stmt_dtor, odbc_stmt_execute, odbc_stmt_fetch, diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h index a94181fe4a..0eb23b1c80 100644 --- a/ext/pdo_odbc/php_pdo_odbc_int.h +++ b/ext/pdo_odbc/php_pdo_odbc_int.h @@ -165,7 +165,7 @@ typedef struct { } pdo_odbc_param; extern const pdo_driver_t pdo_odbc_driver; -extern struct pdo_stmt_methods odbc_stmt_methods; +extern const struct pdo_stmt_methods odbc_stmt_methods; void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement, char *what, const char *file, int line); #define pdo_odbc_drv_error(what) pdo_odbc_error(dbh, NULL, SQL_NULL_HSTMT, what, __FILE__, __LINE__) diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 783dab2244..63d9ee6b73 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -707,7 +707,7 @@ static int pdo_pgsql_stmt_cursor_closer(pdo_stmt_t *stmt) return 1; } -struct pdo_stmt_methods pgsql_stmt_methods = { +const struct pdo_stmt_methods pgsql_stmt_methods = { pgsql_stmt_dtor, pgsql_stmt_execute, pgsql_stmt_fetch, diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h index 8a0d96420e..d861be005a 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql_int.h +++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h @@ -85,7 +85,7 @@ extern int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const #define pdo_pgsql_error_stmt(s,e,z) _pdo_pgsql_error(s->dbh, s, e, z, NULL, __FILE__, __LINE__) #define pdo_pgsql_error_stmt_msg(s,e,m) _pdo_pgsql_error(s->dbh, s, e, NULL, m, __FILE__, __LINE__) -extern struct pdo_stmt_methods pgsql_stmt_methods; +extern const struct pdo_stmt_methods pgsql_stmt_methods; #define pdo_pgsql_sqlstate(r) PQresultErrorField(r, PG_DIAG_SQLSTATE) diff --git a/ext/pdo_sqlite/php_pdo_sqlite_int.h b/ext/pdo_sqlite/php_pdo_sqlite_int.h index 073c868484..bea82c26d0 100644 --- a/ext/pdo_sqlite/php_pdo_sqlite_int.h +++ b/ext/pdo_sqlite/php_pdo_sqlite_int.h @@ -74,7 +74,7 @@ extern int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, #define pdo_sqlite_error(s) _pdo_sqlite_error(s, NULL, __FILE__, __LINE__) #define pdo_sqlite_error_stmt(s) _pdo_sqlite_error(stmt->dbh, stmt, __FILE__, __LINE__) -extern struct pdo_stmt_methods sqlite_stmt_methods; +extern const struct pdo_stmt_methods sqlite_stmt_methods; enum { PDO_SQLITE_ATTR_OPEN_FLAGS = PDO_ATTR_DRIVER_SPECIFIC, diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index 817e6294db..7d43123ba6 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -352,7 +352,7 @@ static int pdo_sqlite_stmt_cursor_closer(pdo_stmt_t *stmt) return 1; } -struct pdo_stmt_methods sqlite_stmt_methods = { +const struct pdo_stmt_methods sqlite_stmt_methods = { pdo_sqlite_stmt_dtor, pdo_sqlite_stmt_execute, pdo_sqlite_stmt_fetch, -- 2.40.0