zend_error(E_WARNING, "Value for %s is no string", key); \
smart_str_appends(str, "[unknown]"); \
} else { \
- smart_str_appendl(str, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); \
+ smart_str_append(str, Z_STR_P(tmp)); \
} \
} \
} while (0)
case IS_ARRAY:
smart_str_appends(str, "Array, ");
break;
- case IS_OBJECT: {
- zend_string *class_name = zend_get_object_classname(Z_OBJ_P(arg) TSRMLS_CC);
-
+ case IS_OBJECT:
smart_str_appends(str, "Object(");
- smart_str_appendl(str, class_name->val, class_name->len);
+ smart_str_append(str, zend_get_object_classname(Z_OBJ_P(arg) TSRMLS_CC));
smart_str_appends(str, "), ");
break;
- }
}
}
/* }}} */
} else {
line = 0;
}
- smart_str_appendl(str, Z_STRVAL_P(file), Z_STRLEN_P(file));
+ smart_str_append(str, Z_STR_P(file));
smart_str_appendc(str, '(');
smart_str_append_long(str, line);
smart_str_appends(str, "): ");
}
if (fptr->common.scope) {
- smart_str_appendl(&str, fptr->common.scope->name->val, fptr->common.scope->name->len);
+ smart_str_append(&str, fptr->common.scope->name);
smart_str_appends(&str, "::");
}
- smart_str_appendl(&str, fptr->common.function_name->val, fptr->common.function_name->len);
+ smart_str_append(&str, fptr->common.function_name);
smart_str_appendc(&str, '(');
if (fptr->common.arg_info) {
zval *zv = precv->op2.zv;
if (Z_TYPE_P(zv) == IS_CONSTANT) {
- smart_str_appendl(&str, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
+ smart_str_append(&str, Z_STR_P(zv));
} else if (Z_TYPE_P(zv) == IS_FALSE) {
smart_str_appends(&str, "false");
} else if (Z_TYPE_P(zv) == IS_TRUE) {
smart_str_appends(&str, "<expression>");
} else {
zend_string *zv_str = zval_get_string(zv);
- smart_str_appendl(&str, zv_str->val, zv_str->len);
+ smart_str_append(&str, zv_str);
zend_string_release(zv_str);
}
}
smart_str_appendc_ex((dest), (c), 0)
#define smart_str_appendl(dest, src, len) \
smart_str_appendl_ex((dest), (src), (len), 0)
+#define smart_str_append(dest, src) \
+ smart_str_append_ex((dest), (src), 0)
#define smart_str_append_smart_str(dest, src) \
smart_str_append_smart_str_ex((dest), (src), 0)
#define smart_str_sets(dest, src) \
dest->s->len = new_len;
}
+static zend_always_inline void smart_str_append_ex(smart_str *dest, const zend_string *src, zend_bool persistent) {
+ smart_str_appendl_ex(dest, src->val, src->len, persistent);
+}
+
static zend_always_inline void smart_str_append_smart_str_ex(smart_str *dest, const smart_str *src, zend_bool persistent) {
if (src->s && src->s->len) {
- smart_str_appendl_ex(dest, src->s->val, src->s->len, persistent);
+ smart_str_append_ex(dest, src->s, persistent);
}
}
#define _PHP_CURL_H
#include "php.h"
-#include "zend_smart_str_public.h"
+#include "zend_smart_str.h"
#ifdef COMPILE_DL_CURL
#undef HAVE_CURL
#include <unicode/utypes.h>
#include <unicode/parseerr.h>
-#include <zend_smart_str_public.h>
+#include <zend_smart_str.h>
#define INTL_ERROR_CODE(e) (e).code
#include <unicode/utypes.h>
#include <unicode/utrans.h>
-#include "zend_smart_str_public.h"
+#include "zend_smart_str.h"
void transliterator_register_constants( INIT_FUNC_ARGS );
smart_str transliterator_parse_error_to_string( UParseError* pe );
}
smart_str_appendc(&csvline, enclosure);
} else {
- smart_str_appendl(&csvline, field_str->val, field_str->len);
+ smart_str_append(&csvline, field_str);
}
if (++i != count) {
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) {
convert_to_string_ex(tmp);
smart_str_appendc(&tags_ss, '<');
- smart_str_appendl(&tags_ss, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
+ smart_str_append(&tags_ss, Z_STR_P(tmp));
smart_str_appendc(&tags_ss, '>');
} ZEND_HASH_FOREACH_END();
smart_str_0(&tags_ss);
} else {
ekey = php_url_encode(prop_name, prop_len);
}
- smart_str_appendl(formstr, ekey->val, ekey->len);
+ smart_str_append(formstr, ekey);
zend_string_free(ekey);
} else {
- char *ekey;
- int ekey_len;
/* Numeric key */
if (num_prefix) {
smart_str_appendl(formstr, num_prefix, num_prefix_len);
}
- ekey_len = spprintf(&ekey, 0, "%pd", idx);
- smart_str_appendl(formstr, ekey, ekey_len);
- efree(ekey);
+ smart_str_append_long(formstr, idx);
}
smart_str_appendl(formstr, key_suffix, key_suffix_len);
smart_str_appendl(formstr, "=", 1);
} else {
ekey = php_url_encode(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata));
}
- smart_str_appendl(formstr, ekey->val, ekey->len);
+ smart_str_append(formstr, ekey);
zend_string_free(ekey);
}
break;
case IS_LONG:
- {
- char *ekey;
- int ekey_len;
- ekey_len = spprintf(&ekey, 0, "%pd", Z_LVAL_P(zdata));
- smart_str_appendl(formstr, ekey, ekey_len);
- efree(ekey);
- }
+ smart_str_append_long(formstr, Z_LVAL_P(zdata));
break;
case IS_FALSE:
smart_str_appendl(formstr, "0", sizeof("0")-1);
} else {
ekey = php_url_encode(Z_STRVAL(copyzval), Z_STRLEN(copyzval));
}
- smart_str_appendl(formstr, ekey->val, ekey->len);
+ smart_str_append(formstr, ekey);
zval_ptr_dtor(©zval);
zend_string_free(ekey);
}
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmpzval), tmpheader) {
if (Z_TYPE_P(tmpheader) == IS_STRING) {
- smart_str_appendl(&tmpstr, Z_STRVAL_P(tmpheader), Z_STRLEN_P(tmpheader));
+ smart_str_append(&tmpstr, Z_STR_P(tmpheader));
smart_str_appendl(&tmpstr, "\r\n", sizeof("\r\n") - 1);
}
} ZEND_HASH_FOREACH_END();
again:
switch (Z_TYPE_P(tmp)) {
case IS_STRING:
- smart_str_appendl(&implstr, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
+ smart_str_append(&implstr, Z_STR_P(tmp));
break;
case IS_LONG:
default:
str = zval_get_string(tmp);
- smart_str_appendl(&implstr, str->val, str->len);
+ smart_str_append(&implstr, str);
zend_string_release(str);
break;
}
if (++i != numelems) {
- smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim));
+ smart_str_append(&implstr, Z_STR_P(delim));
}
} ZEND_HASH_FOREACH_END();
entry = zend_hash_str_find(pats, key, len);
if (entry != NULL) {
zend_string *str = zval_get_string(entry);
- smart_str_appendl(&result, str->val, str->len);
+ smart_str_append(&result, str);
pos += len;
found = 1;
zend_string_release(str);
entry = zend_hash_str_find(pats, key, len);
if (entry != NULL) {
zend_string *str = zval_get_string(entry);
- smart_str_appendl(&result, str->val, str->len);
+ smart_str_append(&result, str);
pos += len;
found = 1;
zend_string_release(str);
}
smart_str_0(&ctx->result);
if (do_flush) {
- smart_str_appendl(&ctx->result, ctx->buf.s->val, ctx->buf.s->len);
+ smart_str_append(&ctx->result, ctx->buf.s);
*newlen += ctx->buf.s->len;
smart_str_free(&ctx->buf);
smart_str_free(&ctx->val);
} else if (BG(url_adapt_state_ex).url_app.s->len == 0) {
url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
if (ctx->buf.s && ctx->buf.s->len) {
- smart_str_appendl(&ctx->result, ctx->buf.s->val, ctx->buf.s->len);
+ smart_str_append(&ctx->result, ctx->buf.s);
smart_str_appendl(&ctx->result, output, output_len);
*handled_output = estrndup(ctx->result.s->val, ctx->result.s->len);
}
smart_str_0(&ctx->result);
if (do_flush) {
- smart_str_appendl(&ctx->result, ctx->buf.s->val, ctx->buf.s->len);
+ smart_str_append(&ctx->result, ctx->buf.s);
*newlen += ctx->buf.s->len;
smart_str_free(&ctx->buf);
smart_str_free(&ctx->val);
} else if (BG(url_adapt_state_ex).url_app.s->len == 0) {
url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
if (ctx->buf.s && ctx->buf.s->len) {
- smart_str_appendl(&ctx->result, ctx->buf.s->val, ctx->buf.s->len);
+ smart_str_append(&ctx->result, ctx->buf.s);
smart_str_appendl(&ctx->result, output, output_len);
*handled_output = estrndup(ctx->result.s->val, ctx->result.s->len);
buffer_append_spaces(buf, level + 1);
smart_str_appendc(buf, '\'');
- smart_str_appendl(buf, tmp_str->val, tmp_str->len);
+ smart_str_append(buf, tmp_str);
smart_str_appendl(buf, "' => ", 5);
zend_string_free(ckey);
pname_esc = php_addcslashes(prop_name, prop_name_len, 0, "'\\", 2 TSRMLS_CC);
smart_str_appendc(buf, '\'');
- smart_str_appendl(buf, pname_esc->val, pname_esc->len);
+ smart_str_append(buf, pname_esc);
smart_str_appendc(buf, '\'');
zend_string_release(pname_esc);
} else {
ztmp2 = php_str_to_str_ex(ztmp->val, ztmp->len, "\0", 1, "' . \"\\0\" . '", 12, 0, NULL);
smart_str_appendc(buf, '\'');
- smart_str_appendl(buf, ztmp2->val, ztmp2->len);
+ smart_str_append(buf, ztmp2);
smart_str_appendc(buf, '\'');
zend_string_free(ztmp);
}
class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc), 0 TSRMLS_CC);
- smart_str_appendl(buf, class_name->val, class_name->len);
+ smart_str_append(buf, class_name);
smart_str_appendl(buf, "::__set_state(array(\n", 21);
zend_string_release(class_name);
smart_str_appendl(buf, "O:", 2);
smart_str_append_unsigned(buf, class_name->len);
smart_str_appendl(buf, ":\"", 2);
- smart_str_appendl(buf, class_name->val, class_name->len);
+ smart_str_append(buf, class_name);
smart_str_appendl(buf, "\":", 2);
PHP_CLEANUP_CLASS_ATTRIBUTES();
return incomplete_class;
smart_str_appendl(buf, "C:", 2);
smart_str_append_unsigned(buf, Z_OBJCE_P(struc)->name->len);
smart_str_appendl(buf, ":\"", 2);
- smart_str_appendl(buf, Z_OBJCE_P(struc)->name->val, Z_OBJCE_P(struc)->name->len);
+ smart_str_append(buf, Z_OBJCE_P(struc)->name);
smart_str_appendl(buf, "\":", 2);
smart_str_append_unsigned(buf, serialized_length);