Skip to content

Commit e85289f

Browse files
committed
Fix Zend SmartStr
It can't use static functions in inline functions
1 parent f6456f3 commit e85289f

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed

Zend/zend_smart_str.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ static size_t zend_compute_escaped_string_len(const char *s, size_t l) {
7373
return len;
7474
}
7575

76+
/*
7677
extern ZEND_API inline void smart_str_appendl(smart_str *dest, const char *src, size_t length);
7778
extern ZEND_API inline void smart_str_appends_ex(smart_str *dest, const char *src, bool persistent);
7879
extern ZEND_API inline void smart_str_appends(smart_str *dest, const char *src);
@@ -83,7 +84,7 @@ extern ZEND_API inline void smart_str_free(smart_str *str);
8384
extern ZEND_API inline void smart_str_append_long(smart_str *dest, zend_long num);
8485
extern ZEND_API inline void smart_str_append_unsigned(smart_str *dest, zend_ulong num);
8586
extern ZEND_API inline void smart_str_sets(smart_str *dest, const char *src);
86-
87+
*/
8788

8889
ZEND_API void ZEND_FASTCALL smart_str_append_escaped(smart_str *str, const char *s, size_t l) {
8990
char *res;

Zend/zend_smart_str.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,6 @@
2121
#include "zend_globals.h"
2222
#include "zend_smart_str_public.h"
2323

24-
ZEND_API inline void smart_str_appendl(smart_str *dest, const char *src, size_t length)
25-
{
26-
smart_str_appendl_ex(dest, src, length, 0);
27-
}
28-
ZEND_API inline void smart_str_appends_ex(smart_str *dest, const char *src, bool persistent)
29-
{
30-
smart_str_appendl_ex(dest, src, strlen(src), persistent);
31-
}
32-
ZEND_API inline void smart_str_appends(smart_str *dest, const char *src)
33-
{
34-
smart_str_appendl_ex(dest, src, strlen(src), 0);
35-
}
36-
ZEND_API inline void smart_str_append(smart_str *dest, const zend_string *src)
37-
{
38-
smart_str_append_ex(dest, src, 0);
39-
}
40-
ZEND_API inline void smart_str_appendc(smart_str *dest, char ch)
41-
{
42-
smart_str_appendc_ex(dest, ch, 0);
43-
}
44-
ZEND_API inline void smart_str_append_smart_str(smart_str *dest, const smart_str *src)
45-
{
46-
smart_str_append_smart_str_ex(dest, src, 0);
47-
}
48-
4924
BEGIN_EXTERN_C()
5025

5126
ZEND_API void ZEND_FASTCALL smart_str_erealloc(smart_str *str, size_t len);
@@ -80,7 +55,7 @@ static zend_always_inline char* smart_str_extend_ex(smart_str *dest, size_t len,
8055
return ret;
8156
}
8257

83-
ZEND_API inline char* smart_str_extend(smart_str *dest, size_t length)
58+
static inline char* smart_str_extend(smart_str *dest, size_t length)
8459
{
8560
return smart_str_extend_ex(dest, length, 0);
8661
}
@@ -93,7 +68,7 @@ static zend_always_inline void smart_str_free_ex(smart_str *str, zend_bool persi
9368
str->a = 0;
9469
}
9570

96-
ZEND_API inline void smart_str_free(smart_str *str)
71+
static inline void smart_str_free(smart_str *str)
9772
{
9873
smart_str_free_ex(str, 0);
9974
}
@@ -148,7 +123,7 @@ static zend_always_inline void smart_str_append_long_ex(smart_str *dest, zend_lo
148123
smart_str_appendl_ex(dest, result, buf + sizeof(buf) - 1 - result, persistent);
149124
}
150125

151-
ZEND_API inline void smart_str_append_long(smart_str *dest, zend_long num)
126+
static inline void smart_str_append_long(smart_str *dest, zend_long num)
152127
{
153128
smart_str_append_long_ex(dest, num, 0);
154129
}
@@ -159,17 +134,42 @@ static zend_always_inline void smart_str_append_unsigned_ex(smart_str *dest, zen
159134
smart_str_appendl_ex(dest, result, buf + sizeof(buf) - 1 - result, persistent);
160135
}
161136

162-
ZEND_API inline void smart_str_append_unsigned(smart_str *dest, zend_ulong num)
137+
static inline void smart_str_append_unsigned(smart_str *dest, zend_ulong num)
163138
{
164139
smart_str_append_unsigned_ex(dest, num, 0);
165140
}
166141

142+
static inline void smart_str_appendl(smart_str *dest, const char *src, size_t length)
143+
{
144+
smart_str_appendl_ex(dest, src, length, 0);
145+
}
146+
static inline void smart_str_appends_ex(smart_str *dest, const char *src, bool persistent)
147+
{
148+
smart_str_appendl_ex(dest, src, strlen(src), persistent);
149+
}
150+
static inline void smart_str_appends(smart_str *dest, const char *src)
151+
{
152+
smart_str_appendl_ex(dest, src, strlen(src), 0);
153+
}
154+
static inline void smart_str_append(smart_str *dest, const zend_string *src)
155+
{
156+
smart_str_append_ex(dest, src, 0);
157+
}
158+
static inline void smart_str_appendc(smart_str *dest, char ch)
159+
{
160+
smart_str_appendc_ex(dest, ch, 0);
161+
}
162+
static inline void smart_str_append_smart_str(smart_str *dest, const smart_str *src)
163+
{
164+
smart_str_append_smart_str_ex(dest, src, 0);
165+
}
166+
167167
static zend_always_inline void smart_str_setl(smart_str *dest, const char *src, size_t len) {
168168
smart_str_free(dest);
169169
smart_str_appendl(dest, src, len);
170170
}
171171

172-
ZEND_API inline void smart_str_sets(smart_str *dest, const char *src)
172+
static inline void smart_str_sets(smart_str *dest, const char *src)
173173
{
174174
smart_str_setl(dest, src, strlen(src));
175175
}

0 commit comments

Comments
 (0)