- char buf[0x20], *key_str;
- int key_len;
-
- if (key->type == HASH_KEY_IS_LONG) {
- key_len = slprintf(buf, sizeof(buf) - 1, "%ld", key->num) + 1;
- key_str = &buf[0];
- } else {
- key_len = key->len;
- key_str = key->str;
- }
if (key->type == HASH_KEY_IS_LONG) {
zend_hash_index_update(&list->extras, key->num, (void *) &arg, sizeof(zval *), NULL);
} else {
zend_hash_update(&list->extras, key->str, key->len, (void *) &arg, sizeof(zval *), NULL);
}
if (key->type == HASH_KEY_IS_LONG) {
zend_hash_index_update(&list->extras, key->num, (void *) &arg, sizeof(zval *), NULL);
} else {
zend_hash_update(&list->extras, key->str, key->len, (void *) &arg, sizeof(zval *), NULL);
}
FOREACH_HASH_KEYVAL(pos, &list->cookies, key, val) {
zval *tmp = php_http_ztyp(IS_STRING, *val);
FOREACH_HASH_KEYVAL(pos, &list->cookies, key, val) {
zval *tmp = php_http_ztyp(IS_STRING, *val);
- if (key.type == HASH_KEY_IS_STRING && key.len) {
- append_encoded(&buf, key.str, key.len-1, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
- } else if (key.type == HASH_KEY_IS_LONG) {
- int enc_len;
- char *enc_str = php_raw_url_encode(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &enc_len);
- php_http_buffer_appendf(&buf, "%ld=%.*s; ", key.num, enc_len, enc_str);
- efree(enc_str);
- }
+ php_http_array_hashkey_stringify(&key);
+ append_encoded(&buf, key.str, key.len-1, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
+ php_http_array_hashkey_stringfree(&key);
+
FOREACH_HASH_KEYVAL(pos, &list->extras, key, val) {
zval *tmp = php_http_ztyp(IS_STRING, *val);
FOREACH_HASH_KEYVAL(pos, &list->extras, key, val) {
zval *tmp = php_http_ztyp(IS_STRING, *val);
- if (key.type == HASH_KEY_IS_STRING && key.len) {
- append_encoded(&buf, key.str, key.len-1, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
- } else if (key.type == HASH_KEY_IS_LONG) {
- int enc_len;
- char *enc_str = php_raw_url_encode(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &enc_len);
- php_http_buffer_appendf(&buf, "%ld=%.*s; ", key.num, enc_len, enc_str);
- efree(enc_str);
- }
+ php_http_array_hashkey_stringify(&key);
+ append_encoded(&buf, key.str, key.len-1, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
+ php_http_array_hashkey_stringfree(&key);
+