Skip to content

Commit c3cd4d8

Browse files
Fix formatting
1 parent 6ddd47d commit c3cd4d8

File tree

1 file changed

+23
-30
lines changed

1 file changed

+23
-30
lines changed

docs/source/core/data-structures/zend_constant.rst

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
zend_constant
33
###############
44

5-
PHP constants (referring to non-class constants) are stored in a dedicated
6-
structure ``zend_constant``, which holds both the value of the constant and
7-
details for using it.
5+
PHP constants (referring to non-class constants) are stored in a dedicated structure
6+
``zend_constant``, which holds both the value of the constant and details for using it.
87

98
************
109
definition
@@ -18,21 +17,18 @@ details for using it.
1817
zend_string *filename;
1918
} zend_constant;
2019
21-
The ``value`` field stores both the value itself and some metadata. The ``name``
22-
and ``filename`` store the name of the constant and the name of the file in
23-
which it was defined.
20+
The ``value`` field stores both the value itself and some metadata. The ``name`` and ``filename``
21+
store the name of the constant and the name of the file in which it was defined.
2422

25-
******
23+
*******
2624
value
27-
******
25+
*******
2826

29-
The value of the constant is stored in the :doc:`./zval` ``value``. However,
30-
since the ``zval`` structure has extra space, for constants this is used to
31-
store both the number of the module that the constant was defined in, and a
32-
combination of the flags that affect the usage of the constant.
27+
The value of the constant is stored in the :doc:`./zval` ``value``. However, since the ``zval``
28+
structure has extra space, for constants this is used to store both the number of the module that
29+
the constant was defined in, and a combination of the flags that affect the usage of the constant.
3330

34-
This extra information is placed in the ``uint32_t`` field
35-
``value.u2.constant_flags``.
31+
This extra information is placed in the ``uint32_t`` field ``value.u2.constant_flags``.
3632

3733
The bottom 16 bits are used to hold flags about the constant
3834

@@ -44,28 +40,25 @@ The bottom 16 bits are used to hold flags about the constant
4440
#define CONST_OWNED (1<<3) /* constant should be destroyed together
4541
with class */
4642
47-
These bottom 16 bits can be accessed with the ``ZEND_CONSTANT_FLAGS()`` macro,
48-
which is given a ``zend_constant`` pointer as a parameter.
43+
These bottom 16 bits can be accessed with the ``ZEND_CONSTANT_FLAGS()`` macro, which is given a
44+
``zend_constant`` pointer as a parameter.
4945

50-
On the other hand, the top 16 bits are used to store the number of the PHP
51-
module that registered the constant. For constants defined by the user, the
52-
module number stored will be ``PHP_USER_CONSTANT``. This module number can be
53-
accessed with the ``ZEND_CONSTANT_MODULE_NUMBER()`` macro, which is likewise
54-
given a ``zend_constant`` pointer as a parameter.
46+
On the other hand, the top 16 bits are used to store the number of the PHP module that registered
47+
the constant. For constants defined by the user, the module number stored will be
48+
``PHP_USER_CONSTANT``. This module number can be accessed with the ``ZEND_CONSTANT_MODULE_NUMBER()``
49+
macro, which is likewise given a ``zend_constant`` pointer as a parameter.
5550

5651
******
5752
name
5853
******
5954

60-
The ``name`` holds a :doc:`zend_string` with the name of the constant, to allow
61-
searching for constants that have already been defined. This string is released
62-
when the constant itself is freed.
55+
The ``name`` holds a :doc:`zend_string` with the name of the constant, to allow searching for
56+
constants that have already been defined. This string is released when the constant itself is freed.
6357

64-
******
58+
**********
6559
filename
66-
******
60+
**********
6761

68-
Finally, the ``filename`` holds another ``zend_string`` with the name of the
69-
file in which the constant was defined, or ``NULL`` if not defined userland
70-
code. This field provides the foundation for the PHP method
71-
``ReflectionConstant::getFileName()``.
62+
Finally, the ``filename`` holds another ``zend_string`` with the name of the file in which the
63+
constant was defined, or ``NULL`` if not defined userland code. This field provides the foundation
64+
for the PHP method ``ReflectionConstant::getFileName()``.

0 commit comments

Comments
 (0)