summaryrefslogtreecommitdiff
path: root/ext/standard/php_smart_str.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/php_smart_str.h')
-rw-r--r--ext/standard/php_smart_str.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h
index 71bcf0b223..8b79e3edbc 100644
--- a/ext/standard/php_smart_str.h
+++ b/ext/standard/php_smart_str.h
@@ -62,7 +62,7 @@
(d)->a = newlen < SMART_STR_START_SIZE \
? SMART_STR_START_SIZE \
: newlen + SMART_STR_PREALLOC; \
- (d)->s = STR_ALLOC((d)->a, (what)); \
+ (d)->s = zend_string_alloc((d)->a, (what)); \
(d)->s->len = 0; \
} else { \
newlen = (d)->s->len + (n); \
@@ -108,7 +108,7 @@
#define smart_str_free_ex(buf, what) do { \
smart_str *__s = (smart_str *) (buf); \
if (__s->s) { \
- STR_RELEASE(__s->s); \
+ zend_string_release(__s->s); \
__s->s = NULL; \
} \
__s->a = 0; \
@@ -130,15 +130,15 @@
* #define f(..) ({char *r;..;__r;})
*/
-static inline char *smart_str_print_long(char *buf, long num) {
+static inline char *smart_str_print_long(char *buf, zend_long num) {
char *r;
- _zend_print_signed_to_buf(buf, num, long, r);
+ _zend_print_signed_to_buf(buf, num, zend_long, r);
return r;
}
-static inline char *smart_str_print_unsigned(char *buf, long num) {
+static inline char *smart_str_print_unsigned(char *buf, zend_long num) {
char *r;
- _zend_print_unsigned_to_buf(buf, num, unsigned long, r);
+ _zend_print_unsigned_to_buf(buf, num, zend_ulong, r);
return r;
}
@@ -150,17 +150,19 @@ static inline char *smart_str_print_unsigned(char *buf, long num) {
} while (0)
#define smart_str_append_unsigned_ex(dest, num, type) \
- smart_str_append_generic_ex((dest), (num), (type), unsigned long, _unsigned)
+ smart_str_append_generic_ex((dest), (num), (type), zend_ulong, _unsigned)
#define smart_str_append_long_ex(dest, num, type) \
- smart_str_append_generic_ex((dest), (num), (type), unsigned long, _signed)
+ smart_str_append_generic_ex((dest), (num), (type), zend_ulong, _signed)
#define smart_str_append_off_t_ex(dest, num, type) \
- smart_str_append_generic_ex((dest), (num), (type), off_t, _signed)
+ smart_str_append_generic_ex((dest), (num), (type), zend_off_t, _signed)
-#define smart_str_append_ex(dest, src, what) \
- smart_str_appendl_ex((dest), ((smart_str *)(src))->s->val, \
- ((smart_str *)(src))->s->len, (what));
+#define smart_str_append_ex(dest, src, what) do { \
+ if ((src)->s && (src)->s->len) { \
+ smart_str_appendl_ex((dest), (src)->s->val, (src)->s->len, (what)); \
+ } \
+} while(0)
#define smart_str_setl(dest, src, nlen) do { \
smart_str_free((dest)); \