summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2004-02-06 16:52:14 +0000
committerDmitry Stogov <dmitry@php.net>2004-02-06 16:52:14 +0000
commit59ab20b23bf1602ef1a911e7c5be8491723dfe77 (patch)
tree2709d653be65464af7b7360f2eb18cd7f3426973 /ext
parent9415013456c3022c39f1ac0f679acff28eab6051 (diff)
downloadphp-git-59ab20b23bf1602ef1a911e7c5be8491723dfe77.tar.gz
optimization
Diffstat (limited to 'ext')
-rw-r--r--ext/soap/php_schema.c13
-rw-r--r--ext/soap/php_sdl.c47
-rw-r--r--ext/soap/php_xml.c1
-rw-r--r--ext/soap/soap.c17
4 files changed, 46 insertions, 32 deletions
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index dbe229733d..9c219da0c6 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -1990,7 +1990,7 @@ static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrGrou
return TRUE;
}
-static void copy_extra_attribute(void *attribute)
+static void copy_extra_attribute(void *attribute)
{
sdlExtraAttributePtr *attr = (sdlExtraAttributePtr*)attribute;
sdlExtraAttributePtr new_attr;
@@ -2040,11 +2040,12 @@ static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr)
}
}
if (attr->name == NULL && attr->ref != NULL) {
- char *name, *ns;
- parse_namespace(attr->ref, &name, &ns);
- attr->name = sdl_strdup(name);
- if (name) {efree(name);}
- if (ns) {efree(ns);}
+ char *name = strrchr(attr->ref, ':');
+ if (*name) {
+ attr->name = sdl_strdup(name+1);
+ } else{
+ attr->name = sdl_strdup(attr->ref);
+ }
}
efree(attr->ref);
attr->ref = NULL;
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 88785da83b..a7636dd622 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -72,7 +72,7 @@ static sdlTypePtr get_element(sdlPtr sdl, xmlNodePtr node, const char *type)
}
}
- if (cptype) {efree(cptype);}
+ efree(cptype);
if (ns) {efree(ns);}
}
return ret;
@@ -303,12 +303,16 @@ static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap
if (!tmp) {
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing message attribute for <header>");
}
- parse_namespace(tmp->children->content, &ctype, &ns);
+
+ ctype = strrchr(tmp->children->content,':');
+ if (ctype == NULL) {
+ ctype = tmp->children->content;
+ } else {
+ ++ctype;
+ }
if (zend_hash_find(&ctx->messages, ctype, strlen(ctype)+1, (void**)&message) != SUCCESS) {
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <message> with name '%s'", tmp->children->content);
}
- if (ctype) {efree(ctype);}
- if (ns) {efree(ns);}
tmp = get_attribute(header->properties, "part");
if (!tmp) {
@@ -387,13 +391,16 @@ static HashTable* wsdl_message(sdlCtx *ctx, char* message_name)
HashTable* parameters = NULL;
char *ns, *ctype;
- parse_namespace(message_name, &ctype, &ns);
+ ctype = strrchr(message_name,':');
+ if (ctype == NULL) {
+ ctype = message_name;
+ } else {
+ ++ctype;
+ }
if (zend_hash_find(&ctx->messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <message> with name '%s'", message->children->content);
}
message = *tmp;
- if (ctype) {efree(ctype);}
- if (ns) {efree(ns);}
parameters = sdl_malloc(sizeof(HashTable));
zend_hash_init(parameters, 0, NULL, delete_paramater, SDL_PERSISTENT);
@@ -514,15 +521,17 @@ static sdlPtr load_wsdl(char *struri)
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unknown binding type");
}
- parse_namespace(bindingAttr->children->content, &ctype, &ns);
+ ctype = strrchr(bindingAttr->children->content,':');
+ if (ctype == NULL) {
+ ctype = bindingAttr->children->content;
+ } else {
+ ++ctype;
+ }
if (zend_hash_find(&ctx.bindings, ctype, strlen(ctype)+1, (void*)&tmp) != SUCCESS) {
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No <binding> element with name '%s'", ctype);
}
binding = *tmp;
- if (ns) {efree(ns);}
- if (ctype) {efree(ctype);}
-
if (tmpbinding->bindingType == BINDING_SOAP) {
sdlSoapBindingPtr soapBinding;
xmlNodePtr soapBindingNode;
@@ -560,16 +569,18 @@ static sdlPtr load_wsdl(char *struri)
if (type == NULL) {
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing 'type' attribute for <binding>");
}
- parse_namespace(type->children->content, &ctype, &ns);
+ ctype = strrchr(type->children->content,':');
+ if (ctype == NULL) {
+ ctype = type->children->content;
+ } else {
+ ++ctype;
+ }
if (zend_hash_find(&ctx.portTypes, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <portType> with name '%s'", name->children->content);
}
portType = *tmp;
- if (ctype) {efree(ctype);}
- if (ns) {efree(ns);}
-
trav2 = binding->children;
FOREACHNODE(trav2, "operation", operation) {
sdlFunctionPtr function;
@@ -669,8 +680,10 @@ static sdlPtr load_wsdl(char *struri)
} else if (input == NULL) {
function->responseName = sdl_strdup(function->functionName);
} else {
- function->responseName = sdl_malloc(strlen(function->functionName) + sizeof("Response"));
- sprintf(function->responseName, "%sResponse", function->functionName);
+ int len = strlen(function->functionName);
+ function->responseName = sdl_malloc(len + sizeof("Response"));
+ memcpy(function->responseName, function->functionName, len);
+ memcpy(function->responseName+len, "Response", sizeof("Response"));
}
if (tmpbinding->bindingType == BINDING_SOAP) {
diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
index 6fc82ec44e..c3ae5ffb81 100644
--- a/ext/soap/php_xml.c
+++ b/ext/soap/php_xml.c
@@ -46,7 +46,6 @@ static void cleanup_xml_node(xmlNodePtr node)
trav = node->children;
while (trav != NULL) {
if (del != NULL) {
-fprintf(stderr,"***garbage\n");
xmlUnlinkNode(del);
xmlFreeNode(del);
del = NULL;
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index b57d2df9a2..0febecad4d 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1271,7 +1271,8 @@ PHP_METHOD(soapserver, handle)
response_name = estrdup(function->responseName);
} else {
response_name = emalloc(Z_STRLEN(function_name) + sizeof("Response"));
- sprintf(response_name,"%sResponse",Z_STRVAL(function_name));
+ memcpy(response_name,Z_STRVAL(function_name),Z_STRLEN(function_name));
+ memcpy(response_name+Z_STRLEN(function_name),"Response",sizeof("Response"));
}
SOAP_GLOBAL(overrides) = service->mapping;
doc_return = seralize_response_call(function, response_name, service->uri, &retval, soap_headers, soap_version TSRMLS_CC);
@@ -1494,7 +1495,7 @@ PHP_METHOD(soapclient, soapclient)
php_error(E_ERROR, "Can't create SoapClient. 'location' option is requred in nonWSDL mode.");
return;
}
-
+
if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "uri", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
@@ -1502,15 +1503,15 @@ PHP_METHOD(soapclient, soapclient)
php_error(E_ERROR, "Can't create SoapClient. 'uri' option is requred in nonWSDL mode.");
return;
}
-
+
if (zend_hash_find(ht, "style", sizeof("style"), (void**)&tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_LONG &&
+ Z_TYPE_PP(tmp) == IS_LONG &&
(Z_LVAL_PP(tmp) == SOAP_RPC || Z_LVAL_PP(tmp) == SOAP_DOCUMENT)) {
add_property_long(this_ptr, "style", Z_LVAL_PP(tmp));
}
if (zend_hash_find(ht, "use", sizeof("use"), (void**)&tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_LONG &&
+ Z_TYPE_PP(tmp) == IS_LONG &&
(Z_LVAL_PP(tmp) == SOAP_LITERAL || Z_LVAL_PP(tmp) == SOAP_ENCODED)) {
add_property_long(this_ptr, "use", Z_LVAL_PP(tmp));
}
@@ -1547,7 +1548,7 @@ PHP_METHOD(soapclient, soapclient)
}
}
if (zend_hash_find(ht, "trace", sizeof("trace"), (void**)&tmp) == SUCCESS &&
- (Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG) &&
+ (Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG) &&
Z_LVAL_PP(tmp) == 1) {
add_property_long(this_ptr, "trace", 1);
}
@@ -1739,7 +1740,7 @@ PHP_METHOD(soapclient, __call)
}
if (options) {
- if (Z_TYPE_P(options) == IS_ARRAY) {
+ if (Z_TYPE_P(options) == IS_ARRAY) {
HashTable *ht = Z_ARRVAL_P(options);
zval **tmp;
@@ -1752,7 +1753,7 @@ PHP_METHOD(soapclient, __call)
Z_TYPE_PP(tmp) == IS_STRING) {
soap_action = Z_STRVAL_PP(tmp);
}
- } else if (Z_TYPE_P(options) != IS_NULL) {
+ } else if (Z_TYPE_P(options) != IS_NULL) {
php_error(E_ERROR, "Invalid arguments to SoapClient->__call");
}
}