summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/pdo_mysql.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_mysql/pdo_mysql.c')
-rw-r--r--ext/pdo_mysql/pdo_mysql.c44
1 files changed, 13 insertions, 31 deletions
diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c
index 54e1c931ce..84828edaa4 100644
--- a/ext/pdo_mysql/pdo_mysql.c
+++ b/ext/pdo_mysql/pdo_mysql.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -50,7 +48,7 @@ ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql)
# ifdef PHP_MYSQL_UNIX_SOCK_ADDR
# define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
# else
-# if !PHP_WIN32
+# ifndef PHP_WIN32
# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock"
# else
# define PDO_MYSQL_UNIX_ADDR NULL
@@ -65,10 +63,7 @@ static MYSQLND * pdo_mysql_convert_zv_to_mysqlnd(zval * zv)
if (Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), php_pdo_get_dbh_ce())) {
pdo_dbh_t * dbh = Z_PDO_DBH_P(zv);
- if (!dbh) {
- php_error_docref(NULL, E_WARNING, "Failed to retrieve handle from object store");
- return NULL;
- }
+ ZEND_ASSERT(dbh);
if (dbh->driver != &pdo_mysql_driver) {
php_error_docref(NULL, E_WARNING, "Provided PDO instance is not using MySQL but %s", dbh->driver->driver_name);
@@ -87,8 +82,7 @@ static const MYSQLND_REVERSE_API pdo_mysql_reverse_api = {
#endif
-/* {{{ PHP_INI_BEGIN
-*/
+/* {{{ PHP_INI_BEGIN */
PHP_INI_BEGIN()
#ifndef PHP_WIN32
STD_PHP_INI_ENTRY("pdo_mysql.default_socket", PDO_MYSQL_UNIX_ADDR, PHP_INI_SYSTEM, OnUpdateStringUnempty, default_socket, zend_pdo_mysql_globals, pdo_mysql_globals)
@@ -101,8 +95,7 @@ PHP_INI_END()
/* true global environment */
-/* {{{ PHP_MINIT_FUNCTION
- */
+/* {{{ PHP_MINIT_FUNCTION */
static PHP_MINIT_FUNCTION(pdo_mysql)
{
REGISTER_INI_ENTRIES();
@@ -140,12 +133,11 @@ static PHP_MINIT_FUNCTION(pdo_mysql)
}
/* }}} */
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
+/* {{{ PHP_MSHUTDOWN_FUNCTION */
static PHP_MSHUTDOWN_FUNCTION(pdo_mysql)
{
php_pdo_unregister_driver(&pdo_mysql_driver);
-#if PDO_USE_MYSQLND
+#ifdef PDO_USE_MYSQLND
UNREGISTER_INI_ENTRIES();
#endif
@@ -153,8 +145,7 @@ static PHP_MSHUTDOWN_FUNCTION(pdo_mysql)
}
/* }}} */
-/* {{{ PHP_MINFO_FUNCTION
- */
+/* {{{ PHP_MINFO_FUNCTION */
static PHP_MINFO_FUNCTION(pdo_mysql)
{
php_info_print_table_start();
@@ -171,9 +162,8 @@ static PHP_MINFO_FUNCTION(pdo_mysql)
/* }}} */
-#if PDO_USE_MYSQLND && PDO_DBG_ENABLED
-/* {{{ PHP_RINIT_FUNCTION
- */
+#if defined(PDO_USE_MYSQLND) && PDO_DBG_ENABLED
+/* {{{ PHP_RINIT_FUNCTION */
static PHP_RINIT_FUNCTION(pdo_mysql)
{
if (PDO_MYSQL_G(debug)) {
@@ -189,8 +179,7 @@ static PHP_RINIT_FUNCTION(pdo_mysql)
}
/* }}} */
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
+/* {{{ PHP_RSHUTDOWN_FUNCTION */
static PHP_RSHUTDOWN_FUNCTION(pdo_mysql)
{
MYSQLND_DEBUG *dbg = PDO_MYSQL_G(dbg);
@@ -206,8 +195,7 @@ static PHP_RSHUTDOWN_FUNCTION(pdo_mysql)
/* }}} */
#endif
-/* {{{ PHP_GINIT_FUNCTION
- */
+/* {{{ PHP_GINIT_FUNCTION */
static PHP_GINIT_FUNCTION(pdo_mysql)
{
#if defined(COMPILE_DL_PDO_MYSQL) && defined(ZTS)
@@ -223,12 +211,6 @@ ZEND_TSRMLS_CACHE_UPDATE();
}
/* }}} */
-/* {{{ pdo_mysql_functions[] */
-static const zend_function_entry pdo_mysql_functions[] = {
- PHP_FE_END
-};
-/* }}} */
-
/* {{{ pdo_mysql_deps[] */
static const zend_module_dep pdo_mysql_deps[] = {
ZEND_MOD_REQUIRED("pdo")
@@ -244,10 +226,10 @@ zend_module_entry pdo_mysql_module_entry = {
STANDARD_MODULE_HEADER_EX, NULL,
pdo_mysql_deps,
"pdo_mysql",
- pdo_mysql_functions,
+ NULL,
PHP_MINIT(pdo_mysql),
PHP_MSHUTDOWN(pdo_mysql),
-#if PDO_USE_MYSQLND && PDO_DBG_ENABLED
+#if defined(PDO_USE_MYSQLND) && PDO_DBG_ENABLED
PHP_RINIT(pdo_mysql),
PHP_RSHUTDOWN(pdo_mysql),
#else