Lines Matching refs:s
47 #define IS_INTERNED(s) ZSTR_IS_INTERNED(s) in END_EXTERN_C() argument
51 #define STR_ALLOCA_INIT(str, s, len, use_heap) ZSTR_ALLOCA_INIT(str, s, len, use_heap) in END_EXTERN_C() argument
56 #define ZSTR_IS_INTERNED(s) (GC_FLAGS(s) & IS_STR_INTERNED) in END_EXTERN_C() argument
72 #define ZSTR_ALLOCA_INIT(str, s, len, use_heap) do { \ argument
74 memcpy(ZSTR_VAL(str), (s), (len)); \
82 static zend_always_inline zend_ulong zend_string_hash_val(zend_string *s)
84 if (!ZSTR_H(s)) {
85 ZSTR_H(s) = zend_hash_func(ZSTR_VAL(s), ZSTR_LEN(s));
87 return ZSTR_H(s);
90 static zend_always_inline void zend_string_forget_hash_val(zend_string *s) in zend_string_forget_hash_val() argument
92 ZSTR_H(s) = 0; in zend_string_forget_hash_val()
95 static zend_always_inline uint32_t zend_string_refcount(const zend_string *s) in zend_string_refcount() argument
97 if (!ZSTR_IS_INTERNED(s)) { in zend_string_refcount()
98 return GC_REFCOUNT(s); in zend_string_refcount()
103 static zend_always_inline uint32_t zend_string_addref(zend_string *s) in zend_string_addref() argument
105 if (!ZSTR_IS_INTERNED(s)) { in zend_string_addref()
106 return ++GC_REFCOUNT(s); in zend_string_addref()
111 static zend_always_inline uint32_t zend_string_delref(zend_string *s) in zend_string_delref() argument
113 if (!ZSTR_IS_INTERNED(s)) { in zend_string_delref()
114 return --GC_REFCOUNT(s); in zend_string_delref()
164 static zend_always_inline zend_string *zend_string_copy(zend_string *s) in zend_string_copy() argument
166 if (!ZSTR_IS_INTERNED(s)) { in zend_string_copy()
167 GC_REFCOUNT(s)++; in zend_string_copy()
169 return s; in zend_string_copy()
172 static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persistent) in zend_string_dup() argument
174 if (ZSTR_IS_INTERNED(s)) { in zend_string_dup()
175 return s; in zend_string_dup()
177 return zend_string_init(ZSTR_VAL(s), ZSTR_LEN(s), persistent); in zend_string_dup()
181 static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, int persiste… in zend_string_realloc() argument
185 if (!ZSTR_IS_INTERNED(s)) { in zend_string_realloc()
186 if (EXPECTED(GC_REFCOUNT(s) == 1)) { in zend_string_realloc()
187 ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); in zend_string_realloc()
192 GC_REFCOUNT(s)--; in zend_string_realloc()
196 memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN(len, ZSTR_LEN(s)) + 1); in zend_string_realloc()
200 static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t len, int persisten… in zend_string_extend() argument
204 ZEND_ASSERT(len >= ZSTR_LEN(s)); in zend_string_extend()
205 if (!ZSTR_IS_INTERNED(s)) { in zend_string_extend()
206 if (EXPECTED(GC_REFCOUNT(s) == 1)) { in zend_string_extend()
207 ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); in zend_string_extend()
212 GC_REFCOUNT(s)--; in zend_string_extend()
216 memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), ZSTR_LEN(s) + 1); in zend_string_extend()
220 static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size_t len, int persist… in zend_string_truncate() argument
224 ZEND_ASSERT(len <= ZSTR_LEN(s)); in zend_string_truncate()
225 if (!ZSTR_IS_INTERNED(s)) { in zend_string_truncate()
226 if (EXPECTED(GC_REFCOUNT(s) == 1)) { in zend_string_truncate()
227 ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); in zend_string_truncate()
232 GC_REFCOUNT(s)--; in zend_string_truncate()
236 memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), len + 1); in zend_string_truncate()
240 static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m,… in zend_string_safe_realloc() argument
244 if (!ZSTR_IS_INTERNED(s)) { in zend_string_safe_realloc()
245 if (GC_REFCOUNT(s) == 1) { in zend_string_safe_realloc()
246 …ret = (zend_string *)safe_perealloc(s, n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persisten… in zend_string_safe_realloc()
251 GC_REFCOUNT(s)--; in zend_string_safe_realloc()
255 memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN((n * m) + l, ZSTR_LEN(s)) + 1); in zend_string_safe_realloc()
259 static zend_always_inline void zend_string_free(zend_string *s) in zend_string_free() argument
261 if (!ZSTR_IS_INTERNED(s)) { in zend_string_free()
262 ZEND_ASSERT(GC_REFCOUNT(s) <= 1); in zend_string_free()
263 pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT); in zend_string_free()
267 static zend_always_inline void zend_string_release(zend_string *s) in zend_string_release() argument
269 if (!ZSTR_IS_INTERNED(s)) { in zend_string_release()
270 if (--GC_REFCOUNT(s) == 0) { in zend_string_release()
271 pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT); in zend_string_release()
361 static zend_always_inline void zend_interned_empty_string_init(zend_string **s) in zend_interned_empty_string_init() argument
369 *s = zend_new_interned_string(str); in zend_interned_empty_string_init()
373 *s = str; in zend_interned_empty_string_init()
377 static zend_always_inline void zend_interned_empty_string_free(zend_string **s) in zend_interned_empty_string_free() argument
379 if (NULL != *s) { in zend_interned_empty_string_free()
380 free(*s); in zend_interned_empty_string_free()
381 *s = NULL; in zend_interned_empty_string_free()