Replace *magic number* with a much nicer define.

This commit is contained in:
Ilia Alshanetsky 2003-08-22 18:50:12 +00:00
parent ab2ebdb49b
commit f94b536bc8
2 changed files with 4 additions and 2 deletions

View File

@ -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 */

View File

@ -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;