@@ -141,42 +141,43 @@ END_EXTERN_C()
141
141
142
142
/*---*/
143
143
144
- static zend_always_inline zend_ulong zend_string_hash_val (zend_string * s )
144
+ BEGIN_EXTERN_C ()
145
+ ZEND_API zend_always_inline zend_ulong zend_string_hash_val (zend_string * s )
145
146
{
146
147
return ZSTR_H (s ) ? ZSTR_H (s ) : zend_string_hash_func (s );
147
148
}
148
149
149
- static zend_always_inline void zend_string_forget_hash_val (zend_string * s )
150
+ ZEND_API zend_always_inline void zend_string_forget_hash_val (zend_string * s )
150
151
{
151
152
ZSTR_H (s ) = 0 ;
152
153
GC_DEL_FLAGS (s , IS_STR_VALID_UTF8 );
153
154
}
154
155
155
- static zend_always_inline uint32_t zend_string_refcount (const zend_string * s )
156
+ ZEND_API zend_always_inline uint32_t zend_string_refcount (const zend_string * s )
156
157
{
157
158
if (!ZSTR_IS_INTERNED (s )) {
158
159
return GC_REFCOUNT (s );
159
160
}
160
161
return 1 ;
161
162
}
162
163
163
- static zend_always_inline uint32_t zend_string_addref (zend_string * s )
164
+ ZEND_API zend_always_inline uint32_t zend_string_addref (zend_string * s )
164
165
{
165
166
if (!ZSTR_IS_INTERNED (s )) {
166
167
return GC_ADDREF (s );
167
168
}
168
169
return 1 ;
169
170
}
170
171
171
- static zend_always_inline uint32_t zend_string_delref (zend_string * s )
172
+ ZEND_API zend_always_inline uint32_t zend_string_delref (zend_string * s )
172
173
{
173
174
if (!ZSTR_IS_INTERNED (s )) {
174
175
return GC_DELREF (s );
175
176
}
176
177
return 1 ;
177
178
}
178
179
179
- static zend_always_inline zend_string * zend_string_alloc (size_t len , bool persistent )
180
+ ZEND_API zend_always_inline zend_string * zend_string_alloc (size_t len , bool persistent )
180
181
{
181
182
zend_string * ret = (zend_string * )pemalloc (ZEND_MM_ALIGNED_SIZE (_ZSTR_STRUCT_SIZE (len )), persistent );
182
183
@@ -187,6 +188,16 @@ static zend_always_inline zend_string *zend_string_alloc(size_t len, bool persis
187
188
return ret ;
188
189
}
189
190
191
+ ZEND_API zend_always_inline zend_string * zend_string_init (const char * str , size_t len , bool persistent )
192
+ {
193
+ zend_string * ret = zend_string_alloc (len , persistent );
194
+
195
+ memcpy (ZSTR_VAL (ret ), str , len );
196
+ ZSTR_VAL (ret )[len ] = '\0' ;
197
+ return ret ;
198
+ }
199
+ END_EXTERN_C ()
200
+
190
201
static zend_always_inline zend_string * zend_string_safe_alloc (size_t n , size_t m , size_t l , bool persistent )
191
202
{
192
203
zend_string * ret = (zend_string * )safe_pemalloc (n , m , ZEND_MM_ALIGNED_SIZE (_ZSTR_STRUCT_SIZE (l )), persistent );
@@ -198,15 +209,6 @@ static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m
198
209
return ret ;
199
210
}
200
211
201
- static zend_always_inline zend_string * zend_string_init (const char * str , size_t len , bool persistent )
202
- {
203
- zend_string * ret = zend_string_alloc (len , persistent );
204
-
205
- memcpy (ZSTR_VAL (ret ), str , len );
206
- ZSTR_VAL (ret )[len ] = '\0' ;
207
- return ret ;
208
- }
209
-
210
212
static zend_always_inline zend_string * zend_string_init_fast (const char * str , size_t len )
211
213
{
212
214
if (len > 1 ) {
@@ -218,15 +220,16 @@ static zend_always_inline zend_string *zend_string_init_fast(const char *str, si
218
220
}
219
221
}
220
222
221
- static zend_always_inline zend_string * zend_string_copy (zend_string * s )
223
+ BEGIN_EXTERN_C ()
224
+ ZEND_API inline zend_string * zend_string_copy (zend_string * s )
222
225
{
223
226
if (!ZSTR_IS_INTERNED (s )) {
224
227
GC_ADDREF (s );
225
228
}
226
229
return s ;
227
230
}
228
231
229
- static zend_always_inline zend_string * zend_string_dup (zend_string * s , bool persistent )
232
+ ZEND_API zend_always_inline zend_string * zend_string_dup (zend_string * s , bool persistent )
230
233
{
231
234
if (ZSTR_IS_INTERNED (s )) {
232
235
return s ;
@@ -235,7 +238,7 @@ static zend_always_inline zend_string *zend_string_dup(zend_string *s, bool pers
235
238
}
236
239
}
237
240
238
- static zend_always_inline zend_string * zend_string_separate (zend_string * s , bool persistent )
241
+ ZEND_API zend_always_inline zend_string * zend_string_separate (zend_string * s , bool persistent )
239
242
{
240
243
if (ZSTR_IS_INTERNED (s ) || GC_REFCOUNT (s ) > 1 ) {
241
244
if (!ZSTR_IS_INTERNED (s )) {
@@ -248,7 +251,7 @@ static zend_always_inline zend_string *zend_string_separate(zend_string *s, bool
248
251
return s ;
249
252
}
250
253
251
- static zend_always_inline zend_string * zend_string_realloc (zend_string * s , size_t len , bool persistent )
254
+ ZEND_API zend_always_inline zend_string * zend_string_realloc (zend_string * s , size_t len , bool persistent )
252
255
{
253
256
zend_string * ret ;
254
257
@@ -267,6 +270,7 @@ static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_
267
270
}
268
271
return ret ;
269
272
}
273
+ END_EXTERN_C ()
270
274
271
275
static zend_always_inline zend_string * zend_string_extend (zend_string * s , size_t len , bool persistent )
272
276
{
@@ -370,31 +374,31 @@ static zend_always_inline void zend_string_release_ex(zend_string *s, bool persi
370
374
}
371
375
}
372
376
373
- static zend_always_inline bool zend_string_equals_cstr (const zend_string * s1 , const char * s2 , size_t s2_length )
377
+ BEGIN_EXTERN_C ()
378
+ ZEND_API zend_always_inline bool zend_string_equals_cstr (const zend_string * s1 , const char * s2 , size_t s2_length )
374
379
{
375
380
return ZSTR_LEN (s1 ) == s2_length && !memcmp (ZSTR_VAL (s1 ), s2 , s2_length );
376
381
}
377
382
378
383
#if defined(__GNUC__ ) && (defined(__i386__ ) || (defined(__x86_64__ ) && !defined(__ILP32__ )))
379
- BEGIN_EXTERN_C ()
380
384
ZEND_API bool ZEND_FASTCALL zend_string_equal_val (const zend_string * s1 , const zend_string * s2 );
381
- END_EXTERN_C ()
382
385
#else
383
- static zend_always_inline bool zend_string_equal_val (const zend_string * s1 , const zend_string * s2 )
386
+ ZEND_API zend_always_inline bool zend_string_equal_val (const zend_string * s1 , const zend_string * s2 )
384
387
{
385
388
return !memcmp (ZSTR_VAL (s1 ), ZSTR_VAL (s2 ), ZSTR_LEN (s1 ));
386
389
}
387
390
#endif
388
391
389
- static zend_always_inline bool zend_string_equal_content (const zend_string * s1 , const zend_string * s2 )
392
+ ZEND_API zend_always_inline bool zend_string_equal_content (const zend_string * s1 , const zend_string * s2 )
390
393
{
391
394
return ZSTR_LEN (s1 ) == ZSTR_LEN (s2 ) && zend_string_equal_val (s1 , s2 );
392
395
}
393
396
394
- static zend_always_inline bool zend_string_equals (const zend_string * s1 , const zend_string * s2 )
397
+ ZEND_API zend_always_inline bool zend_string_equals (const zend_string * s1 , const zend_string * s2 )
395
398
{
396
399
return s1 == s2 || zend_string_equal_content (s1 , s2 );
397
400
}
401
+ END_EXTERN_C ()
398
402
399
403
#define zend_string_equals_ci (s1 , s2 ) \
400
404
(ZSTR_LEN(s1) == ZSTR_LEN(s2) && !zend_binary_strcasecmp(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2)))
0 commit comments