summaryrefslogtreecommitdiff
path: root/ext/soap/php_schema.c
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2006-04-09 23:35:51 +0000
committerAndrei Zmievski <andrei@php.net>2006-04-09 23:35:51 +0000
commit06ef71fe3db45fb1cf1c556c537c98924828a4a8 (patch)
tree03e51036274ea038952e6682340c85dbab0c5e99 /ext/soap/php_schema.c
parent1e33c4cc85396bb5aefb0956e19a652aa5cbf757 (diff)
downloadphp-git-06ef71fe3db45fb1cf1c556c537c98924828a4a8.tar.gz
Speed up SoapClient/SoapServer constructors by caching WSDL structures
in memory. All WSDL files will be cached, unless turned off via an option to the constructor.
Diffstat (limited to 'ext/soap/php_schema.c')
-rw-r--r--ext/soap/php_schema.c127
1 files changed, 127 insertions, 0 deletions
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 3753245bd5..c448cf5fb7 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -2358,6 +2358,28 @@ void delete_model(void *handle)
efree(tmp);
}
+void delete_model_persistent(void *handle)
+{
+ sdlContentModelPtr tmp = *((sdlContentModelPtr*)handle);
+ switch (tmp->kind) {
+ case XSD_CONTENT_ELEMENT:
+ case XSD_CONTENT_GROUP:
+ break;
+ case XSD_CONTENT_SEQUENCE:
+ case XSD_CONTENT_ALL:
+ case XSD_CONTENT_CHOICE:
+ zend_hash_destroy(tmp->u.content);
+ free(tmp->u.content);
+ break;
+ case XSD_CONTENT_GROUP_REF:
+ free(tmp->u.group_ref);
+ break;
+ default:
+ break;
+ }
+ free(tmp);
+}
+
void delete_type(void *data)
{
sdlTypePtr type = *((sdlTypePtr*)data);
@@ -2405,6 +2427,53 @@ void delete_type(void *data)
efree(type);
}
+void delete_type_persistent(void *data)
+{
+ sdlTypePtr type = *((sdlTypePtr*)data);
+ if (type->name) {
+ free(type->name);
+ }
+ if (type->namens) {
+ free(type->namens);
+ }
+ if (type->def) {
+ free(type->def);
+ }
+ if (type->fixed) {
+ free(type->fixed);
+ }
+ if (type->elements) {
+ zend_hash_destroy(type->elements);
+ free(type->elements);
+ }
+ if (type->attributes) {
+ zend_hash_destroy(type->attributes);
+ free(type->attributes);
+ }
+ if (type->model) {
+ delete_model_persistent((void**)&type->model);
+ }
+ if (type->restrictions) {
+ delete_restriction_var_int_persistent(&type->restrictions->minExclusive);
+ delete_restriction_var_int_persistent(&type->restrictions->minInclusive);
+ delete_restriction_var_int_persistent(&type->restrictions->maxExclusive);
+ delete_restriction_var_int_persistent(&type->restrictions->maxInclusive);
+ delete_restriction_var_int_persistent(&type->restrictions->totalDigits);
+ delete_restriction_var_int_persistent(&type->restrictions->fractionDigits);
+ delete_restriction_var_int_persistent(&type->restrictions->length);
+ delete_restriction_var_int_persistent(&type->restrictions->minLength);
+ delete_restriction_var_int_persistent(&type->restrictions->maxLength);
+ delete_restriction_var_char_persistent(&type->restrictions->whiteSpace);
+ delete_restriction_var_char_persistent(&type->restrictions->pattern);
+ if (type->restrictions->enumeration) {
+ zend_hash_destroy(type->restrictions->enumeration);
+ free(type->restrictions->enumeration);
+ }
+ free(type->restrictions);
+ }
+ free(type);
+}
+
void delete_extra_attribute(void *attribute)
{
sdlExtraAttributePtr attr = *((sdlExtraAttributePtr*)attribute);
@@ -2418,6 +2487,19 @@ void delete_extra_attribute(void *attribute)
efree(attr);
}
+void delete_extra_attribute_persistent(void *attribute)
+{
+ sdlExtraAttributePtr attr = *((sdlExtraAttributePtr*)attribute);
+
+ if (attr->ns) {
+ free(attr->ns);
+ }
+ if (attr->val) {
+ free(attr->val);
+ }
+ free(attr);
+}
+
void delete_attribute(void *attribute)
{
sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
@@ -2444,6 +2526,32 @@ void delete_attribute(void *attribute)
efree(attr);
}
+void delete_attribute_persistent(void *attribute)
+{
+ sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
+
+ if (attr->def) {
+ free(attr->def);
+ }
+ if (attr->fixed) {
+ free(attr->fixed);
+ }
+ if (attr->name) {
+ free(attr->name);
+ }
+ if (attr->namens) {
+ free(attr->namens);
+ }
+ if (attr->ref) {
+ free(attr->ref);
+ }
+ if (attr->extraAttributes) {
+ zend_hash_destroy(attr->extraAttributes);
+ free(attr->extraAttributes);
+ }
+ free(attr);
+}
+
void delete_restriction_var_int(void *rvi)
{
sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
@@ -2452,6 +2560,14 @@ void delete_restriction_var_int(void *rvi)
}
}
+void delete_restriction_var_int_persistent(void *rvi)
+{
+ sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
+ if (ptr) {
+ free(ptr);
+ }
+}
+
void delete_restriction_var_char(void *srvc)
{
sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
@@ -2462,3 +2578,14 @@ void delete_restriction_var_char(void *srvc)
efree(ptr);
}
}
+
+void delete_restriction_var_char_persistent(void *srvc)
+{
+ sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
+ if (ptr) {
+ if (ptr->value) {
+ free(ptr->value);
+ }
+ free(ptr);
+ }
+}