summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorKalle Sommer Nielsen <kalle@php.net>2010-10-01 09:18:44 +0000
committerKalle Sommer Nielsen <kalle@php.net>2010-10-01 09:18:44 +0000
commitd252a45e82bcdf624cd4f42e946c57f0e9c8a30c (patch)
treeda142845440761c6820431bb4d34c9c103e4ca0a /ext/standard
parent1781aec59fc012cd3596c94f156b1d1a5b18f0b6 (diff)
downloadphp-git-d252a45e82bcdf624cd4f42e946c57f0e9c8a30c.tar.gz
* Added PHP_RAND_MAX and PHP_MT_RAND_MAX constants
* Deprecated getrandmax() and mt_getrandmax() in favour of the new constants # We should promote constants for static data like such instead of function calls # maybe this was just an old left-over
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 0475cfca29..916d85ce80 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -33,6 +33,7 @@
#include "ext/session/php_session.h"
#include "zend_operators.h"
#include "ext/standard/php_dns.h"
+#include "ext/standard/php_rand.h"
#include "ext/standard/php_uuencode.h"
#ifdef PHP_WIN32
@@ -2828,8 +2829,8 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(rand, arginfo_rand)
PHP_FE(srand, arginfo_srand)
- PHP_FE(getrandmax, arginfo_getrandmax)
- PHP_FE(mt_rand, arginfo_mt_rand)
+ PHP_DEP_FE(getrandmax, arginfo_getrandmax)
+ PHP_DEP_FE(mt_rand, arginfo_mt_rand)
PHP_FE(mt_srand, arginfo_mt_srand)
PHP_FE(mt_getrandmax, arginfo_mt_getrandmax)
@@ -3551,6 +3552,9 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
REGISTER_MATH_CONSTANT(M_SQRT3);
REGISTER_DOUBLE_CONSTANT("INF", php_get_inf(), CONST_CS | CONST_PERSISTENT);
REGISTER_DOUBLE_CONSTANT("NAN", php_get_nan(), CONST_CS | CONST_PERSISTENT);
+
+ REGISTER_MATH_CONSTANT(PHP_RAND_MAX);
+ REGISTER_MATH_CONSTANT(PHP_MT_RAND_MAX);
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT);