Skip to content

Commit 1f924d7

Browse files
committed
Drop soap_hash_str_find_deref()
And directly use zend_hash_str_find_deref() instead.
1 parent 035a27c commit 1f924d7

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

ext/soap/php_encoding.c

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,6 @@ static encodePtr find_encoder_by_type_name(sdlPtr sdl, const char *type)
283283
return NULL;
284284
}
285285

286-
static zval *soap_hash_str_find_deref(HashTable *ht, const char *str, size_t len) {
287-
zval *zv = zend_hash_str_find(ht, str, len);
288-
if (!zv) {
289-
return NULL;
290-
}
291-
292-
ZVAL_DEREF(zv);
293-
return zv;
294-
}
295-
296286
static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node) {
297287
xmlNodePtr node_ptr;
298288

@@ -402,14 +392,14 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
402392
encodePtr enc = NULL;
403393
HashTable *ht = Z_OBJPROP_P(data);
404394

405-
if ((ztype = soap_hash_str_find_deref(ht, "enc_type", sizeof("enc_type")-1)) == NULL ||
395+
if ((ztype = zend_hash_str_find_deref(ht, "enc_type", sizeof("enc_type")-1)) == NULL ||
406396
Z_TYPE_P(ztype) != IS_LONG) {
407397
soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property");
408398
}
409399

410-
if ((zstype = soap_hash_str_find_deref(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL &&
400+
if ((zstype = zend_hash_str_find_deref(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL &&
411401
Z_TYPE_P(zstype) == IS_STRING) {
412-
if ((zns = soap_hash_str_find_deref(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL &&
402+
if ((zns = zend_hash_str_find_deref(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL &&
413403
Z_TYPE_P(zns) == IS_STRING) {
414404
enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_P(zns), Z_STRVAL_P(zstype));
415405
} else {
@@ -436,13 +426,13 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
436426
enc = encode;
437427
}
438428

439-
zdata = soap_hash_str_find_deref(ht, "enc_value", sizeof("enc_value")-1);
429+
zdata = zend_hash_str_find_deref(ht, "enc_value", sizeof("enc_value")-1);
440430
node = master_to_xml(enc, zdata, style, parent);
441431

442432
if (style == SOAP_ENCODED || (SOAP_GLOBAL(sdl) && encode != enc)) {
443-
if ((zstype = soap_hash_str_find_deref(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL &&
433+
if ((zstype = zend_hash_str_find_deref(ht, "enc_stype", sizeof("enc_stype")-1)) != NULL &&
444434
Z_TYPE_P(zstype) == IS_STRING) {
445-
if ((zns = soap_hash_str_find_deref(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL &&
435+
if ((zns = zend_hash_str_find_deref(ht, "enc_ns", sizeof("enc_ns")-1)) != NULL &&
446436
Z_TYPE_P(zns) == IS_STRING) {
447437
set_ns_and_type_ex(node, Z_STRVAL_P(zns), Z_STRVAL_P(zstype));
448438
} else {
@@ -451,11 +441,11 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
451441
}
452442
}
453443

454-
if ((zname = soap_hash_str_find_deref(ht, "enc_name", sizeof("enc_name")-1)) != NULL &&
444+
if ((zname = zend_hash_str_find_deref(ht, "enc_name", sizeof("enc_name")-1)) != NULL &&
455445
Z_TYPE_P(zname) == IS_STRING) {
456446
xmlNodeSetName(node, BAD_CAST(Z_STRVAL_P(zname)));
457447
}
458-
if ((znamens = soap_hash_str_find_deref(ht, "enc_namens", sizeof("enc_namens")-1)) != NULL &&
448+
if ((znamens = zend_hash_str_find_deref(ht, "enc_namens", sizeof("enc_namens")-1)) != NULL &&
459449
Z_TYPE_P(znamens) == IS_STRING) {
460450
xmlNsPtr nsp = encode_add_ns(node, Z_STRVAL_P(znamens));
461451
xmlSetNs(node, nsp);
@@ -1214,7 +1204,7 @@ static zval* get_zval_property(zval* object, char* name, zval *rv)
12141204
ZVAL_DEREF(data);
12151205
return data;
12161206
} else if (Z_TYPE_P(object) == IS_ARRAY) {
1217-
return soap_hash_str_find_deref(Z_ARRVAL_P(object), name, strlen(name));
1207+
return zend_hash_str_find_deref(Z_ARRVAL_P(object), name, strlen(name));
12181208
}
12191209
return NULL;
12201210
}
@@ -1429,7 +1419,7 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
14291419
zval *classname;
14301420
zend_class_entry *tmp;
14311421

1432-
if ((classname = soap_hash_str_find_deref(SOAP_GLOBAL(class_map), type->type_str, strlen(type->type_str))) != NULL &&
1422+
if ((classname = zend_hash_str_find_deref(SOAP_GLOBAL(class_map), type->type_str, strlen(type->type_str))) != NULL &&
14331423
Z_TYPE_P(classname) == IS_STRING &&
14341424
(tmp = zend_fetch_class(Z_STR_P(classname), ZEND_FETCH_CLASS_AUTO)) != NULL) {
14351425
ce = tmp;
@@ -3535,20 +3525,20 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type)
35353525
Z_OBJCE_P(tmp) == soap_var_class_entry) {
35363526
zval *ztype;
35373527

3538-
if ((ztype = soap_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL ||
3528+
if ((ztype = zend_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL ||
35393529
Z_TYPE_P(ztype) != IS_LONG) {
35403530
soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property");
35413531
}
35423532
cur_type = Z_LVAL_P(ztype);
35433533

3544-
if ((ztype = soap_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL &&
3534+
if ((ztype = zend_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL &&
35453535
Z_TYPE_P(ztype) == IS_STRING) {
35463536
cur_stype = Z_STRVAL_P(ztype);
35473537
} else {
35483538
cur_stype = NULL;
35493539
}
35503540

3551-
if ((ztype = soap_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_ns", sizeof("enc_ns")-1)) != NULL &&
3541+
if ((ztype = zend_hash_str_find_deref(Z_OBJPROP_P(tmp), "enc_ns", sizeof("enc_ns")-1)) != NULL &&
35523542
Z_TYPE_P(ztype) == IS_STRING) {
35533543
cur_ns = Z_STRVAL_P(ztype);
35543544
} else {

0 commit comments

Comments
 (0)