cvs: php4 /ext/msession msession.c
| From: | Mark L. Woodward | Date: | Tue, 05 Feb 2002 20:02:34 +0000 |
| Subject: | cvs: php4 /ext/msession msession.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9286@lists.php.net to get a copy of this message | ||
mlwmohawk Tue Feb 5 15:02:34 2002 EDT
Modified files:
/php4/ext/msession msession.c
Log:
Sorry guys, PHP 4.0.6's ZEND_MODULE_API_NO is whacked, it has an extra
zero, thus ZEND_MODULE_API_NO >= xxxx, will not work for about 18000 years.
Added better checking, and cleaned up some of the #ifdef you seem to love
so much.
Index: php4/ext/msession/msession.c
diff -u php4/ext/msession/msession.c:1.23 php4/ext/msession/msession.c:1.24
--- php4/ext/msession/msession.c:1.23 Tue Feb 5 12:00:27 2002
+++ php4/ext/msession/msession.c Tue Feb 5 15:02:33 2002
@@ -46,6 +46,20 @@
/* Uncomment to get debugging messages */
/* #define ERR_DEBUG */
+/* Zend version number is out of whack in 4.0.6 */
+/* Numerical <> do not seem to work, older released version is greater than current */
+/* This sets the PHP API version used in the file. */
+/* If this module does not compile on the version of PHP you are using, look for */
+/* this value in Zend/zend_modules.h, and set appropriately */
+
+#if (ZEND_MODULE_API_NO == 20001222)
+#define PHP_4_0_API
+#define TSRMLS_CC
+#define TSRMLS_FETCH()
+#elif (ZEND_MODULE_API_NO >= 20010901)
+#define PHP_4_1_API
+#endif
+
/*
* Please do not remove backward compatibility from this module.
* this same source must also work with 4.0 versions of PHP.
@@ -107,7 +121,7 @@
};
zend_module_entry msession_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
+#ifdef PHP_4_1_API
STANDARD_MODULE_HEADER,
#endif
"msession",
@@ -117,7 +131,7 @@
PHP_RINIT(msession),
PHP_RSHUTDOWN(msession),
PHP_MINFO(msession),
-#if ZEND_MODULE_API_NO >= 20010901
+#ifdef PHP_4_1_API
NO_VERSION_YET,
#endif
STANDARD_MODULE_PROPERTIES
@@ -174,9 +188,7 @@
int PHPMsessionConnect(const char *szhost, int nport)
{
-#if ZEND_MODULE_API_NO >= 20010901
TSRMLS_FETCH();
-#endif
if(!s_reqb)
s_reqb = AllocateRequestBuffer(2048);
@@ -187,11 +199,7 @@
if(s_conn)
{
CloseReqConn(s_conn);
-#ifdef ZEND_MODULE_API_NO >= 20010901
php_log_err("Call to connect with non-null s_conn" TSRMLS_CC);
-#else
- php_log_err("Call to connect with non-null s_conn");
-#endif
}
if(strcmp(s_szhost, szhost))
{
@@ -739,9 +747,10 @@
HashPosition pos;
zval **entry;
char *key;
-#if ZEND_MODULE_API_NO >= 20010901
+#ifdef PHP_4_1_API
uint keylen;
-#else
+#endif
+#ifdef PHP_4_0_API
ulong keylen;
#endif
ulong numndx;