21
21
#include "zend_globals.h"
22
22
#include "zend_smart_str_public.h"
23
23
24
- #define smart_str_appends_ex (dest , src , what ) \
25
- smart_str_appendl_ex((dest), (src), strlen(src), (what))
26
- #define smart_str_appends (dest , src ) \
27
- smart_str_appendl((dest), (src), strlen(src))
28
- #define smart_str_extend (dest , len ) \
29
- smart_str_extend_ex((dest), (len), 0)
30
- #define smart_str_appendc (dest , c ) \
31
- smart_str_appendc_ex((dest), (c), 0)
32
- #define smart_str_appendl (dest , src , len ) \
33
- smart_str_appendl_ex((dest), (src), (len), 0)
34
- #define smart_str_append (dest , src ) \
35
- smart_str_append_ex((dest), (src), 0)
36
- #define smart_str_append_smart_str (dest , src ) \
37
- smart_str_append_smart_str_ex((dest), (src), 0)
38
- #define smart_str_sets (dest , src ) \
39
- smart_str_setl((dest), (src), strlen(src));
40
- #define smart_str_append_long (dest , val ) \
41
- smart_str_append_long_ex((dest), (val), 0)
42
- #define smart_str_append_unsigned (dest , val ) \
43
- smart_str_append_unsigned_ex((dest), (val), 0)
44
- #define smart_str_free (dest ) \
45
- smart_str_free_ex((dest), 0)
46
-
47
24
BEGIN_EXTERN_C ()
48
25
49
26
ZEND_API void ZEND_FASTCALL smart_str_erealloc (smart_str * str , size_t len );
@@ -83,6 +60,11 @@ static zend_always_inline char* smart_str_extend_ex(smart_str *dest, size_t len,
83
60
return ret ;
84
61
}
85
62
63
+ static inline char * smart_str_extend (smart_str * dest , size_t length )
64
+ {
65
+ return smart_str_extend_ex (dest , length , false);
66
+ }
67
+
86
68
static zend_always_inline void smart_str_free_ex (smart_str * str , bool persistent ) {
87
69
if (str -> s ) {
88
70
zend_string_release_ex (str -> s , persistent );
@@ -91,6 +73,11 @@ static zend_always_inline void smart_str_free_ex(smart_str *str, bool persistent
91
73
str -> a = 0 ;
92
74
}
93
75
76
+ static inline void smart_str_free (smart_str * str )
77
+ {
78
+ smart_str_free_ex (str , false);
79
+ }
80
+
94
81
static zend_always_inline void smart_str_0 (smart_str * str ) {
95
82
if (str -> s ) {
96
83
ZSTR_VAL (str -> s )[ZSTR_LEN (str -> s )] = '\0' ;
@@ -141,15 +128,54 @@ static zend_always_inline void smart_str_append_long_ex(smart_str *dest, zend_lo
141
128
smart_str_appendl_ex (dest , result , buf + sizeof (buf ) - 1 - result , persistent );
142
129
}
143
130
131
+ static inline void smart_str_append_long (smart_str * dest , zend_long num )
132
+ {
133
+ smart_str_append_long_ex (dest , num , false);
134
+ }
135
+
144
136
static zend_always_inline void smart_str_append_unsigned_ex (smart_str * dest , zend_ulong num , bool persistent ) {
145
137
char buf [32 ];
146
138
char * result = zend_print_ulong_to_buf (buf + sizeof (buf ) - 1 , num );
147
139
smart_str_appendl_ex (dest , result , buf + sizeof (buf ) - 1 - result , persistent );
148
140
}
149
141
142
+ static inline void smart_str_append_unsigned (smart_str * dest , zend_ulong num )
143
+ {
144
+ smart_str_append_unsigned_ex (dest , num , false);
145
+ }
146
+
147
+ static inline void smart_str_appendl (smart_str * dest , const char * src , size_t length )
148
+ {
149
+ smart_str_appendl_ex (dest , src , length , false);
150
+ }
151
+ static inline void smart_str_appends_ex (smart_str * dest , const char * src , bool persistent )
152
+ {
153
+ smart_str_appendl_ex (dest , src , strlen (src ), persistent );
154
+ }
155
+ static inline void smart_str_appends (smart_str * dest , const char * src )
156
+ {
157
+ smart_str_appendl_ex (dest , src , strlen (src ), false);
158
+ }
159
+ static inline void smart_str_append (smart_str * dest , const zend_string * src )
160
+ {
161
+ smart_str_append_ex (dest , src , false);
162
+ }
163
+ static inline void smart_str_appendc (smart_str * dest , char ch )
164
+ {
165
+ smart_str_appendc_ex (dest , ch , false);
166
+ }
167
+ static inline void smart_str_append_smart_str (smart_str * dest , const smart_str * src )
168
+ {
169
+ smart_str_append_smart_str_ex (dest , src , false);
170
+ }
171
+
150
172
static zend_always_inline void smart_str_setl (smart_str * dest , const char * src , size_t len ) {
151
173
smart_str_free (dest );
152
174
smart_str_appendl (dest , src , len );
153
175
}
154
176
177
+ static inline void smart_str_sets (smart_str * dest , const char * src )
178
+ {
179
+ smart_str_setl (dest , src , strlen (src ));
180
+ }
155
181
#endif
0 commit comments