@@ -71,33 +71,49 @@ END_EXTERN_C()
7171
7272/*---*/
7373
74- #define ZSTR_IS_INTERNED (s ) (GC_FLAGS(s) & IS_STR_INTERNED)
75- #define ZSTR_IS_VALID_UTF8 (s ) (GC_FLAGS(s) & IS_STR_VALID_UTF8)
74+ static zend_always_inline bool ZSTR_IS_INTERNED (const zend_string * s ) {
75+ return GC_FLAGS (s ) & IS_STR_INTERNED ;
76+ }
77+
78+ static inline bool ZSTR_IS_VALID_UTF8 (const zend_string * s ) {
79+ return GC_FLAGS (s ) & IS_STR_VALID_UTF8 ;
80+ }
7681
7782/* These are properties, encoded as flags, that will hold on the resulting string
7883 * after concatenating two strings that have these property.
7984 * Example: concatenating two UTF-8 strings yields another UTF-8 string. */
8085#define ZSTR_COPYABLE_CONCAT_PROPERTIES (IS_STR_VALID_UTF8)
8186
82- #define ZSTR_GET_COPYABLE_CONCAT_PROPERTIES (s ) (GC_FLAGS( s) & ZSTR_COPYABLE_CONCAT_PROPERTIES)
83- /* This macro returns the copyable concat properties which hold on both strings. */
84- #define ZSTR_GET_COPYABLE_CONCAT_PROPERTIES_BOTH ( s1 , s2 ) (GC_FLAGS(s1) & GC_FLAGS(s2) & ZSTR_COPYABLE_CONCAT_PROPERTIES)
87+ static inline uint32_t ZSTR_GET_COPYABLE_CONCAT_PROPERTIES (const zend_string * s ) {
88+ return GC_FLAGS ( s ) & ZSTR_COPYABLE_CONCAT_PROPERTIES ;
89+ }
8590
86- #define ZSTR_COPY_CONCAT_PROPERTIES (out , in ) do { \
87- zend_string *_out = (out); \
88- uint32_t properties = ZSTR_GET_COPYABLE_CONCAT_PROPERTIES((in)); \
89- GC_ADD_FLAGS(_out, properties); \
90- } while (0)
91+ /* This function returns the copyable concat properties which hold on both strings. */
92+ static inline uint32_t ZSTR_GET_COPYABLE_CONCAT_PROPERTIES_BOTH (const zend_string * s1 , const zend_string * s2 ) {
93+ return ZSTR_GET_COPYABLE_CONCAT_PROPERTIES (s1 ) & ZSTR_GET_COPYABLE_CONCAT_PROPERTIES (s2 );
94+ }
9195
92- #define ZSTR_COPY_CONCAT_PROPERTIES_BOTH (out , in1 , in2 ) do { \
93- zend_string *_out = (out); \
94- uint32_t properties = ZSTR_GET_COPYABLE_CONCAT_PROPERTIES_BOTH((in1), (in2)); \
95- GC_ADD_FLAGS(_out, properties); \
96- } while (0)
96+ static inline void ZSTR_COPY_CONCAT_PROPERTIES (zend_string * out , const zend_string * in ) {
97+ uint32_t properties = ZSTR_GET_COPYABLE_CONCAT_PROPERTIES (in );
98+ GC_ADD_FLAGS (out , properties );
99+ }
97100
98- #define ZSTR_EMPTY_ALLOC () zend_empty_string
99- #define ZSTR_CHAR (c ) zend_one_char_string[c]
100- #define ZSTR_KNOWN (idx ) zend_known_strings[idx]
101+ static inline void ZSTR_COPY_CONCAT_PROPERTIES_BOTH (zend_string * out , const zend_string * in1 , const zend_string * in2 ) {
102+ uint32_t properties = ZSTR_GET_COPYABLE_CONCAT_PROPERTIES_BOTH (in1 , in2 );
103+ GC_ADD_FLAGS (out , properties );
104+ }
105+
106+ static zend_always_inline zend_string * ZSTR_EMPTY_ALLOC (void ) {
107+ return zend_empty_string ;
108+ }
109+
110+ static zend_always_inline zend_string * ZSTR_CHAR (unsigned char c ) {
111+ return zend_one_char_string [c ];
112+ }
113+
114+ static zend_always_inline zend_string * ZSTR_KNOWN (size_t idx ) {
115+ return zend_known_strings [idx ];
116+ }
101117
102118#define _ZSTR_HEADER_SIZE XtOffsetOf(zend_string, val)
103119
0 commit comments