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 );
@@ -78,6 +55,11 @@ static zend_always_inline char* smart_str_extend_ex(smart_str *dest, size_t len,
78
55
return ret ;
79
56
}
80
57
58
+ static inline char * smart_str_extend (smart_str * dest , size_t length )
59
+ {
60
+ return smart_str_extend_ex (dest , length , 0 );
61
+ }
62
+
81
63
static zend_always_inline void smart_str_free_ex (smart_str * str , zend_bool persistent ) {
82
64
if (str -> s ) {
83
65
zend_string_release_ex (str -> s , persistent );
@@ -86,6 +68,11 @@ static zend_always_inline void smart_str_free_ex(smart_str *str, zend_bool persi
86
68
str -> a = 0 ;
87
69
}
88
70
71
+ static inline void smart_str_free (smart_str * str )
72
+ {
73
+ smart_str_free_ex (str , 0 );
74
+ }
75
+
89
76
static zend_always_inline void smart_str_0 (smart_str * str ) {
90
77
if (str -> s ) {
91
78
ZSTR_VAL (str -> s )[ZSTR_LEN (str -> s )] = '\0' ;
@@ -136,15 +123,54 @@ static zend_always_inline void smart_str_append_long_ex(smart_str *dest, zend_lo
136
123
smart_str_appendl_ex (dest , result , buf + sizeof (buf ) - 1 - result , persistent );
137
124
}
138
125
126
+ static inline void smart_str_append_long (smart_str * dest , zend_long num )
127
+ {
128
+ smart_str_append_long_ex (dest , num , 0 );
129
+ }
130
+
139
131
static zend_always_inline void smart_str_append_unsigned_ex (smart_str * dest , zend_ulong num , zend_bool persistent ) {
140
132
char buf [32 ];
141
133
char * result = zend_print_ulong_to_buf (buf + sizeof (buf ) - 1 , num );
142
134
smart_str_appendl_ex (dest , result , buf + sizeof (buf ) - 1 - result , persistent );
143
135
}
144
136
137
+ static inline void smart_str_append_unsigned (smart_str * dest , zend_ulong num )
138
+ {
139
+ smart_str_append_unsigned_ex (dest , num , 0 );
140
+ }
141
+
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
+
145
167
static zend_always_inline void smart_str_setl (smart_str * dest , const char * src , size_t len ) {
146
168
smart_str_free (dest );
147
169
smart_str_appendl (dest , src , len );
148
170
}
149
171
172
+ static inline void smart_str_sets (smart_str * dest , const char * src )
173
+ {
174
+ smart_str_setl (dest , src , strlen (src ));
175
+ }
150
176
#endif
0 commit comments