summaryrefslogtreecommitdiff
path: root/ext/gmp/php_gmp.h
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2003-11-19 04:44:06 +0000
committerfoobar <sniper@php.net>2003-11-19 04:44:06 +0000
commit56ca2bb6c18d92158ddbcb5e99d0c76da4625dbd (patch)
treee6367f5fb98233b953a1278665d7428cf070ad31 /ext/gmp/php_gmp.h
parent55b83c36e333d08f621874f65bc1d1f495285b54 (diff)
downloadphp-git-56ca2bb6c18d92158ddbcb5e99d0c76da4625dbd.tar.gz
- Fixed bug #26267 (gmp_random() leaks memory and does not produce random numbers)
# ..and mpz_random() is obsolete according to the GNU MP manual.
Diffstat (limited to 'ext/gmp/php_gmp.h')
-rw-r--r--ext/gmp/php_gmp.h23
1 files changed, 6 insertions, 17 deletions
diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h
index ae0a4621c5..13efbaf566 100644
--- a/ext/gmp/php_gmp.h
+++ b/ext/gmp/php_gmp.h
@@ -19,11 +19,10 @@
#ifndef PHP_GMP_H
#define PHP_GMP_H
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
#if HAVE_GMP
+#include <gmp.h>
+
extern zend_module_entry gmp_module_entry;
#define phpext_gmp_ptr &gmp_module_entry
@@ -35,6 +34,7 @@ extern zend_module_entry gmp_module_entry;
ZEND_MODULE_STARTUP_D(gmp);
ZEND_MODULE_SHUTDOWN_D(gmp);
+ZEND_MODULE_DEACTIVATE_D(gmp);
ZEND_MODULE_INFO_D(gmp);
ZEND_FUNCTION(gmp_init);
@@ -76,24 +76,13 @@ ZEND_FUNCTION(gmp_scan1);
ZEND_FUNCTION(gmp_popcount);
ZEND_FUNCTION(gmp_hamdist);
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
ZEND_BEGIN_MODULE_GLOBALS(gmp)
- int global_variable;
+ zend_bool rand_initialized;
+ gmp_randstate_t rand_state;
ZEND_END_MODULE_GLOBALS(gmp)
-*/
-
-/* In every function that needs to use variables in php_gmp_globals,
- do call GMPLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as GMPG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
#ifdef ZTS
-#define GMPG(v) TSRMG(gmp_globals_id, php_gmp_globals *, v)
+#define GMPG(v) TSRMG(gmp_globals_id, zend_gmp_globals *, v)
#else
#define GMPG(v) (gmp_globals.v)
#endif