Skip to content
Snippets Groups Projects
Commit 9e78d69f authored by Craig Tiller's avatar Craig Tiller
Browse files

Start converting php

parent 3ba16e4f
No related branches found
No related tags found
No related merge requests found
...@@ -100,11 +100,11 @@ zval *grpc_parse_metadata_array(grpc_metadata_array ...@@ -100,11 +100,11 @@ zval *grpc_parse_metadata_array(grpc_metadata_array
grpc_metadata *elem; grpc_metadata *elem;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
elem = &elements[i]; elem = &elements[i];
key_len = strlen(elem->key); key_len = GRPC_SLICE_LENGTH(elem->key);
str_key = ecalloc(key_len + 1, sizeof(char)); str_key = ecalloc(key_len + 1, sizeof(char));
memcpy(str_key, elem->key, key_len); memcpy(str_key, GRPC_SLICE_START_PTR(elem->key), key_len);
str_val = ecalloc(elem->value_length + 1, sizeof(char)); str_val = ecalloc(GRPC_SLICE_LENGTH(elem->value) + 1, sizeof(char));
memcpy(str_val, elem->value, elem->value_length); memcpy(str_val, GRPC_SLICE_START_PTR(elem->value), GRPC_SLICE_LENGTH(elem->value));
if (php_grpc_zend_hash_find(array_hash, str_key, key_len, (void **)&data) if (php_grpc_zend_hash_find(array_hash, str_key, key_len, (void **)&data)
== SUCCESS) { == SUCCESS) {
if (Z_TYPE_P(data) != IS_ARRAY) { if (Z_TYPE_P(data) != IS_ARRAY) {
...@@ -115,13 +115,13 @@ zval *grpc_parse_metadata_array(grpc_metadata_array ...@@ -115,13 +115,13 @@ zval *grpc_parse_metadata_array(grpc_metadata_array
efree(str_val); efree(str_val);
return NULL; return NULL;
} }
php_grpc_add_next_index_stringl(data, str_val, elem->value_length, php_grpc_add_next_index_stringl(data, str_val, GRPC_SLICE_LENGTH(elem->value),
false); false);
} else { } else {
PHP_GRPC_MAKE_STD_ZVAL(inner_array); PHP_GRPC_MAKE_STD_ZVAL(inner_array);
array_init(inner_array); array_init(inner_array);
php_grpc_add_next_index_stringl(inner_array, str_val, php_grpc_add_next_index_stringl(inner_array, str_val,
elem->value_length, false); GRPC_SLICE_LENGTH(elem->value), false);
add_assoc_zval(array, str_key, inner_array); add_assoc_zval(array, str_key, inner_array);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment