Skip to content

Commit e2dee95

Browse files
committed
ext/soap: Reduce scope of variable
1 parent 6ddab74 commit e2dee95

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

ext/soap/php_sdl.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include)
299299
sdlPtr tmpsdl = ctx->sdl;
300300
xmlDocPtr wsdl;
301301
xmlNodePtr root, definitions, trav;
302-
xmlAttrPtr targetNamespace;
303302

304303
if (zend_hash_str_exists(&ctx->docs, struri, strlen(struri))) {
305304
return;
@@ -335,7 +334,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include)
335334
}
336335

337336
if (!include) {
338-
targetNamespace = get_attribute(definitions->properties, "targetNamespace");
337+
xmlAttrPtr targetNamespace = get_attribute(definitions->properties, "targetNamespace");
339338
if (targetNamespace) {
340339
tmpsdl->target_ns = estrdup((char*)targetNamespace->children->content);
341340
}
@@ -528,13 +527,13 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml
528527

529528
static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap_namespace, sdlSoapBindingFunctionBody *binding, HashTable* params)
530529
{
531-
xmlNodePtr body, trav;
530+
xmlNodePtr trav;
532531
xmlAttrPtr tmp;
533532

534533
trav = node->children;
535534
while (trav != NULL) {
536535
if (node_is_equal_ex(trav, "body", wsdl_soap_namespace)) {
537-
body = trav;
536+
xmlNodePtr body = trav;
538537

539538
tmp = get_attribute(body->properties, "use");
540539
if (tmp && !strncmp((char*)tmp->children->content, "literal", sizeof("literal"))) {
@@ -628,7 +627,7 @@ static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap
628627

629628
static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
630629
{
631-
xmlNodePtr trav, part, message = NULL, tmp;
630+
xmlNodePtr trav, message = NULL, tmp;
632631
HashTable* parameters = NULL;
633632
char *ctype;
634633

@@ -648,7 +647,7 @@ static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
648647

649648
trav = message->children;
650649
while (trav != NULL) {
651-
xmlAttrPtr element, type, name;
650+
xmlAttrPtr type, name;
652651
sdlParamPtr param;
653652

654653
if (trav->ns != NULL && strcmp((char*)trav->ns->href, WSDL_NAMESPACE) != 0) {
@@ -661,7 +660,7 @@ static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
661660
if (!node_is_equal(trav,"part")) {
662661
soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name));
663662
}
664-
part = trav;
663+
xmlNodePtr part = trav;
665664
param = emalloc(sizeof(sdlParam));
666665
memset(param,0,sizeof(sdlParam));
667666
param->order = 0;
@@ -677,7 +676,7 @@ static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
677676
if (type != NULL) {
678677
param->encode = get_encoder_from_prefix(ctx->sdl, part, type->children->content);
679678
} else {
680-
element = get_attribute(part->properties, "element");
679+
xmlAttrPtr element = get_attribute(part->properties, "element");
681680
if (element != NULL) {
682681
param->element = get_element(ctx->sdl, part, element->children->content);
683682
if (param->element) {
@@ -696,7 +695,6 @@ static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
696695
static sdlPtr load_wsdl(zval *this_ptr, char *struri)
697696
{
698697
sdlCtx ctx;
699-
size_t i,n;
700698

701699
memset(&ctx,0,sizeof(ctx));
702700
ctx.sdl = emalloc(sizeof(sdl));
@@ -714,10 +712,10 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
714712
load_wsdl_ex(this_ptr, struri, &ctx, 0);
715713
schema_pass2(&ctx);
716714

717-
n = zend_hash_num_elements(&ctx.services);
715+
uint32_t n = zend_hash_num_elements(&ctx.services);
718716
if (n > 0) {
719717
zend_hash_internal_pointer_reset(&ctx.services);
720-
for (i = 0; i < n; i++) {
718+
for (uint32_t i = 0; i < n; i++) {
721719
xmlNodePtr service, tmp;
722720
xmlNodePtr trav, port;
723721
int has_soap_port = 0;

0 commit comments

Comments
 (0)