cvs: php4 /ext/mcrypt mcrypt.c
| From: | Sterling Hughes | Date: | Fri, 07 Sep 2001 10:29:08 +0000 |
| Subject: | cvs: php4 /ext/mcrypt mcrypt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-7277@lists.php.net to get a copy of this message | ||
sterling Fri Sep 7 06:29:08 2001 EDT
Modified files:
/php4/ext/mcrypt mcrypt.c
Log:
get rid of global mess
Index: php4/ext/mcrypt/mcrypt.c
diff -u php4/ext/mcrypt/mcrypt.c:1.59 php4/ext/mcrypt/mcrypt.c:1.60
--- php4/ext/mcrypt/mcrypt.c:1.59 Fri Sep 7 06:25:26 2001
+++ php4/ext/mcrypt/mcrypt.c Fri Sep 7 06:29:06 2001
@@ -35,6 +35,8 @@
#include "php_globals.h"
#include "ext/standard/info.h"
+static int le_mcrypt;
+
function_entry mcrypt_functions[] = {
PHP_FE(mcrypt_ecb, NULL)
@@ -196,7 +198,7 @@
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &mcryptind) == FAILURE) { \
WRONG_PARAM_COUNT \
} \
- ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
+ ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
#define MCRYPT_GET_MODE_DIR_ARGS(DIRECTORY) \
switch (argc) { \
@@ -258,7 +260,7 @@
Z_TYPE(mcrypt_module_entry) = type;
#endif
- MCG(le_h) = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt",
module_number);
+ le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt",
module_number);
/* modes for mcrypt_??? routines */
REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT);
@@ -437,7 +439,7 @@
php_error (E_WARNING, "could not open encryption module");
RETURN_FALSE;
} else {
- ZEND_REGISTER_RESOURCE (return_value, td, MCG(le_h));
+ ZEND_REGISTER_RESOURCE (return_value, td, le_mcrypt);
}
}
/* }}} */
@@ -459,7 +461,7 @@
MCRYPT_CHECK_PARAM_COUNT (3,3)
zend_get_parameters_ex(3, &mcryptind, &key, &iv);
- ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
+ ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
convert_to_string_ex (key);
convert_to_string_ex (iv);
@@ -515,7 +517,7 @@
MCRYPT_CHECK_PARAM_COUNT (2,2)
zend_get_parameters_ex(2, &mcryptind, &data);
- ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
+ ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
convert_to_string_ex (data);
/* Check blocksize */
@@ -555,7 +557,7 @@
MCRYPT_CHECK_PARAM_COUNT (2,2)
zend_get_parameters_ex(2, &mcryptind, &data);
- ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
+ ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
convert_to_string_ex (data);
/* Check blocksize */
@@ -630,13 +632,8 @@
MCRYPT_GET_TD_ARG
- if (mcrypt_module_close (td) < 0) {
- php_error (E_WARNING, "could not close module");
- RETURN_FALSE
- } else {
- zend_list_delete (Z_LVAL_PP(mcryptind));
- RETURN_TRUE
- }
+ zend_list_delete (Z_LVAL_PP(mcryptind));
+ RETURN_TRUE;
}