mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Replace *magic number* with a much nicer define.
This commit is contained in:
parent
ab2ebdb49b
commit
f94b536bc8
@ -509,7 +509,7 @@ ZEND_FUNCTION(define)
|
||||
c.flags = case_sensitive; /* non persistent */
|
||||
c.name = zend_strndup((*var)->value.str.val, (*var)->value.str.len);
|
||||
c.name_len = (*var)->value.str.len+1;
|
||||
c.module_number = 2147483647;
|
||||
c.module_number = PHP_USER_CONSTANT;
|
||||
if (zend_register_constant(&c TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
@ -1343,7 +1343,7 @@ ZEND_FUNCTION(get_defined_constants)
|
||||
while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &val, &pos) != FAILURE) {
|
||||
zval *const_val;
|
||||
|
||||
if (val->module_number == 2147483647) {
|
||||
if (val->module_number == PHP_USER_CONSTANT) {
|
||||
module_number = i;
|
||||
} else if (val->module_number > i || val->module_number < 0) {
|
||||
/* should not happen */
|
||||
|
@ -27,6 +27,8 @@
|
||||
#define CONST_CS (1<<0) /* Case Sensitive */
|
||||
#define CONST_PERSISTENT (1<<1) /* Persistent */
|
||||
|
||||
#define PHP_USER_CONSTANT LONG_MAX /* a constant defined in user space */
|
||||
|
||||
typedef struct _zend_constant {
|
||||
zval value;
|
||||
int flags;
|
||||
|
Loading…
Reference in New Issue
Block a user