cvs: php-src /ext/soap TODO php_encoding.c php_encoding.h php_schema.c php_sdl.c php_sdl.h php_soap.h soap.c
| From: | Dmitry Stogov | Date: | Fri, 13 Feb 2004 11:03:59 +0000 |
| Subject: | cvs: php-src /ext/soap TODO php_encoding.c php_encoding.h php_schema.c php_sdl.c php_sdl.h php_soap.h soap.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-26183@lists.php.net to get a copy of this message | ||
dmitry Fri Feb 13 06:03:59 2004 EDT
Modified files:
/php-src/ext/soap TODO php_encoding.c php_encoding.h php_schema.c
php_sdl.c php_sdl.h php_soap.h soap.c
Log:
Old in-memory WSDL cache was removed (it was already switched off by #ifdef)
http://cvs.php.net/diff.php/php-src/ext/soap/TODO?r1=1.42&r2=1.43&ty=u Index: php-src/ext/soap/TODO diff -u php-src/ext/soap/TODO:1.42 php-src/ext/soap/TODO:1.43 --- php-src/ext/soap/TODO:1.42 Thu Feb 12 11:42:34 2004 +++ php-src/ext/soap/TODO Fri Feb 13 06:03:58 2004 @@ -3,7 +3,6 @@ - make sure soapserver.map(), soap_encode_to_xml() and soap_encode_to_zval() are really need - reimplement SoapObject::__getfunctions() and SoapObject::__gettypes() to return structures instead of strings -? memory leaks (libxml and WSDL/Schema use malloc to cache WSDL) - error handling??? SOAP http://cvs.php.net/diff.php/php-src/ext/soap/php_encoding.c?r1=1.54&r2=1.55&ty=u Index: php-src/ext/soap/php_encoding.c diff -u php-src/ext/soap/php_encoding.c:1.54 php-src/ext/soap/php_encoding.c:1.55 --- php-src/ext/soap/php_encoding.c:1.54 Fri Feb 13 03:29:11 2004 +++ php-src/ext/soap/php_encoding.c Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_encoding.c,v 1.54 2004/02/13 08:29:11 dmitry Exp $ */ +/* $Id: php_encoding.c,v 1.55 2004/02/13 11:03:58 dmitry Exp $ */ #include <time.h> @@ -2609,21 +2609,6 @@ { encodePtr t = *((encodePtr*)encode); if (t->details.ns) { - sdl_free(t->details.ns); - } - if (t->details.type_str) { - sdl_free(t->details.type_str); - } - if (t->details.map) { - delete_mapping(t->details.map); - } - sdl_free(t); -} - -void delete_tmp_encoder(void *encode) -{ - encodePtr t = *((encodePtr*)encode); - if (t->details.ns) { efree(t->details.ns); } if (t->details.type_str) { http://cvs.php.net/diff.php/php-src/ext/soap/php_encoding.h?r1=1.32&r2=1.33&ty=u Index: php-src/ext/soap/php_encoding.h diff -u php-src/ext/soap/php_encoding.h:1.32 php-src/ext/soap/php_encoding.h:1.33 --- php-src/ext/soap/php_encoding.h:1.32 Fri Feb 6 09:22:33 2004 +++ php-src/ext/soap/php_encoding.h Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_encoding.h,v 1.32 2004/02/06 14:22:33 dmitry Exp $ */ +/* $Id: php_encoding.h,v 1.33 2004/02/13 11:03:58 dmitry Exp $ */ #ifndef PHP_ENCODING_H #define PHP_ENCODING_H @@ -215,7 +215,6 @@ encodePtr get_conversion_from_href_type_ex(HashTable *encoding, const char *type, int len); void delete_encoder(void *handle); -void delete_tmp_encoder(void *encode); extern encode defaultEncoding[]; http://cvs.php.net/diff.php/php-src/ext/soap/php_schema.c?r1=1.41&r2=1.42&ty=u Index: php-src/ext/soap/php_schema.c diff -u php-src/ext/soap/php_schema.c:1.41 php-src/ext/soap/php_schema.c:1.42 --- php-src/ext/soap/php_schema.c:1.41 Tue Feb 10 08:41:21 2004 +++ php-src/ext/soap/php_schema.c Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_schema.c,v 1.41 2004/02/10 13:41:21 dmitry Exp $ */ +/* $Id: php_schema.c,v 1.42 2004/02/13 11:03:58 dmitry Exp $ */ #include "php_soap.h" #include "libxml/uri.h" @@ -52,8 +52,8 @@ encodePtr enc, *enc_ptr; if (sdl->encoders == NULL) { - sdl->encoders = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, SDL_PERSISTENT); + sdl->encoders = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 0); } smart_str_appends(&nscat, ns); smart_str_appendc(&nscat, ':'); @@ -62,19 +62,19 @@ if (zend_hash_find(sdl->encoders, nscat.c, nscat.len + 1, (void**)&enc_ptr) == SUCCESS) { enc = *enc_ptr; if (enc->details.ns) { - sdl_free(enc->details.ns); + efree(enc->details.ns); } if (enc->details.type_str) { - sdl_free(enc->details.type_str); + efree(enc->details.type_str); } } else { enc_ptr = NULL; - enc = sdl_malloc(sizeof(encode)); + enc = emalloc(sizeof(encode)); } memset(enc, 0, sizeof(encode)); - enc->details.ns = sdl_strdup(ns); - enc->details.type_str = sdl_strdup(type); + enc->details.ns = estrdup(ns); + enc->details.type_str = estrdup(type); enc->details.sdl_type = cur_type; enc->to_xml = sdl_guess_convert_xml; enc->to_zval = sdl_guess_convert_zval; @@ -178,8 +178,8 @@ xmlAttrPtr tns; if (!ctx->sdl->types) { - ctx->sdl->types = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ctx->sdl->types, 0, NULL, delete_type, SDL_PERSISTENT); + ctx->sdl->types = emalloc(sizeof(HashTable)); + zend_hash_init(ctx->sdl->types, 0, NULL, delete_type, 0); } if (!ctx->attributes) { ctx->attributes = emalloc(sizeof(HashTable)); @@ -321,27 +321,27 @@ /* Anonymous type inside <element> or <restriction> */ sdlTypePtr newType, *ptr; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); newType->kind = XSD_TYPEKIND_SIMPLE; if (name != NULL) { - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); } else { - newType->name = sdl_strdup(cur_type->name); - newType->namens = sdl_strdup(cur_type->namens); + newType->name = estrdup(cur_type->name); + newType->namens = estrdup(cur_type->namens); } zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr); if (sdl->encoders == NULL) { - sdl->encoders = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, SDL_PERSISTENT); + sdl->encoders = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 0); } - cur_type->encode = sdl_malloc(sizeof(encode)); + cur_type->encode = emalloc(sizeof(encode)); memset(cur_type->encode, 0, sizeof(encode)); - cur_type->encode->details.ns = sdl_strdup(newType->namens); - cur_type->encode->details.type_str = sdl_strdup(newType->name); + cur_type->encode->details.ns = estrdup(newType->namens); + cur_type->encode->details.type_str = estrdup(newType->name); cur_type->encode->details.sdl_type = *ptr; cur_type->encode->to_xml = sdl_guess_convert_xml; cur_type->encode->to_zval = sdl_guess_convert_zval; @@ -352,18 +352,18 @@ } else if (name != NULL) { sdlTypePtr newType, *ptr; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); newType->kind = XSD_TYPEKIND_SIMPLE; - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); if (cur_type == NULL) { zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr); } else { if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_update(cur_type->elements, newType->name, strlen(newType->name)+1, &newType, sizeof(sdlTypePtr), (void **)&ptr); } @@ -427,17 +427,17 @@ if (nsptr != NULL) { sdlTypePtr newType, *tmp; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup(type); - newType->namens = sdl_strdup(nsptr->href); + newType->name = estrdup(type); + newType->namens = estrdup(nsptr->href); newType->encode = get_create_encoder(sdl, newType, (char *)nsptr->href, type); if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp); } @@ -457,15 +457,15 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'itemType' attribute and subtype"); } - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup("anonymous"); - newType->namens = sdl_strdup(tsn->children->content); + newType->name = estrdup("anonymous"); + newType->namens = estrdup(tsn->children->content); if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp); @@ -514,17 +514,17 @@ if (nsptr != NULL) { sdlTypePtr newType, *tmp; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup(type); - newType->namens = sdl_strdup(nsptr->href); + newType->name = estrdup(type); + newType->namens = estrdup(nsptr->href); newType->encode = get_create_encoder(sdl, newType, (char *)nsptr->href, type); if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp); } @@ -549,15 +549,15 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: union has both 'memberTypes' attribute and subtypes"); } - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup("anonymous"); - newType->namens = sdl_strdup(tsn->children->content); + newType->name = estrdup("anonymous"); + newType->namens = estrdup(tsn->children->content); if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp); @@ -648,7 +648,7 @@ } if (cur_type->restrictions == NULL) { - cur_type->restrictions = sdl_malloc(sizeof(sdlRestrictions)); + cur_type->restrictions = emalloc(sizeof(sdlRestrictions)); memset(cur_type->restrictions, 0, sizeof(sdlRestrictions)); } @@ -689,8 +689,8 @@ schema_restriction_var_char(trav, &enumval); if (cur_type->restrictions->enumeration == NULL) { - cur_type->restrictions->enumeration = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_restriction_var_char, SDL_PERSISTENT); + cur_type->restrictions->enumeration = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_restriction_var_char, 0); } zend_hash_add(cur_type->restrictions->enumeration, enumval->value, strlen(enumval->value)+1, &enumval, sizeof(sdlRestrictionCharPtr), NULL); } else { @@ -796,7 +796,7 @@ xmlAttrPtr fixed, value; if ((*valptr) == NULL) { - (*valptr) = sdl_malloc(sizeof(sdlRestrictionInt)); + (*valptr) = emalloc(sizeof(sdlRestrictionInt)); } memset((*valptr), 0, sizeof(sdlRestrictionInt)); @@ -823,7 +823,7 @@ xmlAttrPtr fixed, value; if ((*valptr) == NULL) { - (*valptr) = sdl_malloc(sizeof(sdlRestrictionChar)); + (*valptr) = emalloc(sizeof(sdlRestrictionChar)); } memset((*valptr), 0, sizeof(sdlRestrictionChar)); @@ -841,7 +841,7 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: missing restriction value"); } - (*valptr)->value = sdl_strdup(value->children->content); + (*valptr)->value = estrdup(value->children->content); return TRUE; } @@ -985,10 +985,10 @@ xmlAttrPtr attr; sdlContentModelPtr newModel; - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_ALL; - newModel->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newModel->u.content, 0, NULL, delete_model, SDL_PERSISTENT); + newModel->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(newModel->u.content, 0, NULL, delete_model, 0); if (model == NULL) { cur_type->model = newModel; } else { @@ -1072,17 +1072,17 @@ smart_str_appends(&key, type); smart_str_0(&key); - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_GROUP_REF; newModel->u.group_ref = estrdup(key.c); if (type) {efree(type);} if (ns) {efree(ns);} } else { - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_SEQUENCE; /* will be redefined */ - newModel->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newModel->u.content, 0, NULL, delete_model, SDL_PERSISTENT); + newModel->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(newModel->u.content, 0, NULL, delete_model, 0); smart_str_appends(&key, ns->children->content); smart_str_appendc(&key, ':'); @@ -1093,12 +1093,12 @@ if (cur_type == NULL) { sdlTypePtr newType; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); if (sdl->groups == NULL) { - sdl->groups = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->groups, 0, NULL, delete_type, SDL_PERSISTENT); + sdl->groups = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->groups, 0, NULL, delete_type, 0); } if (zend_hash_add(sdl->groups, key.c, key.len+1, (void**)&newType, sizeof(sdlTypePtr), NULL) != SUCCESS) { php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group '%s' already defined",key.c); @@ -1185,10 +1185,10 @@ xmlAttrPtr attr; sdlContentModelPtr newModel; - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_CHOICE; - newModel->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newModel->u.content, 0, NULL, delete_model, SDL_PERSISTENT); + newModel->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(newModel->u.content, 0, NULL, delete_model, 0); if (model == NULL) { cur_type->model = newModel; } else { @@ -1251,10 +1251,10 @@ xmlAttrPtr attr; sdlContentModelPtr newModel; - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_SEQUENCE; - newModel->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newModel->u.content, 0, NULL, delete_model, SDL_PERSISTENT); + newModel->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(newModel->u.content, 0, NULL, delete_model, 0); if (model == NULL) { cur_type->model = newModel; } else { @@ -1376,27 +1376,27 @@ /* Anonymous type inside <element> */ sdlTypePtr newType, *ptr; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); newType->kind = XSD_TYPEKIND_COMPLEX; if (name != NULL) { - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); } else { - newType->name = sdl_strdup(cur_type->name); - newType->namens = sdl_strdup(cur_type->namens); + newType->name = estrdup(cur_type->name); + newType->namens = estrdup(cur_type->namens); } zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr); if (sdl->encoders == NULL) { - sdl->encoders = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, SDL_PERSISTENT); + sdl->encoders = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 0); } - cur_type->encode = sdl_malloc(sizeof(encode)); + cur_type->encode = emalloc(sizeof(encode)); memset(cur_type->encode, 0, sizeof(encode)); - cur_type->encode->details.ns = sdl_strdup(newType->namens); - cur_type->encode->details.type_str = sdl_strdup(newType->name); + cur_type->encode->details.ns = estrdup(newType->namens); + cur_type->encode->details.type_str = estrdup(newType->name); cur_type->encode->details.sdl_type = *ptr; cur_type->encode->to_xml = sdl_guess_convert_xml; cur_type->encode->to_zval = sdl_guess_convert_zval; @@ -1407,11 +1407,11 @@ } else if (name) { sdlTypePtr newType, *ptr; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); newType->kind = XSD_TYPEKIND_COMPLEX; - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr); @@ -1510,7 +1510,7 @@ sdlTypePtr newType; smart_str key = {0}; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); if (ref) { @@ -1523,26 +1523,26 @@ if (nsptr != NULL) { smart_str_appends(&nscat, nsptr->href); smart_str_appendc(&nscat, ':'); - newType->namens = sdl_strdup(nsptr->href); + newType->namens = estrdup(nsptr->href); } smart_str_appends(&nscat, type); - newType->name = sdl_strdup(type); + newType->name = estrdup(type); smart_str_0(&nscat); if (type) {efree(type);} if (ns) {efree(ns);} newType->ref = estrdup(nscat.c); smart_str_free(&nscat); } else { - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); } newType->nillable = FALSE; if (cur_type == NULL) { if (sdl->elements == NULL) { - sdl->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->elements, 0, NULL, delete_type, SDL_PERSISTENT); + sdl->elements = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->elements, 0, NULL, delete_type, 0); } addHash = sdl->elements; smart_str_appends(&key, newType->namens); @@ -1550,8 +1550,8 @@ smart_str_appends(&key, newType->name); } else { if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } addHash = cur_type->elements; smart_str_appends(&key, newType->name); @@ -1568,7 +1568,7 @@ smart_str_free(&key); if (model != NULL) { - sdlContentModelPtr newModel = sdl_malloc(sizeof(sdlContentModel)); + sdlContentModelPtr newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_ELEMENT; newModel->u.element = newType; @@ -1618,7 +1618,7 @@ if (ref != NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'fixed' attributes"); } - cur_type->fixed = sdl_strdup(attr->children->content); + cur_type->fixed = estrdup(attr->children->content); } attr = get_attribute(attrs, "default"); @@ -1628,7 +1628,7 @@ } else if (ref != NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'default' and 'fixed' attributes"); } - cur_type->def = sdl_strdup(attr->children->content); + cur_type->def = estrdup(attr->children->content); } /* type = QName */ @@ -1717,7 +1717,7 @@ HashTable *addHash; smart_str key = {0}; - newAttr = sdl_malloc(sizeof(sdlAttribute)); + newAttr = emalloc(sizeof(sdlAttribute)); memset(newAttr, 0, sizeof(sdlAttribute)); if (ref) { @@ -1754,8 +1754,8 @@ addHash = ctx->attributes; } else { if (cur_type->attributes == NULL) { - cur_type->attributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, SDL_PERSISTENT); + cur_type->attributes = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 0); } addHash = cur_type->attributes; } @@ -1789,9 +1789,9 @@ attr = attrType->properties; while (attr != NULL) { if (attr_is_equal_ex(attr, "default", SCHEMA_NAMESPACE)) { - newAttr->def = sdl_strdup(attr->children->content); + newAttr->def = estrdup(attr->children->content); } else if (attr_is_equal_ex(attr, "fixed", SCHEMA_NAMESPACE)) { - newAttr->fixed = sdl_strdup(attr->children->content); + newAttr->fixed = estrdup(attr->children->content); } else if (attr_is_equal_ex(attr, "form", SCHEMA_NAMESPACE)) { if (strncmp(attr->children->content,"qualified",sizeof("qualified")) == 0) { newAttr->form = XSD_FORM_QUALIFIED; @@ -1803,7 +1803,7 @@ } else if (attr_is_equal_ex(attr, "id", SCHEMA_NAMESPACE)) { /* skip */ } else if (attr_is_equal_ex(attr, "name", SCHEMA_NAMESPACE)) { - newAttr->name = sdl_strdup(attr->children->content); + newAttr->name = estrdup(attr->children->content); } else if (attr_is_equal_ex(attr, "ref", SCHEMA_NAMESPACE)) { /* already processed */ } else if (attr_is_equal_ex(attr, "type", SCHEMA_NAMESPACE)) { @@ -1827,22 +1827,22 @@ xmlNsPtr nsptr; char *value, *ns; - ext = sdl_malloc(sizeof(sdlExtraAttribute)); + ext = emalloc(sizeof(sdlExtraAttribute)); memset(ext, 0, sizeof(sdlExtraAttribute)); parse_namespace(attr->children->content, &value, &ns); nsptr = xmlSearchNs(attr->doc, attr->parent, ns); if (nsptr) { - ext->ns = sdl_strdup(nsptr->href); - ext->val = sdl_strdup(value); + ext->ns = estrdup(nsptr->href); + ext->val = estrdup(value); } else { - ext->val = sdl_strdup(attr->children->content); + ext->val = estrdup(attr->children->content); } if (ns) {efree(ns);} efree(value); if (!newAttr->extraAttributes) { - newAttr->extraAttributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newAttr->extraAttributes, 0, NULL, delete_extra_attribute, SDL_PERSISTENT); + newAttr->extraAttributes = emalloc(sizeof(HashTable)); + zend_hash_init(newAttr->extraAttributes, 0, NULL, delete_extra_attribute, 0); } smart_str_appends(&key2, nsPtr->href); @@ -1869,10 +1869,10 @@ } else if (type != NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has both 'type' attribute and subtype"); } - dummy_type = sdl_malloc(sizeof(sdlType)); + dummy_type = emalloc(sizeof(sdlType)); memset(dummy_type, 0, sizeof(sdlType)); - dummy_type->name = sdl_strdup("anonymous"); - dummy_type->namens = sdl_strdup(tsn->children->content); + dummy_type->name = estrdup("anonymous"); + dummy_type->namens = estrdup(tsn->children->content); schema_simpleType(sdl, tsn, trav, dummy_type); newAttr->encode = dummy_type->encode; delete_type(&dummy_type); @@ -1905,10 +1905,10 @@ if (ns == NULL) { ns = tsn; } - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); smart_str_appends(&key, newType->namens); smart_str_appendc(&key, ':'); @@ -1927,10 +1927,10 @@ xmlNsPtr nsptr; if (cur_type->attributes == NULL) { - cur_type->attributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, SDL_PERSISTENT); + cur_type->attributes = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 0); } - newAttr = sdl_malloc(sizeof(sdlAttribute)); + newAttr = emalloc(sizeof(sdlAttribute)); memset(newAttr, 0, sizeof(sdlAttribute)); parse_namespace(ref->children->content, &group_name, &ns); @@ -1988,14 +1988,14 @@ sdlExtraAttributePtr *attr = (sdlExtraAttributePtr*)attribute; sdlExtraAttributePtr new_attr; - new_attr = sdl_malloc(sizeof(sdlExtraAttribute)); + new_attr = emalloc(sizeof(sdlExtraAttribute)); memcpy(new_attr, *attr, sizeof(sdlExtraAttribute)); *attr = new_attr; if (new_attr->ns) { - new_attr->ns = sdl_strdup(new_attr->ns); + new_attr->ns = estrdup(new_attr->ns); } if (new_attr->val) { - new_attr->val = sdl_strdup(new_attr->val); + new_attr->val = estrdup(new_attr->val); } } @@ -2008,13 +2008,13 @@ if (zend_hash_find(ctx->attributes, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) { schema_attribute_fixup(ctx, *tmp); if ((*tmp)->name != NULL && attr->name == NULL) { - attr->name = sdl_strdup((*tmp)->name); + attr->name = estrdup((*tmp)->name); } if ((*tmp)->def != NULL && attr->def == NULL) { - attr->def = sdl_strdup((*tmp)->def); + attr->def = estrdup((*tmp)->def); } if ((*tmp)->fixed != NULL && attr->fixed == NULL) { - attr->fixed = sdl_strdup((*tmp)->fixed); + attr->fixed = estrdup((*tmp)->fixed); } if (attr->form == XSD_FORM_DEFAULT) { attr->form = (*tmp)->form; @@ -2025,8 +2025,8 @@ if ((*tmp)->extraAttributes != NULL) { xmlNodePtr node; - attr->extraAttributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(attr->extraAttributes, 0, NULL, delete_extra_attribute, SDL_PERSISTENT); + attr->extraAttributes = emalloc(sizeof(HashTable)); + zend_hash_init(attr->extraAttributes, 0, NULL, delete_extra_attribute, 0); zend_hash_copy(attr->extraAttributes, (*tmp)->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr)); } attr->encode = (*tmp)->encode; @@ -2035,9 +2035,9 @@ if (attr->name == NULL && attr->ref != NULL) { char *name = strrchr(attr->ref, ':'); if (*name) { - attr->name = sdl_strdup(name+1); + attr->name = estrdup(name+1); } else{ - attr->name = sdl_strdup(attr->ref); + attr->name = estrdup(attr->ref); } } efree(attr->ref); @@ -2063,15 +2063,15 @@ schema_attribute_fixup(ctx,*tmp_attr); - newAttr = sdl_malloc(sizeof(sdlAttribute)); + newAttr = emalloc(sizeof(sdlAttribute)); memcpy(newAttr, *tmp_attr, sizeof(sdlAttribute)); - if (newAttr->def) {newAttr->def = sdl_strdup(newAttr->def);} - if (newAttr->fixed) {newAttr->fixed = sdl_strdup(newAttr->fixed);} - if (newAttr->name) {newAttr->name = sdl_strdup(newAttr->name);} + if (newAttr->def) {newAttr->def = estrdup(newAttr->def);} + if (newAttr->fixed) {newAttr->fixed = estrdup(newAttr->fixed);} + if (newAttr->name) {newAttr->name = estrdup(newAttr->name);} if (newAttr->extraAttributes) { xmlNodePtr node; - HashTable *ht = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ht, 0, NULL, delete_extra_attribute, SDL_PERSISTENT); + HashTable *ht = emalloc(sizeof(HashTable)); + zend_hash_init(ht, 0, NULL, delete_extra_attribute, 0); zend_hash_copy(ht, newAttr->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr)); newAttr->extraAttributes = ht; } @@ -2235,37 +2235,37 @@ case XSD_CONTENT_ALL: case XSD_CONTENT_CHOICE: zend_hash_destroy(tmp->u.content); - sdl_free(tmp->u.content); + efree(tmp->u.content); break; case XSD_CONTENT_GROUP_REF: efree(tmp->u.group_ref); break; } - sdl_free(tmp); + efree(tmp); } void delete_type(void *data) { sdlTypePtr type = *((sdlTypePtr*)data); if (type->name) { - sdl_free(type->name); + efree(type->name); } if (type->namens) { - sdl_free(type->namens); + efree(type->namens); } if (type->def) { - sdl_free(type->def); + efree(type->def); } if (type->fixed) { - sdl_free(type->fixed); + efree(type->fixed); } if (type->elements) { zend_hash_destroy(type->elements); - sdl_free(type->elements); + efree(type->elements); } if (type->attributes) { zend_hash_destroy(type->attributes); - sdl_free(type->attributes); + efree(type->attributes); } if (type->model) { delete_model((void**)&type->model); @@ -2284,11 +2284,11 @@ delete_restriction_var_char(&type->restrictions->pattern); if (type->restrictions->enumeration) { zend_hash_destroy(type->restrictions->enumeration); - sdl_free(type->restrictions->enumeration); + efree(type->restrictions->enumeration); } - sdl_free(type->restrictions); + efree(type->restrictions); } - sdl_free(type); + efree(type); } void delete_extra_attribute(void *attribute) @@ -2296,12 +2296,12 @@ sdlExtraAttributePtr attr = *((sdlExtraAttributePtr*)attribute); if (attr->ns) { - sdl_free(attr->ns); + efree(attr->ns); } if (attr->val) { - sdl_free(attr->val); + efree(attr->val); } - sdl_free(attr); + efree(attr); } void delete_attribute(void *attribute) @@ -2309,29 +2309,29 @@ sdlAttributePtr attr = *((sdlAttributePtr*)attribute); if (attr->def) { - sdl_free(attr->def); + efree(attr->def); } if (attr->fixed) { - sdl_free(attr->fixed); + efree(attr->fixed); } if (attr->name) { - sdl_free(attr->name); + efree(attr->name); } if (attr->ref) { - sdl_free(attr->ref); + efree(attr->ref); } if (attr->extraAttributes) { zend_hash_destroy(attr->extraAttributes); - sdl_free(attr->extraAttributes); + efree(attr->extraAttributes); } - sdl_free(attr); + efree(attr); } void delete_restriction_var_int(void *rvi) { sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi); if (ptr) { - sdl_free(ptr); + efree(ptr); } } @@ -2340,8 +2340,8 @@ sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc); if (ptr) { if (ptr->value) { - sdl_free(ptr->value); + efree(ptr->value); } - sdl_free(ptr); + efree(ptr); } } http://cvs.php.net/diff.php/php-src/ext/soap/php_sdl.c?r1=1.57&r2=1.58&ty=u Index: php-src/ext/soap/php_sdl.c diff -u php-src/ext/soap/php_sdl.c:1.57 php-src/ext/soap/php_sdl.c:1.58 --- php-src/ext/soap/php_sdl.c:1.57 Thu Feb 12 11:42:34 2004 +++ php-src/ext/soap/php_sdl.c Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_sdl.c,v 1.57 2004/02/12 16:42:34 dmitry Exp $ */ +/* $Id: php_sdl.c,v 1.58 2004/02/13 11:03:58 dmitry Exp $ */ #include "php_soap.h" #include "libxml/uri.h" @@ -199,7 +199,7 @@ if (!include) { targetNamespace = get_attribute(definitions->properties, "targetNamespace"); if (targetNamespace) { - tmpsdl->target_ns = sdl_strdup(targetNamespace->children->content); + tmpsdl->target_ns = estrdup(targetNamespace->children->content); } } @@ -303,13 +303,13 @@ tmp = get_attribute(body->properties, "namespace"); if (tmp) { - binding->ns = sdl_strdup(tmp->children->content); + binding->ns = estrdup(tmp->children->content); } tmp = get_attribute(body->properties, "parts"); if (tmp) { whiteSpace_collapse(tmp->children->content); - binding->parts = sdl_strdup(tmp->children->content); + binding->parts = estrdup(tmp->children->content); } if (binding->use == SOAP_ENCODED) { @@ -321,7 +321,7 @@ } else if (tmp == NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unspecified encodingStyle"); } else { - binding->encodingStyle = sdl_strdup(tmp->children->content); + binding->encodingStyle = estrdup(tmp->children->content); } } } else if (node_is_equal_ex(trav, "header", wsdl_soap_namespace)) { @@ -356,9 +356,9 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing part '%s' in <message>",tmp->children->content); } - h = sdl_malloc(sizeof(sdlSoapBindingFunctionHeader)); + h = emalloc(sizeof(sdlSoapBindingFunctionHeader)); memset(h, 0, sizeof(sdlSoapBindingFunctionHeader)); - h->name = sdl_strdup(tmp->children->content); + h->name = estrdup(tmp->children->content); tmp = get_attribute(part->properties, "type"); if (tmp != NULL) { @@ -382,7 +382,7 @@ tmp = get_attribute(header->properties, "namespace"); if (tmp) { - h->ns = sdl_strdup(tmp->children->content); + h->ns = estrdup(tmp->children->content); } if (h->use == SOAP_ENCODED) { @@ -394,13 +394,13 @@ } else if (tmp == NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unspecified encodingStyle"); } else { - h->encodingStyle = sdl_strdup(tmp->children->content); + h->encodingStyle = estrdup(tmp->children->content); } } if (binding->headers == NULL) { - binding->headers = sdl_malloc(sizeof(HashTable)); - zend_hash_init(binding->headers, 0, NULL, delete_header, SDL_PERSISTENT); + binding->headers = emalloc(sizeof(HashTable)); + zend_hash_init(binding->headers, 0, NULL, delete_header, 0); } if (h->ns) { @@ -437,8 +437,8 @@ } message = *tmp; - parameters = sdl_malloc(sizeof(HashTable)); - zend_hash_init(parameters, 0, NULL, delete_parameter, SDL_PERSISTENT); + parameters = emalloc(sizeof(HashTable)); + zend_hash_init(parameters, 0, NULL, delete_parameter, 0); trav = message->children; while (trav != NULL) { @@ -456,7 +456,7 @@ php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav->name); } part = trav; - param = sdl_malloc(sizeof(sdlParam)); + param = emalloc(sizeof(sdlParam)); memset(param,0,sizeof(sdlParam)); param->order = 0; @@ -465,7 +465,7 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No name associated with <part> '%s'", message->name); } - param->paramName = sdl_strdup(name->children->content); + param->paramName = estrdup(name->children->content); type = get_attribute(part->properties, "type"); if (type != NULL) { @@ -493,10 +493,10 @@ int i,n; memset(&ctx,0,sizeof(ctx)); - ctx.sdl = sdl_malloc(sizeof(sdl)); + ctx.sdl = emalloc(sizeof(sdl)); memset(ctx.sdl, 0, sizeof(sdl)); - ctx.sdl->source = sdl_strdup(struri); - zend_hash_init(&ctx.sdl->functions, 0, NULL, delete_function, SDL_PERSISTENT); + ctx.sdl->source = estrdup(struri); + zend_hash_init(&ctx.sdl->functions, 0, NULL, delete_function, 0); zend_hash_init(&ctx.docs, 0, NULL, delete_document, 0); zend_hash_init(&ctx.messages, 0, NULL, NULL, 0); @@ -536,7 +536,7 @@ port = trav; - tmpbinding = sdl_malloc(sizeof(sdlBinding)); + tmpbinding = emalloc(sizeof(sdlBinding)); memset(tmpbinding, 0, sizeof(sdlBinding)); bindingAttr = get_attribute(port->properties, "binding"); @@ -583,7 +583,7 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No location associated with <port>"); } - tmpbinding->location = sdl_strdup(location->children->content); + tmpbinding->location = estrdup(location->children->content); ctype = strrchr(bindingAttr->children->content,':'); if (ctype == NULL) { @@ -601,7 +601,7 @@ xmlNodePtr soapBindingNode; xmlAttrPtr tmp; - soapBinding = sdl_malloc(sizeof(sdlSoapBinding)); + soapBinding = emalloc(sizeof(sdlSoapBinding)); memset(soapBinding, 0, sizeof(sdlSoapBinding)); soapBinding->style = SOAP_DOCUMENT; @@ -617,7 +617,7 @@ if (strncmp(tmp->children->content, WSDL_HTTP_TRANSPORT, sizeof(WSDL_HTTP_TRANSPORT))) { php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support transport '%s'", tmp->children->content); } - soapBinding->transport = sdl_strdup(tmp->children->content); + soapBinding->transport = estrdup(tmp->children->content); } } tmpbinding->bindingAttributes = (void *)soapBinding; @@ -627,7 +627,7 @@ if (name == NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing 'name' attribute for <binding>"); } - tmpbinding->name = sdl_strdup(name->children->content); + tmpbinding->name = estrdup(name->children->content); type = get_attribute(binding->properties, "type"); if (type == NULL) { @@ -688,8 +688,8 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <portType>/<operation> with name '%s'", op_name->children->content); } - function = sdl_malloc(sizeof(sdlFunction)); - function->functionName = sdl_strdup(op_name->children->content); + function = emalloc(sizeof(sdlFunction)); + function->functionName = estrdup(op_name->children->content); function->requestParameters = NULL; function->responseParameters = NULL; function->responseName = NULL; @@ -702,7 +702,7 @@ xmlNodePtr soapOperation; xmlAttrPtr tmp; - soapFunctionBinding = sdl_malloc(sizeof(sdlSoapBindingFunction)); + soapFunctionBinding = emalloc(sizeof(sdlSoapBindingFunction)); memset(soapFunctionBinding, 0, sizeof(sdlSoapBindingFunction)); soapBinding = (sdlSoapBindingPtr)tmpbinding->bindingAttributes; soapFunctionBinding->style = soapBinding->style; @@ -711,7 +711,7 @@ if (soapOperation) { tmp = get_attribute(soapOperation->properties, "soapAction"); if (tmp) { - soapFunctionBinding->soapAction = sdl_strdup(tmp->children->content); + soapFunctionBinding->soapAction = estrdup(tmp->children->content); } tmp = get_attribute(soapOperation->properties, "style"); @@ -741,9 +741,9 @@ name = get_attribute(input->properties, "name"); if (name != NULL) { - function->requestName = sdl_strdup(name->children->content); + function->requestName = estrdup(name->children->content); } else { - function->requestName = sdl_strdup(function->functionName); + function->requestName = estrdup(function->functionName); } if (tmpbinding->bindingType == BINDING_SOAP) { @@ -767,12 +767,12 @@ name = get_attribute(output->properties, "name"); if (name != NULL) { - function->responseName = sdl_strdup(name->children->content); + function->responseName = estrdup(name->children->content); } else if (input == NULL) { - function->responseName = sdl_strdup(function->functionName); + function->responseName = estrdup(function->functionName); } else { int len = strlen(function->functionName); - function->responseName = sdl_malloc(len + sizeof("Response")); + function->responseName = emalloc(len + sizeof("Response")); memcpy(function->responseName, function->functionName, len); memcpy(function->responseName+len, "Response", sizeof("Response")); } @@ -808,8 +808,8 @@ efree(tmp); if (function->requestName != NULL && strcmp(function->requestName,function->functionName) != 0) { if (ctx.sdl->requests == NULL) { - ctx.sdl->requests = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ctx.sdl->requests, 0, NULL, NULL, SDL_PERSISTENT); + ctx.sdl->requests = emalloc(sizeof(HashTable)); + zend_hash_init(ctx.sdl->requests, 0, NULL, NULL, 0); } tmp = estrdup(function->requestName); len = strlen(tmp); @@ -821,8 +821,8 @@ } if (!ctx.sdl->bindings) { - ctx.sdl->bindings = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ctx.sdl->bindings, 0, NULL, delete_binding, SDL_PERSISTENT); + ctx.sdl->bindings = emalloc(sizeof(HashTable)); + zend_hash_init(ctx.sdl->bindings, 0, NULL, delete_binding, 0); } zend_hash_add(ctx.sdl->bindings, tmpbinding->name, strlen(tmpbinding->name), &tmpbinding, sizeof(sdlBindingPtr), NULL); @@ -868,7 +868,7 @@ if (len == 0) { return NULL; } else { - s = sdl_malloc(len+1); + s = emalloc(len+1); WSDL_CACHE_GET_N(s, len, in); s[len] = '\0'; return s; @@ -902,10 +902,10 @@ attr->encode = encoders[i]; WSDL_CACHE_GET_INT(i, in); if (i > 0) { - attr->extraAttributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(attr->extraAttributes, i, NULL, delete_extra_attribute, SDL_PERSISTENT); + attr->extraAttributes = emalloc(sizeof(HashTable)); + zend_hash_init(attr->extraAttributes, i, NULL, delete_extra_attribute, 0); while (i > 0) { - sdlExtraAttributePtr x = sdl_malloc(sizeof(sdlExtraAttribute)); + sdlExtraAttributePtr x = emalloc(sizeof(sdlExtraAttribute)); sdl_deserialize_key(attr->extraAttributes, x, in); x->ns = sdl_deserialize_string(in); x->val = sdl_deserialize_string(in); @@ -917,7 +917,7 @@ static sdlRestrictionIntPtr sdl_deserialize_resriction_int(char **in) { if (**in == 1) { - sdlRestrictionIntPtr x = sdl_malloc(sizeof(sdlRestrictionInt)); + sdlRestrictionIntPtr x = emalloc(sizeof(sdlRestrictionInt)); WSDL_CACHE_SKIP(1, in); WSDL_CACHE_GET_INT(x->value, in); WSDL_CACHE_GET_1(x->fixed, char, in); @@ -931,7 +931,7 @@ static sdlRestrictionCharPtr sdl_deserialize_resriction_char(char **in) { if (**in == 1) { - sdlRestrictionCharPtr x = sdl_malloc(sizeof(sdlRestrictionChar)); + sdlRestrictionCharPtr x = emalloc(sizeof(sdlRestrictionChar)); WSDL_CACHE_SKIP(1, in); x->value = sdl_deserialize_string(in); WSDL_CACHE_GET_1(x->fixed, char, in); @@ -945,7 +945,7 @@ static sdlContentModelPtr sdl_deserialize_model(sdlTypePtr *types, sdlTypePtr *elements, char **in) { int i; - sdlContentModelPtr model = sdl_malloc(sizeof(sdlContentModel)); + sdlContentModelPtr model = emalloc(sizeof(sdlContentModel)); WSDL_CACHE_GET_1(model->kind, sdlContentKind, in); WSDL_CACHE_GET_INT(model->min_occurs, in); @@ -960,8 +960,8 @@ case XSD_CONTENT_CHOICE: WSDL_CACHE_GET_INT(i, in); if (i > 0) { - model->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(model->u.content, i, NULL, delete_model, SDL_PERSISTENT); + model->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(model->u.content, i, NULL, delete_model, 0); while (i > 0) { sdlContentModelPtr x = sdl_deserialize_model(types, elements, in); zend_hash_next_index_insert(model->u.content,&x,sizeof(sdlContentModelPtr),NULL); @@ -1000,7 +1000,7 @@ if (**in == 1) { WSDL_CACHE_SKIP(1, in); - type->restrictions = sdl_malloc(sizeof(sdlRestrictions)); + type->restrictions = emalloc(sizeof(sdlRestrictions)); /*memset(type->restrictions, 0, sizeof(sdlRestrictions));*/ type->restrictions->minExclusive = sdl_deserialize_resriction_int(in); type->restrictions->minInclusive = sdl_deserialize_resriction_int(in); @@ -1015,8 +1015,8 @@ type->restrictions->pattern = sdl_deserialize_resriction_char(in); WSDL_CACHE_GET_INT(i, in); if (i > 0) { - type->restrictions->enumeration = sdl_malloc(sizeof(HashTable)); - zend_hash_init(type->restrictions->enumeration, i, NULL, delete_restriction_var_char, SDL_PERSISTENT); + type->restrictions->enumeration = emalloc(sizeof(HashTable)); + zend_hash_init(type->restrictions->enumeration, i, NULL, delete_restriction_var_char, 0); while (i > 0) { sdlRestrictionCharPtr x = sdl_deserialize_resriction_char(in); sdl_deserialize_key(type->restrictions->enumeration, x, in); @@ -1033,10 +1033,10 @@ if (i > 0) { elements = do_alloca((i+1) * sizeof(sdlTypePtr)); elements[0] = NULL; - type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(type->elements, i, NULL, delete_type, SDL_PERSISTENT); + type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(type->elements, i, NULL, delete_type, 0); while (i > 0) { - sdlTypePtr t = sdl_malloc(sizeof(sdlType)); + sdlTypePtr t = emalloc(sizeof(sdlType)); memset(t, 0, sizeof(sdlType)); sdl_deserialize_key(type->elements, t, in); sdl_deserialize_type(t, types, encoders, in); @@ -1047,10 +1047,10 @@ WSDL_CACHE_GET_INT(i, in); if (i > 0) { - type->attributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(type->attributes, i, NULL, delete_attribute, SDL_PERSISTENT); + type->attributes = emalloc(sizeof(HashTable)); + zend_hash_init(type->attributes, i, NULL, delete_attribute, 0); while (i > 0) { - sdlAttributePtr attr = sdl_malloc(sizeof(sdlAttribute)); + sdlAttributePtr attr = emalloc(sizeof(sdlAttribute)); memset(attr, 0, sizeof(sdlAttribute)); sdl_deserialize_key(type->attributes, attr, in); sdl_deserialize_attribute(attr, encoders, in); @@ -1092,10 +1092,10 @@ body->encodingStyle = sdl_deserialize_string(in); WSDL_CACHE_GET_INT(i, in); if (i > 0) { - body->headers = sdl_malloc(sizeof(HashTable)); - zend_hash_init(body->headers, i, NULL, delete_header, SDL_PERSISTENT); + body->headers = emalloc(sizeof(HashTable)); + zend_hash_init(body->headers, i, NULL, delete_header, 0); while (i > 0) { - sdlSoapBindingFunctionHeaderPtr tmp = sdl_malloc(sizeof(sdlSoapBindingFunctionHeader)); + sdlSoapBindingFunctionHeaderPtr tmp = emalloc(sizeof(sdlSoapBindingFunctionHeader)); sdl_deserialize_key(body->headers, tmp, in); WSDL_CACHE_GET_1(tmp->use, sdlEncodingUse, in); tmp->name = sdl_deserialize_string(in); @@ -1117,10 +1117,10 @@ WSDL_CACHE_GET_INT(i, in); if (i == 0) {return NULL;} - ht = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ht, i, NULL, delete_parameter, SDL_PERSISTENT); + ht = emalloc(sizeof(HashTable)); + zend_hash_init(ht, i, NULL, delete_parameter, 0); while (i > 0) { - sdlParamPtr param = sdl_malloc(sizeof(sdlParam)); + sdlParamPtr param = emalloc(sizeof(sdlParam)); sdl_deserialize_key(ht, param, in); param->paramName = sdl_deserialize_string(in); WSDL_CACHE_GET_INT(param->order, in); @@ -1186,7 +1186,7 @@ } WSDL_CACHE_SKIP(i, &in); - sdl = sdl_malloc(sizeof(*sdl)); + sdl = emalloc(sizeof(*sdl)); memset(sdl, 0, sizeof(*sdl)); sdl->source = sdl_deserialize_string(&in); @@ -1201,7 +1201,7 @@ types = do_alloca((i+1)*sizeof(sdlTypePtr)); types[0] = NULL; while (i > 0) { - types[i] = sdl_malloc(sizeof(sdlType)); + types[i] = emalloc(sizeof(sdlType)); memset(types[i], 0, sizeof(sdlType)); i--; } @@ -1215,7 +1215,7 @@ i = num_encoders; encoders[0] = NULL; while (i > 0) { - encoders[i] = sdl_malloc(sizeof(encode)); + encoders[i] = emalloc(sizeof(encode)); memset(encoders[i], 0, sizeof(encode)); i--; } @@ -1227,8 +1227,8 @@ i = 1; if (num_groups > 0) { - sdl->groups = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->groups, num_groups, NULL, delete_type, SDL_PERSISTENT); + sdl->groups = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->groups, num_groups, NULL, delete_type, 0); while (i < num_groups+1) { sdl_deserialize_key(sdl->groups, types[i], &in); sdl_deserialize_type(types[i], types, encoders, &in); @@ -1237,8 +1237,8 @@ } if (num_types > 0) { - sdl->types = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->types, num_types, NULL, delete_type, SDL_PERSISTENT); + sdl->types = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->types, num_types, NULL, delete_type, 0); while (i < num_groups+num_types+1) { sdl_deserialize_key(sdl->types, types[i], &in); sdl_deserialize_type(types[i], types, encoders, &in); @@ -1247,8 +1247,8 @@ } if (num_elements > 0) { - sdl->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->elements, num_elements, NULL, delete_type, SDL_PERSISTENT); + sdl->elements = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->elements, num_elements, NULL, delete_type, 0); while (i < num_groups+num_types+num_elements+1) { sdl_deserialize_key(sdl->elements, types[i], &in); sdl_deserialize_type(types[i], types, encoders, &in); @@ -1258,8 +1258,8 @@ i = 1; if (num_encoders > 0) { - sdl->encoders = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->encoders, num_encoders, NULL, delete_encoder, SDL_PERSISTENT); + sdl->encoders = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->encoders, num_encoders, NULL, delete_encoder, 0); while (i < num_encoders+1) { sdl_deserialize_key(sdl->encoders, encoders[i], &in); sdl_deserialize_encoder(encoders[i], types, &in); @@ -1271,10 +1271,10 @@ WSDL_CACHE_GET_INT(num_bindings, &in); bindings = do_alloca(num_bindings*sizeof(sdlBindingPtr)); if (num_bindings > 0) { - sdl->bindings = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->bindings, num_bindings, NULL, delete_binding, SDL_PERSISTENT); + sdl->bindings = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->bindings, num_bindings, NULL, delete_binding, 0); for (i = 0; i < num_bindings; i++) { - sdlBindingPtr binding = sdl_malloc(sizeof(sdlBinding)); + sdlBindingPtr binding = emalloc(sizeof(sdlBinding)); memset(binding, 0, sizeof(sdlBinding)); sdl_deserialize_key(sdl->bindings, binding, &in); binding->name = sdl_deserialize_string(&in); @@ -1282,7 +1282,7 @@ WSDL_CACHE_GET_1(binding->bindingType,sdlBindingType,&in); if (binding->bindingType == BINDING_SOAP) { if (*in != 0) { - sdlSoapBindingPtr soap_binding = binding->bindingAttributes = sdl_malloc(sizeof(sdlSoapBinding)); + sdlSoapBindingPtr soap_binding = binding->bindingAttributes = emalloc(sizeof(sdlSoapBinding)); WSDL_CACHE_GET_1(soap_binding->style,sdlEncodingStyle,&in); soap_binding->transport = sdl_deserialize_string(&in); } else { @@ -1295,11 +1295,11 @@ /* deserialize functions */ WSDL_CACHE_GET_INT(num_func, &in); - zend_hash_init(&sdl->functions, num_func, NULL, delete_function, SDL_PERSISTENT); + zend_hash_init(&sdl->functions, num_func, NULL, delete_function, 0); functions = do_alloca(num_func*sizeof(sdlFunctionPtr)); for (i = 0; i < num_func; i++) { int binding_num; - sdlFunctionPtr func = sdl_malloc(sizeof(sdlFunction)); + sdlFunctionPtr func = emalloc(sizeof(sdlFunction)); sdl_deserialize_key(&sdl->functions, func, &in); func->functionName = sdl_deserialize_string(&in); func->requestName = sdl_deserialize_string(&in); @@ -1313,7 +1313,7 @@ } if (func->binding && func->binding->bindingType == BINDING_SOAP) { if (*in != 0) { - sdlSoapBindingFunctionPtr binding = func->bindingAttributes = sdl_malloc(sizeof(sdlSoapBindingFunction)); + sdlSoapBindingFunctionPtr binding = func->bindingAttributes = emalloc(sizeof(sdlSoapBindingFunction)); memset(binding, 0, sizeof(sdlSoapBindingFunction)); WSDL_CACHE_GET_1(binding->style,sdlEncodingStyle,&in); binding->soapAction = sdl_deserialize_string(&in); @@ -1332,8 +1332,8 @@ /* deserialize requests */ WSDL_CACHE_GET_INT(i, &in); if (i > 0) { - sdl->requests = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->requests, i, NULL, NULL, SDL_PERSISTENT); + sdl->requests = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->requests, i, NULL, NULL, 0); while (i > 0) { int function_num; @@ -1902,18 +1902,8 @@ { sdlPtr sdl = NULL; char* old_error_code = SOAP_GLOBAL(error_code); -#ifdef SDL_CACHE - sdlPtr *hndl; SOAP_GLOBAL(error_code) = "WSDL"; - if (zend_hash_find(SOAP_GLOBAL(sdls), uri, strlen(uri), (void **)&hndl) == FAILURE) { - sdl = load_wsdl(uri); - zend_hash_add(SOAP_GLOBAL(sdls), uri, strlen(uri), &sdl, sizeof(sdlPtr), NULL); - } else { - sdl = *hndl; - } -#else - SOAP_GLOBAL(error_code) = "WSDL"; if (SOAP_GLOBAL(cache_enabled)) { char fn[MAXPATHLEN]; @@ -1951,7 +1941,6 @@ } else { sdl = load_wsdl(uri); } -#endif SOAP_GLOBAL(error_code) = old_error_code; return sdl; } @@ -1963,36 +1952,36 @@ zend_hash_destroy(&tmp->functions); if (tmp->source) { - sdl_free(tmp->source); + efree(tmp->source); } if (tmp->target_ns) { - sdl_free(tmp->target_ns); + efree(tmp->target_ns); } if (tmp->elements) { zend_hash_destroy(tmp->elements); - sdl_free(tmp->elements); + efree(tmp->elements); } if (tmp->encoders) { zend_hash_destroy(tmp->encoders); - sdl_free(tmp->encoders); + efree(tmp->encoders); } if (tmp->types) { zend_hash_destroy(tmp->types); - sdl_free(tmp->types); + efree(tmp->types); } if (tmp->groups) { zend_hash_destroy(tmp->groups); - sdl_free(tmp->groups); + efree(tmp->groups); } if (tmp->bindings) { zend_hash_destroy(tmp->bindings); - sdl_free(tmp->bindings); + efree(tmp->bindings); } if (tmp->requests) { zend_hash_destroy(tmp->requests); - sdl_free(tmp->requests); + efree(tmp->requests); } - sdl_free(tmp); + efree(tmp); } void delete_sdl_ptr(void *handle) @@ -2005,36 +1994,36 @@ sdlBindingPtr binding = *((sdlBindingPtr*)data); if (binding->location) { - sdl_free(binding->location); + efree(binding->location); } if (binding->name) { - sdl_free(binding->name); + efree(binding->name); } if (binding->bindingType == BINDING_SOAP) { sdlSoapBindingPtr soapBind = binding->bindingAttributes; if (soapBind && soapBind->transport) { - sdl_free(soapBind->transport); + efree(soapBind->transport); } - sdl_free(soapBind); + efree(soapBind); } - sdl_free(binding); + efree(binding); } static void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body) { if (body.ns) { - sdl_free(body.ns); + efree(body.ns); } if (body.parts) { - sdl_free(body.parts); + efree(body.parts); } if (body.encodingStyle) { - sdl_free(body.encodingStyle); + efree(body.encodingStyle); } if (body.headers) { zend_hash_destroy(body.headers); - sdl_free(body.headers); + efree(body.headers); } } @@ -2043,58 +2032,58 @@ sdlFunctionPtr function = *((sdlFunctionPtr*)data); if (function->functionName) { - sdl_free(function->functionName); + efree(function->functionName); } if (function->requestName) { - sdl_free(function->requestName); + efree(function->requestName); } if (function->responseName) { - sdl_free(function->responseName); + efree(function->responseName); } if (function->requestParameters) { zend_hash_destroy(function->requestParameters); - sdl_free(function->requestParameters); + efree(function->requestParameters); } if (function->responseParameters) { zend_hash_destroy(function->responseParameters); - sdl_free(function->responseParameters); + efree(function->responseParameters); } if (function->bindingAttributes && function->binding && function->binding->bindingType == BINDING_SOAP) { sdlSoapBindingFunctionPtr soapFunction = function->bindingAttributes; if (soapFunction->soapAction) { - sdl_free(soapFunction->soapAction); + efree(soapFunction->soapAction); } delete_sdl_soap_binding_function_body(soapFunction->input); delete_sdl_soap_binding_function_body(soapFunction->output); - sdl_free(soapFunction); + efree(soapFunction); } - sdl_free(function); + efree(function); } static void delete_parameter(void *data) { sdlParamPtr param = *((sdlParamPtr*)data); if (param->paramName) { - sdl_free(param->paramName); + efree(param->paramName); } - sdl_free(param); + efree(param); } static void delete_header(void *data) { sdlSoapBindingFunctionHeaderPtr hdr = *((sdlSoapBindingFunctionHeaderPtr*)data); if (hdr->name) { - sdl_free(hdr->name); + efree(hdr->name); } if (hdr->ns) { - sdl_free(hdr->ns); + efree(hdr->ns); } if (hdr->encodingStyle) { - sdl_free(hdr->encodingStyle); + efree(hdr->encodingStyle); } - sdl_free(hdr); + efree(hdr); } static void delete_document(void *doc_ptr) http://cvs.php.net/diff.php/php-src/ext/soap/php_sdl.h?r1=1.27&r2=1.28&ty=u Index: php-src/ext/soap/php_sdl.h diff -u php-src/ext/soap/php_sdl.h:1.27 php-src/ext/soap/php_sdl.h:1.28 --- php-src/ext/soap/php_sdl.h:1.27 Thu Feb 12 11:42:34 2004 +++ php-src/ext/soap/php_sdl.h Fri Feb 13 06:03:58 2004 @@ -17,23 +17,11 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_sdl.h,v 1.27 2004/02/12 16:42:34 dmitry Exp $ */ +/* $Id: php_sdl.h,v 1.28 2004/02/13 11:03:58 dmitry Exp $ */ #ifndef PHP_SDL_H #define PHP_SDL_H -#ifdef SDL_CACHE -# define SDL_PERSISTENT 1 -# define sdl_malloc malloc -# define sdl_strdup strdup -# define sdl_free free -#else -# define SDL_PERSISTENT 0 -# define sdl_malloc emalloc -# define sdl_strdup estrdup -# define sdl_free efree -#endif - #define XSD_WHITESPACE_COLLAPSE 1 #define XSD_WHITESPACE_PRESERVE 1 #define XSD_WHITESPACE_REPLACE 1 http://cvs.php.net/diff.php/php-src/ext/soap/php_soap.h?r1=1.29&r2=1.30&ty=u Index: php-src/ext/soap/php_soap.h diff -u php-src/ext/soap/php_soap.h:1.29 php-src/ext/soap/php_soap.h:1.30 --- php-src/ext/soap/php_soap.h:1.29 Wed Feb 11 08:53:48 2004 +++ php-src/ext/soap/php_soap.h Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_soap.h,v 1.29 2004/02/11 13:53:48 dmitry Exp $ */ +/* $Id: php_soap.h,v 1.30 2004/02/13 11:03:58 dmitry Exp $ */ #ifndef PHP_SOAP_H #define PHP_SOAP_H @@ -142,7 +142,6 @@ HashTable defEncNs; /* mapping of default namespaces to prefixes */ HashTable defEnc; HashTable defEncIndex; - HashTable *sdls; HashTable *overrides; int cur_uniq_ns; int soap_version; http://cvs.php.net/diff.php/php-src/ext/soap/soap.c?r1=1.82&r2=1.83&ty=u Index: php-src/ext/soap/soap.c diff -u php-src/ext/soap/soap.c:1.82 php-src/ext/soap/soap.c:1.83 --- php-src/ext/soap/soap.c:1.82 Fri Feb 13 03:30:13 2004 +++ php-src/ext/soap/soap.c Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: soap.c,v 1.82 2004/02/13 08:30:13 dmitry Exp $ */ +/* $Id: soap.c,v 1.83 2004/02/13 11:03:58 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -357,9 +357,6 @@ int i; long enc; - soap_globals->sdls = malloc(sizeof(HashTable)); - zend_hash_init(soap_globals->sdls, 0, NULL, delete_sdl_ptr, 1); - zend_hash_init(&soap_globals->defEnc, 0, NULL, NULL, 1); zend_hash_init(&soap_globals->defEncIndex, 0, NULL, NULL, 1); zend_hash_init(&soap_globals->defEncNs, 0, NULL, NULL, 1); @@ -407,8 +404,6 @@ zend_hash_destroy(&SOAP_GLOBAL(defEnc)); zend_hash_destroy(&SOAP_GLOBAL(defEncIndex)); zend_hash_destroy(&SOAP_GLOBAL(defEncNs)); - zend_hash_destroy(SOAP_GLOBAL(sdls)); - free(SOAP_GLOBAL(sdls)); return SUCCESS; } @@ -487,11 +482,8 @@ INIT_CLASS_ENTRY(ce, PHP_SOAP_HEADER_CLASSNAME, soap_header_functions); soap_header_class_entry = zend_register_internal_class(&ce TSRMLS_CC); -#ifdef SDL_CACHE - le_sdl = register_list_destructors(NULL, NULL); -#else + le_sdl = register_list_destructors(delete_sdl, NULL); -#endif le_url = register_list_destructors(delete_url, NULL); le_service = register_list_destructors(delete_service, NULL); @@ -952,7 +944,7 @@ if (!service->mapping) { service->mapping = emalloc(sizeof(HashTable)); - zend_hash_init(service->mapping, 0, NULL, delete_tmp_encoder, 0); + zend_hash_init(service->mapping, 0, NULL, delete_encoder, 0); } zend_hash_update(service->mapping, type, type_len + 1, &new_enc, sizeof(encodePtr), NULL); smart_str_free(&resloved_ns); @@ -3440,10 +3432,8 @@ if (service->uri) { efree(service->uri); } -#ifndef SDL_CACHE if (service->sdl) { delete_sdl(service->sdl); } -#endif efree(service); }
http://cvs.php.net/diff.php/php-src/ext/soap/TODO?r1=1.42&r2=1.43&ty=u Index: php-src/ext/soap/TODO diff -u php-src/ext/soap/TODO:1.42 php-src/ext/soap/TODO:1.43 --- php-src/ext/soap/TODO:1.42 Thu Feb 12 11:42:34 2004 +++ php-src/ext/soap/TODO Fri Feb 13 06:03:58 2004 @@ -3,7 +3,6 @@ - make sure soapserver.map(), soap_encode_to_xml() and soap_encode_to_zval() are really need - reimplement SoapObject::__getfunctions() and SoapObject::__gettypes() to return structures instead of strings -? memory leaks (libxml and WSDL/Schema use malloc to cache WSDL) - error handling??? SOAP http://cvs.php.net/diff.php/php-src/ext/soap/php_encoding.c?r1=1.54&r2=1.55&ty=u Index: php-src/ext/soap/php_encoding.c diff -u php-src/ext/soap/php_encoding.c:1.54 php-src/ext/soap/php_encoding.c:1.55 --- php-src/ext/soap/php_encoding.c:1.54 Fri Feb 13 03:29:11 2004 +++ php-src/ext/soap/php_encoding.c Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_encoding.c,v 1.54 2004/02/13 08:29:11 dmitry Exp $ */ +/* $Id: php_encoding.c,v 1.55 2004/02/13 11:03:58 dmitry Exp $ */ #include <time.h> @@ -2609,21 +2609,6 @@ { encodePtr t = *((encodePtr*)encode); if (t->details.ns) { - sdl_free(t->details.ns); - } - if (t->details.type_str) { - sdl_free(t->details.type_str); - } - if (t->details.map) { - delete_mapping(t->details.map); - } - sdl_free(t); -} - -void delete_tmp_encoder(void *encode) -{ - encodePtr t = *((encodePtr*)encode); - if (t->details.ns) { efree(t->details.ns); } if (t->details.type_str) { http://cvs.php.net/diff.php/php-src/ext/soap/php_encoding.h?r1=1.32&r2=1.33&ty=u Index: php-src/ext/soap/php_encoding.h diff -u php-src/ext/soap/php_encoding.h:1.32 php-src/ext/soap/php_encoding.h:1.33 --- php-src/ext/soap/php_encoding.h:1.32 Fri Feb 6 09:22:33 2004 +++ php-src/ext/soap/php_encoding.h Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_encoding.h,v 1.32 2004/02/06 14:22:33 dmitry Exp $ */ +/* $Id: php_encoding.h,v 1.33 2004/02/13 11:03:58 dmitry Exp $ */ #ifndef PHP_ENCODING_H #define PHP_ENCODING_H @@ -215,7 +215,6 @@ encodePtr get_conversion_from_href_type_ex(HashTable *encoding, const char *type, int len); void delete_encoder(void *handle); -void delete_tmp_encoder(void *encode); extern encode defaultEncoding[]; http://cvs.php.net/diff.php/php-src/ext/soap/php_schema.c?r1=1.41&r2=1.42&ty=u Index: php-src/ext/soap/php_schema.c diff -u php-src/ext/soap/php_schema.c:1.41 php-src/ext/soap/php_schema.c:1.42 --- php-src/ext/soap/php_schema.c:1.41 Tue Feb 10 08:41:21 2004 +++ php-src/ext/soap/php_schema.c Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_schema.c,v 1.41 2004/02/10 13:41:21 dmitry Exp $ */ +/* $Id: php_schema.c,v 1.42 2004/02/13 11:03:58 dmitry Exp $ */ #include "php_soap.h" #include "libxml/uri.h" @@ -52,8 +52,8 @@ encodePtr enc, *enc_ptr; if (sdl->encoders == NULL) { - sdl->encoders = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, SDL_PERSISTENT); + sdl->encoders = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 0); } smart_str_appends(&nscat, ns); smart_str_appendc(&nscat, ':'); @@ -62,19 +62,19 @@ if (zend_hash_find(sdl->encoders, nscat.c, nscat.len + 1, (void**)&enc_ptr) == SUCCESS) { enc = *enc_ptr; if (enc->details.ns) { - sdl_free(enc->details.ns); + efree(enc->details.ns); } if (enc->details.type_str) { - sdl_free(enc->details.type_str); + efree(enc->details.type_str); } } else { enc_ptr = NULL; - enc = sdl_malloc(sizeof(encode)); + enc = emalloc(sizeof(encode)); } memset(enc, 0, sizeof(encode)); - enc->details.ns = sdl_strdup(ns); - enc->details.type_str = sdl_strdup(type); + enc->details.ns = estrdup(ns); + enc->details.type_str = estrdup(type); enc->details.sdl_type = cur_type; enc->to_xml = sdl_guess_convert_xml; enc->to_zval = sdl_guess_convert_zval; @@ -178,8 +178,8 @@ xmlAttrPtr tns; if (!ctx->sdl->types) { - ctx->sdl->types = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ctx->sdl->types, 0, NULL, delete_type, SDL_PERSISTENT); + ctx->sdl->types = emalloc(sizeof(HashTable)); + zend_hash_init(ctx->sdl->types, 0, NULL, delete_type, 0); } if (!ctx->attributes) { ctx->attributes = emalloc(sizeof(HashTable)); @@ -321,27 +321,27 @@ /* Anonymous type inside <element> or <restriction> */ sdlTypePtr newType, *ptr; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); newType->kind = XSD_TYPEKIND_SIMPLE; if (name != NULL) { - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); } else { - newType->name = sdl_strdup(cur_type->name); - newType->namens = sdl_strdup(cur_type->namens); + newType->name = estrdup(cur_type->name); + newType->namens = estrdup(cur_type->namens); } zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr); if (sdl->encoders == NULL) { - sdl->encoders = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, SDL_PERSISTENT); + sdl->encoders = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 0); } - cur_type->encode = sdl_malloc(sizeof(encode)); + cur_type->encode = emalloc(sizeof(encode)); memset(cur_type->encode, 0, sizeof(encode)); - cur_type->encode->details.ns = sdl_strdup(newType->namens); - cur_type->encode->details.type_str = sdl_strdup(newType->name); + cur_type->encode->details.ns = estrdup(newType->namens); + cur_type->encode->details.type_str = estrdup(newType->name); cur_type->encode->details.sdl_type = *ptr; cur_type->encode->to_xml = sdl_guess_convert_xml; cur_type->encode->to_zval = sdl_guess_convert_zval; @@ -352,18 +352,18 @@ } else if (name != NULL) { sdlTypePtr newType, *ptr; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); newType->kind = XSD_TYPEKIND_SIMPLE; - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); if (cur_type == NULL) { zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr); } else { if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_update(cur_type->elements, newType->name, strlen(newType->name)+1, &newType, sizeof(sdlTypePtr), (void **)&ptr); } @@ -427,17 +427,17 @@ if (nsptr != NULL) { sdlTypePtr newType, *tmp; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup(type); - newType->namens = sdl_strdup(nsptr->href); + newType->name = estrdup(type); + newType->namens = estrdup(nsptr->href); newType->encode = get_create_encoder(sdl, newType, (char *)nsptr->href, type); if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp); } @@ -457,15 +457,15 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'itemType' attribute and subtype"); } - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup("anonymous"); - newType->namens = sdl_strdup(tsn->children->content); + newType->name = estrdup("anonymous"); + newType->namens = estrdup(tsn->children->content); if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp); @@ -514,17 +514,17 @@ if (nsptr != NULL) { sdlTypePtr newType, *tmp; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup(type); - newType->namens = sdl_strdup(nsptr->href); + newType->name = estrdup(type); + newType->namens = estrdup(nsptr->href); newType->encode = get_create_encoder(sdl, newType, (char *)nsptr->href, type); if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp); } @@ -549,15 +549,15 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: union has both 'memberTypes' attribute and subtypes"); } - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup("anonymous"); - newType->namens = sdl_strdup(tsn->children->content); + newType->name = estrdup("anonymous"); + newType->namens = estrdup(tsn->children->content); if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp); @@ -648,7 +648,7 @@ } if (cur_type->restrictions == NULL) { - cur_type->restrictions = sdl_malloc(sizeof(sdlRestrictions)); + cur_type->restrictions = emalloc(sizeof(sdlRestrictions)); memset(cur_type->restrictions, 0, sizeof(sdlRestrictions)); } @@ -689,8 +689,8 @@ schema_restriction_var_char(trav, &enumval); if (cur_type->restrictions->enumeration == NULL) { - cur_type->restrictions->enumeration = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_restriction_var_char, SDL_PERSISTENT); + cur_type->restrictions->enumeration = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_restriction_var_char, 0); } zend_hash_add(cur_type->restrictions->enumeration, enumval->value, strlen(enumval->value)+1, &enumval, sizeof(sdlRestrictionCharPtr), NULL); } else { @@ -796,7 +796,7 @@ xmlAttrPtr fixed, value; if ((*valptr) == NULL) { - (*valptr) = sdl_malloc(sizeof(sdlRestrictionInt)); + (*valptr) = emalloc(sizeof(sdlRestrictionInt)); } memset((*valptr), 0, sizeof(sdlRestrictionInt)); @@ -823,7 +823,7 @@ xmlAttrPtr fixed, value; if ((*valptr) == NULL) { - (*valptr) = sdl_malloc(sizeof(sdlRestrictionChar)); + (*valptr) = emalloc(sizeof(sdlRestrictionChar)); } memset((*valptr), 0, sizeof(sdlRestrictionChar)); @@ -841,7 +841,7 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: missing restriction value"); } - (*valptr)->value = sdl_strdup(value->children->content); + (*valptr)->value = estrdup(value->children->content); return TRUE; } @@ -985,10 +985,10 @@ xmlAttrPtr attr; sdlContentModelPtr newModel; - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_ALL; - newModel->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newModel->u.content, 0, NULL, delete_model, SDL_PERSISTENT); + newModel->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(newModel->u.content, 0, NULL, delete_model, 0); if (model == NULL) { cur_type->model = newModel; } else { @@ -1072,17 +1072,17 @@ smart_str_appends(&key, type); smart_str_0(&key); - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_GROUP_REF; newModel->u.group_ref = estrdup(key.c); if (type) {efree(type);} if (ns) {efree(ns);} } else { - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_SEQUENCE; /* will be redefined */ - newModel->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newModel->u.content, 0, NULL, delete_model, SDL_PERSISTENT); + newModel->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(newModel->u.content, 0, NULL, delete_model, 0); smart_str_appends(&key, ns->children->content); smart_str_appendc(&key, ':'); @@ -1093,12 +1093,12 @@ if (cur_type == NULL) { sdlTypePtr newType; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); if (sdl->groups == NULL) { - sdl->groups = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->groups, 0, NULL, delete_type, SDL_PERSISTENT); + sdl->groups = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->groups, 0, NULL, delete_type, 0); } if (zend_hash_add(sdl->groups, key.c, key.len+1, (void**)&newType, sizeof(sdlTypePtr), NULL) != SUCCESS) { php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group '%s' already defined",key.c); @@ -1185,10 +1185,10 @@ xmlAttrPtr attr; sdlContentModelPtr newModel; - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_CHOICE; - newModel->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newModel->u.content, 0, NULL, delete_model, SDL_PERSISTENT); + newModel->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(newModel->u.content, 0, NULL, delete_model, 0); if (model == NULL) { cur_type->model = newModel; } else { @@ -1251,10 +1251,10 @@ xmlAttrPtr attr; sdlContentModelPtr newModel; - newModel = sdl_malloc(sizeof(sdlContentModel)); + newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_SEQUENCE; - newModel->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newModel->u.content, 0, NULL, delete_model, SDL_PERSISTENT); + newModel->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(newModel->u.content, 0, NULL, delete_model, 0); if (model == NULL) { cur_type->model = newModel; } else { @@ -1376,27 +1376,27 @@ /* Anonymous type inside <element> */ sdlTypePtr newType, *ptr; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); newType->kind = XSD_TYPEKIND_COMPLEX; if (name != NULL) { - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); } else { - newType->name = sdl_strdup(cur_type->name); - newType->namens = sdl_strdup(cur_type->namens); + newType->name = estrdup(cur_type->name); + newType->namens = estrdup(cur_type->namens); } zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr); if (sdl->encoders == NULL) { - sdl->encoders = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, SDL_PERSISTENT); + sdl->encoders = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 0); } - cur_type->encode = sdl_malloc(sizeof(encode)); + cur_type->encode = emalloc(sizeof(encode)); memset(cur_type->encode, 0, sizeof(encode)); - cur_type->encode->details.ns = sdl_strdup(newType->namens); - cur_type->encode->details.type_str = sdl_strdup(newType->name); + cur_type->encode->details.ns = estrdup(newType->namens); + cur_type->encode->details.type_str = estrdup(newType->name); cur_type->encode->details.sdl_type = *ptr; cur_type->encode->to_xml = sdl_guess_convert_xml; cur_type->encode->to_zval = sdl_guess_convert_zval; @@ -1407,11 +1407,11 @@ } else if (name) { sdlTypePtr newType, *ptr; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); newType->kind = XSD_TYPEKIND_COMPLEX; - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr); @@ -1510,7 +1510,7 @@ sdlTypePtr newType; smart_str key = {0}; - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); if (ref) { @@ -1523,26 +1523,26 @@ if (nsptr != NULL) { smart_str_appends(&nscat, nsptr->href); smart_str_appendc(&nscat, ':'); - newType->namens = sdl_strdup(nsptr->href); + newType->namens = estrdup(nsptr->href); } smart_str_appends(&nscat, type); - newType->name = sdl_strdup(type); + newType->name = estrdup(type); smart_str_0(&nscat); if (type) {efree(type);} if (ns) {efree(ns);} newType->ref = estrdup(nscat.c); smart_str_free(&nscat); } else { - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); } newType->nillable = FALSE; if (cur_type == NULL) { if (sdl->elements == NULL) { - sdl->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->elements, 0, NULL, delete_type, SDL_PERSISTENT); + sdl->elements = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->elements, 0, NULL, delete_type, 0); } addHash = sdl->elements; smart_str_appends(&key, newType->namens); @@ -1550,8 +1550,8 @@ smart_str_appends(&key, newType->name); } else { if (cur_type->elements == NULL) { - cur_type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->elements, 0, NULL, delete_type, SDL_PERSISTENT); + cur_type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0); } addHash = cur_type->elements; smart_str_appends(&key, newType->name); @@ -1568,7 +1568,7 @@ smart_str_free(&key); if (model != NULL) { - sdlContentModelPtr newModel = sdl_malloc(sizeof(sdlContentModel)); + sdlContentModelPtr newModel = emalloc(sizeof(sdlContentModel)); newModel->kind = XSD_CONTENT_ELEMENT; newModel->u.element = newType; @@ -1618,7 +1618,7 @@ if (ref != NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'fixed' attributes"); } - cur_type->fixed = sdl_strdup(attr->children->content); + cur_type->fixed = estrdup(attr->children->content); } attr = get_attribute(attrs, "default"); @@ -1628,7 +1628,7 @@ } else if (ref != NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'default' and 'fixed' attributes"); } - cur_type->def = sdl_strdup(attr->children->content); + cur_type->def = estrdup(attr->children->content); } /* type = QName */ @@ -1717,7 +1717,7 @@ HashTable *addHash; smart_str key = {0}; - newAttr = sdl_malloc(sizeof(sdlAttribute)); + newAttr = emalloc(sizeof(sdlAttribute)); memset(newAttr, 0, sizeof(sdlAttribute)); if (ref) { @@ -1754,8 +1754,8 @@ addHash = ctx->attributes; } else { if (cur_type->attributes == NULL) { - cur_type->attributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, SDL_PERSISTENT); + cur_type->attributes = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 0); } addHash = cur_type->attributes; } @@ -1789,9 +1789,9 @@ attr = attrType->properties; while (attr != NULL) { if (attr_is_equal_ex(attr, "default", SCHEMA_NAMESPACE)) { - newAttr->def = sdl_strdup(attr->children->content); + newAttr->def = estrdup(attr->children->content); } else if (attr_is_equal_ex(attr, "fixed", SCHEMA_NAMESPACE)) { - newAttr->fixed = sdl_strdup(attr->children->content); + newAttr->fixed = estrdup(attr->children->content); } else if (attr_is_equal_ex(attr, "form", SCHEMA_NAMESPACE)) { if (strncmp(attr->children->content,"qualified",sizeof("qualified")) == 0) { newAttr->form = XSD_FORM_QUALIFIED; @@ -1803,7 +1803,7 @@ } else if (attr_is_equal_ex(attr, "id", SCHEMA_NAMESPACE)) { /* skip */ } else if (attr_is_equal_ex(attr, "name", SCHEMA_NAMESPACE)) { - newAttr->name = sdl_strdup(attr->children->content); + newAttr->name = estrdup(attr->children->content); } else if (attr_is_equal_ex(attr, "ref", SCHEMA_NAMESPACE)) { /* already processed */ } else if (attr_is_equal_ex(attr, "type", SCHEMA_NAMESPACE)) { @@ -1827,22 +1827,22 @@ xmlNsPtr nsptr; char *value, *ns; - ext = sdl_malloc(sizeof(sdlExtraAttribute)); + ext = emalloc(sizeof(sdlExtraAttribute)); memset(ext, 0, sizeof(sdlExtraAttribute)); parse_namespace(attr->children->content, &value, &ns); nsptr = xmlSearchNs(attr->doc, attr->parent, ns); if (nsptr) { - ext->ns = sdl_strdup(nsptr->href); - ext->val = sdl_strdup(value); + ext->ns = estrdup(nsptr->href); + ext->val = estrdup(value); } else { - ext->val = sdl_strdup(attr->children->content); + ext->val = estrdup(attr->children->content); } if (ns) {efree(ns);} efree(value); if (!newAttr->extraAttributes) { - newAttr->extraAttributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(newAttr->extraAttributes, 0, NULL, delete_extra_attribute, SDL_PERSISTENT); + newAttr->extraAttributes = emalloc(sizeof(HashTable)); + zend_hash_init(newAttr->extraAttributes, 0, NULL, delete_extra_attribute, 0); } smart_str_appends(&key2, nsPtr->href); @@ -1869,10 +1869,10 @@ } else if (type != NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has both 'type' attribute and subtype"); } - dummy_type = sdl_malloc(sizeof(sdlType)); + dummy_type = emalloc(sizeof(sdlType)); memset(dummy_type, 0, sizeof(sdlType)); - dummy_type->name = sdl_strdup("anonymous"); - dummy_type->namens = sdl_strdup(tsn->children->content); + dummy_type->name = estrdup("anonymous"); + dummy_type->namens = estrdup(tsn->children->content); schema_simpleType(sdl, tsn, trav, dummy_type); newAttr->encode = dummy_type->encode; delete_type(&dummy_type); @@ -1905,10 +1905,10 @@ if (ns == NULL) { ns = tsn; } - newType = sdl_malloc(sizeof(sdlType)); + newType = emalloc(sizeof(sdlType)); memset(newType, 0, sizeof(sdlType)); - newType->name = sdl_strdup(name->children->content); - newType->namens = sdl_strdup(ns->children->content); + newType->name = estrdup(name->children->content); + newType->namens = estrdup(ns->children->content); smart_str_appends(&key, newType->namens); smart_str_appendc(&key, ':'); @@ -1927,10 +1927,10 @@ xmlNsPtr nsptr; if (cur_type->attributes == NULL) { - cur_type->attributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, SDL_PERSISTENT); + cur_type->attributes = emalloc(sizeof(HashTable)); + zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 0); } - newAttr = sdl_malloc(sizeof(sdlAttribute)); + newAttr = emalloc(sizeof(sdlAttribute)); memset(newAttr, 0, sizeof(sdlAttribute)); parse_namespace(ref->children->content, &group_name, &ns); @@ -1988,14 +1988,14 @@ sdlExtraAttributePtr *attr = (sdlExtraAttributePtr*)attribute; sdlExtraAttributePtr new_attr; - new_attr = sdl_malloc(sizeof(sdlExtraAttribute)); + new_attr = emalloc(sizeof(sdlExtraAttribute)); memcpy(new_attr, *attr, sizeof(sdlExtraAttribute)); *attr = new_attr; if (new_attr->ns) { - new_attr->ns = sdl_strdup(new_attr->ns); + new_attr->ns = estrdup(new_attr->ns); } if (new_attr->val) { - new_attr->val = sdl_strdup(new_attr->val); + new_attr->val = estrdup(new_attr->val); } } @@ -2008,13 +2008,13 @@ if (zend_hash_find(ctx->attributes, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) { schema_attribute_fixup(ctx, *tmp); if ((*tmp)->name != NULL && attr->name == NULL) { - attr->name = sdl_strdup((*tmp)->name); + attr->name = estrdup((*tmp)->name); } if ((*tmp)->def != NULL && attr->def == NULL) { - attr->def = sdl_strdup((*tmp)->def); + attr->def = estrdup((*tmp)->def); } if ((*tmp)->fixed != NULL && attr->fixed == NULL) { - attr->fixed = sdl_strdup((*tmp)->fixed); + attr->fixed = estrdup((*tmp)->fixed); } if (attr->form == XSD_FORM_DEFAULT) { attr->form = (*tmp)->form; @@ -2025,8 +2025,8 @@ if ((*tmp)->extraAttributes != NULL) { xmlNodePtr node; - attr->extraAttributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(attr->extraAttributes, 0, NULL, delete_extra_attribute, SDL_PERSISTENT); + attr->extraAttributes = emalloc(sizeof(HashTable)); + zend_hash_init(attr->extraAttributes, 0, NULL, delete_extra_attribute, 0); zend_hash_copy(attr->extraAttributes, (*tmp)->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr)); } attr->encode = (*tmp)->encode; @@ -2035,9 +2035,9 @@ if (attr->name == NULL && attr->ref != NULL) { char *name = strrchr(attr->ref, ':'); if (*name) { - attr->name = sdl_strdup(name+1); + attr->name = estrdup(name+1); } else{ - attr->name = sdl_strdup(attr->ref); + attr->name = estrdup(attr->ref); } } efree(attr->ref); @@ -2063,15 +2063,15 @@ schema_attribute_fixup(ctx,*tmp_attr); - newAttr = sdl_malloc(sizeof(sdlAttribute)); + newAttr = emalloc(sizeof(sdlAttribute)); memcpy(newAttr, *tmp_attr, sizeof(sdlAttribute)); - if (newAttr->def) {newAttr->def = sdl_strdup(newAttr->def);} - if (newAttr->fixed) {newAttr->fixed = sdl_strdup(newAttr->fixed);} - if (newAttr->name) {newAttr->name = sdl_strdup(newAttr->name);} + if (newAttr->def) {newAttr->def = estrdup(newAttr->def);} + if (newAttr->fixed) {newAttr->fixed = estrdup(newAttr->fixed);} + if (newAttr->name) {newAttr->name = estrdup(newAttr->name);} if (newAttr->extraAttributes) { xmlNodePtr node; - HashTable *ht = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ht, 0, NULL, delete_extra_attribute, SDL_PERSISTENT); + HashTable *ht = emalloc(sizeof(HashTable)); + zend_hash_init(ht, 0, NULL, delete_extra_attribute, 0); zend_hash_copy(ht, newAttr->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr)); newAttr->extraAttributes = ht; } @@ -2235,37 +2235,37 @@ case XSD_CONTENT_ALL: case XSD_CONTENT_CHOICE: zend_hash_destroy(tmp->u.content); - sdl_free(tmp->u.content); + efree(tmp->u.content); break; case XSD_CONTENT_GROUP_REF: efree(tmp->u.group_ref); break; } - sdl_free(tmp); + efree(tmp); } void delete_type(void *data) { sdlTypePtr type = *((sdlTypePtr*)data); if (type->name) { - sdl_free(type->name); + efree(type->name); } if (type->namens) { - sdl_free(type->namens); + efree(type->namens); } if (type->def) { - sdl_free(type->def); + efree(type->def); } if (type->fixed) { - sdl_free(type->fixed); + efree(type->fixed); } if (type->elements) { zend_hash_destroy(type->elements); - sdl_free(type->elements); + efree(type->elements); } if (type->attributes) { zend_hash_destroy(type->attributes); - sdl_free(type->attributes); + efree(type->attributes); } if (type->model) { delete_model((void**)&type->model); @@ -2284,11 +2284,11 @@ delete_restriction_var_char(&type->restrictions->pattern); if (type->restrictions->enumeration) { zend_hash_destroy(type->restrictions->enumeration); - sdl_free(type->restrictions->enumeration); + efree(type->restrictions->enumeration); } - sdl_free(type->restrictions); + efree(type->restrictions); } - sdl_free(type); + efree(type); } void delete_extra_attribute(void *attribute) @@ -2296,12 +2296,12 @@ sdlExtraAttributePtr attr = *((sdlExtraAttributePtr*)attribute); if (attr->ns) { - sdl_free(attr->ns); + efree(attr->ns); } if (attr->val) { - sdl_free(attr->val); + efree(attr->val); } - sdl_free(attr); + efree(attr); } void delete_attribute(void *attribute) @@ -2309,29 +2309,29 @@ sdlAttributePtr attr = *((sdlAttributePtr*)attribute); if (attr->def) { - sdl_free(attr->def); + efree(attr->def); } if (attr->fixed) { - sdl_free(attr->fixed); + efree(attr->fixed); } if (attr->name) { - sdl_free(attr->name); + efree(attr->name); } if (attr->ref) { - sdl_free(attr->ref); + efree(attr->ref); } if (attr->extraAttributes) { zend_hash_destroy(attr->extraAttributes); - sdl_free(attr->extraAttributes); + efree(attr->extraAttributes); } - sdl_free(attr); + efree(attr); } void delete_restriction_var_int(void *rvi) { sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi); if (ptr) { - sdl_free(ptr); + efree(ptr); } } @@ -2340,8 +2340,8 @@ sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc); if (ptr) { if (ptr->value) { - sdl_free(ptr->value); + efree(ptr->value); } - sdl_free(ptr); + efree(ptr); } } http://cvs.php.net/diff.php/php-src/ext/soap/php_sdl.c?r1=1.57&r2=1.58&ty=u Index: php-src/ext/soap/php_sdl.c diff -u php-src/ext/soap/php_sdl.c:1.57 php-src/ext/soap/php_sdl.c:1.58 --- php-src/ext/soap/php_sdl.c:1.57 Thu Feb 12 11:42:34 2004 +++ php-src/ext/soap/php_sdl.c Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_sdl.c,v 1.57 2004/02/12 16:42:34 dmitry Exp $ */ +/* $Id: php_sdl.c,v 1.58 2004/02/13 11:03:58 dmitry Exp $ */ #include "php_soap.h" #include "libxml/uri.h" @@ -199,7 +199,7 @@ if (!include) { targetNamespace = get_attribute(definitions->properties, "targetNamespace"); if (targetNamespace) { - tmpsdl->target_ns = sdl_strdup(targetNamespace->children->content); + tmpsdl->target_ns = estrdup(targetNamespace->children->content); } } @@ -303,13 +303,13 @@ tmp = get_attribute(body->properties, "namespace"); if (tmp) { - binding->ns = sdl_strdup(tmp->children->content); + binding->ns = estrdup(tmp->children->content); } tmp = get_attribute(body->properties, "parts"); if (tmp) { whiteSpace_collapse(tmp->children->content); - binding->parts = sdl_strdup(tmp->children->content); + binding->parts = estrdup(tmp->children->content); } if (binding->use == SOAP_ENCODED) { @@ -321,7 +321,7 @@ } else if (tmp == NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unspecified encodingStyle"); } else { - binding->encodingStyle = sdl_strdup(tmp->children->content); + binding->encodingStyle = estrdup(tmp->children->content); } } } else if (node_is_equal_ex(trav, "header", wsdl_soap_namespace)) { @@ -356,9 +356,9 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing part '%s' in <message>",tmp->children->content); } - h = sdl_malloc(sizeof(sdlSoapBindingFunctionHeader)); + h = emalloc(sizeof(sdlSoapBindingFunctionHeader)); memset(h, 0, sizeof(sdlSoapBindingFunctionHeader)); - h->name = sdl_strdup(tmp->children->content); + h->name = estrdup(tmp->children->content); tmp = get_attribute(part->properties, "type"); if (tmp != NULL) { @@ -382,7 +382,7 @@ tmp = get_attribute(header->properties, "namespace"); if (tmp) { - h->ns = sdl_strdup(tmp->children->content); + h->ns = estrdup(tmp->children->content); } if (h->use == SOAP_ENCODED) { @@ -394,13 +394,13 @@ } else if (tmp == NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unspecified encodingStyle"); } else { - h->encodingStyle = sdl_strdup(tmp->children->content); + h->encodingStyle = estrdup(tmp->children->content); } } if (binding->headers == NULL) { - binding->headers = sdl_malloc(sizeof(HashTable)); - zend_hash_init(binding->headers, 0, NULL, delete_header, SDL_PERSISTENT); + binding->headers = emalloc(sizeof(HashTable)); + zend_hash_init(binding->headers, 0, NULL, delete_header, 0); } if (h->ns) { @@ -437,8 +437,8 @@ } message = *tmp; - parameters = sdl_malloc(sizeof(HashTable)); - zend_hash_init(parameters, 0, NULL, delete_parameter, SDL_PERSISTENT); + parameters = emalloc(sizeof(HashTable)); + zend_hash_init(parameters, 0, NULL, delete_parameter, 0); trav = message->children; while (trav != NULL) { @@ -456,7 +456,7 @@ php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav->name); } part = trav; - param = sdl_malloc(sizeof(sdlParam)); + param = emalloc(sizeof(sdlParam)); memset(param,0,sizeof(sdlParam)); param->order = 0; @@ -465,7 +465,7 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No name associated with <part> '%s'", message->name); } - param->paramName = sdl_strdup(name->children->content); + param->paramName = estrdup(name->children->content); type = get_attribute(part->properties, "type"); if (type != NULL) { @@ -493,10 +493,10 @@ int i,n; memset(&ctx,0,sizeof(ctx)); - ctx.sdl = sdl_malloc(sizeof(sdl)); + ctx.sdl = emalloc(sizeof(sdl)); memset(ctx.sdl, 0, sizeof(sdl)); - ctx.sdl->source = sdl_strdup(struri); - zend_hash_init(&ctx.sdl->functions, 0, NULL, delete_function, SDL_PERSISTENT); + ctx.sdl->source = estrdup(struri); + zend_hash_init(&ctx.sdl->functions, 0, NULL, delete_function, 0); zend_hash_init(&ctx.docs, 0, NULL, delete_document, 0); zend_hash_init(&ctx.messages, 0, NULL, NULL, 0); @@ -536,7 +536,7 @@ port = trav; - tmpbinding = sdl_malloc(sizeof(sdlBinding)); + tmpbinding = emalloc(sizeof(sdlBinding)); memset(tmpbinding, 0, sizeof(sdlBinding)); bindingAttr = get_attribute(port->properties, "binding"); @@ -583,7 +583,7 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No location associated with <port>"); } - tmpbinding->location = sdl_strdup(location->children->content); + tmpbinding->location = estrdup(location->children->content); ctype = strrchr(bindingAttr->children->content,':'); if (ctype == NULL) { @@ -601,7 +601,7 @@ xmlNodePtr soapBindingNode; xmlAttrPtr tmp; - soapBinding = sdl_malloc(sizeof(sdlSoapBinding)); + soapBinding = emalloc(sizeof(sdlSoapBinding)); memset(soapBinding, 0, sizeof(sdlSoapBinding)); soapBinding->style = SOAP_DOCUMENT; @@ -617,7 +617,7 @@ if (strncmp(tmp->children->content, WSDL_HTTP_TRANSPORT, sizeof(WSDL_HTTP_TRANSPORT))) { php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support transport '%s'", tmp->children->content); } - soapBinding->transport = sdl_strdup(tmp->children->content); + soapBinding->transport = estrdup(tmp->children->content); } } tmpbinding->bindingAttributes = (void *)soapBinding; @@ -627,7 +627,7 @@ if (name == NULL) { php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing 'name' attribute for <binding>"); } - tmpbinding->name = sdl_strdup(name->children->content); + tmpbinding->name = estrdup(name->children->content); type = get_attribute(binding->properties, "type"); if (type == NULL) { @@ -688,8 +688,8 @@ php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <portType>/<operation> with name '%s'", op_name->children->content); } - function = sdl_malloc(sizeof(sdlFunction)); - function->functionName = sdl_strdup(op_name->children->content); + function = emalloc(sizeof(sdlFunction)); + function->functionName = estrdup(op_name->children->content); function->requestParameters = NULL; function->responseParameters = NULL; function->responseName = NULL; @@ -702,7 +702,7 @@ xmlNodePtr soapOperation; xmlAttrPtr tmp; - soapFunctionBinding = sdl_malloc(sizeof(sdlSoapBindingFunction)); + soapFunctionBinding = emalloc(sizeof(sdlSoapBindingFunction)); memset(soapFunctionBinding, 0, sizeof(sdlSoapBindingFunction)); soapBinding = (sdlSoapBindingPtr)tmpbinding->bindingAttributes; soapFunctionBinding->style = soapBinding->style; @@ -711,7 +711,7 @@ if (soapOperation) { tmp = get_attribute(soapOperation->properties, "soapAction"); if (tmp) { - soapFunctionBinding->soapAction = sdl_strdup(tmp->children->content); + soapFunctionBinding->soapAction = estrdup(tmp->children->content); } tmp = get_attribute(soapOperation->properties, "style"); @@ -741,9 +741,9 @@ name = get_attribute(input->properties, "name"); if (name != NULL) { - function->requestName = sdl_strdup(name->children->content); + function->requestName = estrdup(name->children->content); } else { - function->requestName = sdl_strdup(function->functionName); + function->requestName = estrdup(function->functionName); } if (tmpbinding->bindingType == BINDING_SOAP) { @@ -767,12 +767,12 @@ name = get_attribute(output->properties, "name"); if (name != NULL) { - function->responseName = sdl_strdup(name->children->content); + function->responseName = estrdup(name->children->content); } else if (input == NULL) { - function->responseName = sdl_strdup(function->functionName); + function->responseName = estrdup(function->functionName); } else { int len = strlen(function->functionName); - function->responseName = sdl_malloc(len + sizeof("Response")); + function->responseName = emalloc(len + sizeof("Response")); memcpy(function->responseName, function->functionName, len); memcpy(function->responseName+len, "Response", sizeof("Response")); } @@ -808,8 +808,8 @@ efree(tmp); if (function->requestName != NULL && strcmp(function->requestName,function->functionName) != 0) { if (ctx.sdl->requests == NULL) { - ctx.sdl->requests = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ctx.sdl->requests, 0, NULL, NULL, SDL_PERSISTENT); + ctx.sdl->requests = emalloc(sizeof(HashTable)); + zend_hash_init(ctx.sdl->requests, 0, NULL, NULL, 0); } tmp = estrdup(function->requestName); len = strlen(tmp); @@ -821,8 +821,8 @@ } if (!ctx.sdl->bindings) { - ctx.sdl->bindings = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ctx.sdl->bindings, 0, NULL, delete_binding, SDL_PERSISTENT); + ctx.sdl->bindings = emalloc(sizeof(HashTable)); + zend_hash_init(ctx.sdl->bindings, 0, NULL, delete_binding, 0); } zend_hash_add(ctx.sdl->bindings, tmpbinding->name, strlen(tmpbinding->name), &tmpbinding, sizeof(sdlBindingPtr), NULL); @@ -868,7 +868,7 @@ if (len == 0) { return NULL; } else { - s = sdl_malloc(len+1); + s = emalloc(len+1); WSDL_CACHE_GET_N(s, len, in); s[len] = '\0'; return s; @@ -902,10 +902,10 @@ attr->encode = encoders[i]; WSDL_CACHE_GET_INT(i, in); if (i > 0) { - attr->extraAttributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(attr->extraAttributes, i, NULL, delete_extra_attribute, SDL_PERSISTENT); + attr->extraAttributes = emalloc(sizeof(HashTable)); + zend_hash_init(attr->extraAttributes, i, NULL, delete_extra_attribute, 0); while (i > 0) { - sdlExtraAttributePtr x = sdl_malloc(sizeof(sdlExtraAttribute)); + sdlExtraAttributePtr x = emalloc(sizeof(sdlExtraAttribute)); sdl_deserialize_key(attr->extraAttributes, x, in); x->ns = sdl_deserialize_string(in); x->val = sdl_deserialize_string(in); @@ -917,7 +917,7 @@ static sdlRestrictionIntPtr sdl_deserialize_resriction_int(char **in) { if (**in == 1) { - sdlRestrictionIntPtr x = sdl_malloc(sizeof(sdlRestrictionInt)); + sdlRestrictionIntPtr x = emalloc(sizeof(sdlRestrictionInt)); WSDL_CACHE_SKIP(1, in); WSDL_CACHE_GET_INT(x->value, in); WSDL_CACHE_GET_1(x->fixed, char, in); @@ -931,7 +931,7 @@ static sdlRestrictionCharPtr sdl_deserialize_resriction_char(char **in) { if (**in == 1) { - sdlRestrictionCharPtr x = sdl_malloc(sizeof(sdlRestrictionChar)); + sdlRestrictionCharPtr x = emalloc(sizeof(sdlRestrictionChar)); WSDL_CACHE_SKIP(1, in); x->value = sdl_deserialize_string(in); WSDL_CACHE_GET_1(x->fixed, char, in); @@ -945,7 +945,7 @@ static sdlContentModelPtr sdl_deserialize_model(sdlTypePtr *types, sdlTypePtr *elements, char **in) { int i; - sdlContentModelPtr model = sdl_malloc(sizeof(sdlContentModel)); + sdlContentModelPtr model = emalloc(sizeof(sdlContentModel)); WSDL_CACHE_GET_1(model->kind, sdlContentKind, in); WSDL_CACHE_GET_INT(model->min_occurs, in); @@ -960,8 +960,8 @@ case XSD_CONTENT_CHOICE: WSDL_CACHE_GET_INT(i, in); if (i > 0) { - model->u.content = sdl_malloc(sizeof(HashTable)); - zend_hash_init(model->u.content, i, NULL, delete_model, SDL_PERSISTENT); + model->u.content = emalloc(sizeof(HashTable)); + zend_hash_init(model->u.content, i, NULL, delete_model, 0); while (i > 0) { sdlContentModelPtr x = sdl_deserialize_model(types, elements, in); zend_hash_next_index_insert(model->u.content,&x,sizeof(sdlContentModelPtr),NULL); @@ -1000,7 +1000,7 @@ if (**in == 1) { WSDL_CACHE_SKIP(1, in); - type->restrictions = sdl_malloc(sizeof(sdlRestrictions)); + type->restrictions = emalloc(sizeof(sdlRestrictions)); /*memset(type->restrictions, 0, sizeof(sdlRestrictions));*/ type->restrictions->minExclusive = sdl_deserialize_resriction_int(in); type->restrictions->minInclusive = sdl_deserialize_resriction_int(in); @@ -1015,8 +1015,8 @@ type->restrictions->pattern = sdl_deserialize_resriction_char(in); WSDL_CACHE_GET_INT(i, in); if (i > 0) { - type->restrictions->enumeration = sdl_malloc(sizeof(HashTable)); - zend_hash_init(type->restrictions->enumeration, i, NULL, delete_restriction_var_char, SDL_PERSISTENT); + type->restrictions->enumeration = emalloc(sizeof(HashTable)); + zend_hash_init(type->restrictions->enumeration, i, NULL, delete_restriction_var_char, 0); while (i > 0) { sdlRestrictionCharPtr x = sdl_deserialize_resriction_char(in); sdl_deserialize_key(type->restrictions->enumeration, x, in); @@ -1033,10 +1033,10 @@ if (i > 0) { elements = do_alloca((i+1) * sizeof(sdlTypePtr)); elements[0] = NULL; - type->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(type->elements, i, NULL, delete_type, SDL_PERSISTENT); + type->elements = emalloc(sizeof(HashTable)); + zend_hash_init(type->elements, i, NULL, delete_type, 0); while (i > 0) { - sdlTypePtr t = sdl_malloc(sizeof(sdlType)); + sdlTypePtr t = emalloc(sizeof(sdlType)); memset(t, 0, sizeof(sdlType)); sdl_deserialize_key(type->elements, t, in); sdl_deserialize_type(t, types, encoders, in); @@ -1047,10 +1047,10 @@ WSDL_CACHE_GET_INT(i, in); if (i > 0) { - type->attributes = sdl_malloc(sizeof(HashTable)); - zend_hash_init(type->attributes, i, NULL, delete_attribute, SDL_PERSISTENT); + type->attributes = emalloc(sizeof(HashTable)); + zend_hash_init(type->attributes, i, NULL, delete_attribute, 0); while (i > 0) { - sdlAttributePtr attr = sdl_malloc(sizeof(sdlAttribute)); + sdlAttributePtr attr = emalloc(sizeof(sdlAttribute)); memset(attr, 0, sizeof(sdlAttribute)); sdl_deserialize_key(type->attributes, attr, in); sdl_deserialize_attribute(attr, encoders, in); @@ -1092,10 +1092,10 @@ body->encodingStyle = sdl_deserialize_string(in); WSDL_CACHE_GET_INT(i, in); if (i > 0) { - body->headers = sdl_malloc(sizeof(HashTable)); - zend_hash_init(body->headers, i, NULL, delete_header, SDL_PERSISTENT); + body->headers = emalloc(sizeof(HashTable)); + zend_hash_init(body->headers, i, NULL, delete_header, 0); while (i > 0) { - sdlSoapBindingFunctionHeaderPtr tmp = sdl_malloc(sizeof(sdlSoapBindingFunctionHeader)); + sdlSoapBindingFunctionHeaderPtr tmp = emalloc(sizeof(sdlSoapBindingFunctionHeader)); sdl_deserialize_key(body->headers, tmp, in); WSDL_CACHE_GET_1(tmp->use, sdlEncodingUse, in); tmp->name = sdl_deserialize_string(in); @@ -1117,10 +1117,10 @@ WSDL_CACHE_GET_INT(i, in); if (i == 0) {return NULL;} - ht = sdl_malloc(sizeof(HashTable)); - zend_hash_init(ht, i, NULL, delete_parameter, SDL_PERSISTENT); + ht = emalloc(sizeof(HashTable)); + zend_hash_init(ht, i, NULL, delete_parameter, 0); while (i > 0) { - sdlParamPtr param = sdl_malloc(sizeof(sdlParam)); + sdlParamPtr param = emalloc(sizeof(sdlParam)); sdl_deserialize_key(ht, param, in); param->paramName = sdl_deserialize_string(in); WSDL_CACHE_GET_INT(param->order, in); @@ -1186,7 +1186,7 @@ } WSDL_CACHE_SKIP(i, &in); - sdl = sdl_malloc(sizeof(*sdl)); + sdl = emalloc(sizeof(*sdl)); memset(sdl, 0, sizeof(*sdl)); sdl->source = sdl_deserialize_string(&in); @@ -1201,7 +1201,7 @@ types = do_alloca((i+1)*sizeof(sdlTypePtr)); types[0] = NULL; while (i > 0) { - types[i] = sdl_malloc(sizeof(sdlType)); + types[i] = emalloc(sizeof(sdlType)); memset(types[i], 0, sizeof(sdlType)); i--; } @@ -1215,7 +1215,7 @@ i = num_encoders; encoders[0] = NULL; while (i > 0) { - encoders[i] = sdl_malloc(sizeof(encode)); + encoders[i] = emalloc(sizeof(encode)); memset(encoders[i], 0, sizeof(encode)); i--; } @@ -1227,8 +1227,8 @@ i = 1; if (num_groups > 0) { - sdl->groups = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->groups, num_groups, NULL, delete_type, SDL_PERSISTENT); + sdl->groups = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->groups, num_groups, NULL, delete_type, 0); while (i < num_groups+1) { sdl_deserialize_key(sdl->groups, types[i], &in); sdl_deserialize_type(types[i], types, encoders, &in); @@ -1237,8 +1237,8 @@ } if (num_types > 0) { - sdl->types = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->types, num_types, NULL, delete_type, SDL_PERSISTENT); + sdl->types = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->types, num_types, NULL, delete_type, 0); while (i < num_groups+num_types+1) { sdl_deserialize_key(sdl->types, types[i], &in); sdl_deserialize_type(types[i], types, encoders, &in); @@ -1247,8 +1247,8 @@ } if (num_elements > 0) { - sdl->elements = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->elements, num_elements, NULL, delete_type, SDL_PERSISTENT); + sdl->elements = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->elements, num_elements, NULL, delete_type, 0); while (i < num_groups+num_types+num_elements+1) { sdl_deserialize_key(sdl->elements, types[i], &in); sdl_deserialize_type(types[i], types, encoders, &in); @@ -1258,8 +1258,8 @@ i = 1; if (num_encoders > 0) { - sdl->encoders = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->encoders, num_encoders, NULL, delete_encoder, SDL_PERSISTENT); + sdl->encoders = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->encoders, num_encoders, NULL, delete_encoder, 0); while (i < num_encoders+1) { sdl_deserialize_key(sdl->encoders, encoders[i], &in); sdl_deserialize_encoder(encoders[i], types, &in); @@ -1271,10 +1271,10 @@ WSDL_CACHE_GET_INT(num_bindings, &in); bindings = do_alloca(num_bindings*sizeof(sdlBindingPtr)); if (num_bindings > 0) { - sdl->bindings = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->bindings, num_bindings, NULL, delete_binding, SDL_PERSISTENT); + sdl->bindings = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->bindings, num_bindings, NULL, delete_binding, 0); for (i = 0; i < num_bindings; i++) { - sdlBindingPtr binding = sdl_malloc(sizeof(sdlBinding)); + sdlBindingPtr binding = emalloc(sizeof(sdlBinding)); memset(binding, 0, sizeof(sdlBinding)); sdl_deserialize_key(sdl->bindings, binding, &in); binding->name = sdl_deserialize_string(&in); @@ -1282,7 +1282,7 @@ WSDL_CACHE_GET_1(binding->bindingType,sdlBindingType,&in); if (binding->bindingType == BINDING_SOAP) { if (*in != 0) { - sdlSoapBindingPtr soap_binding = binding->bindingAttributes = sdl_malloc(sizeof(sdlSoapBinding)); + sdlSoapBindingPtr soap_binding = binding->bindingAttributes = emalloc(sizeof(sdlSoapBinding)); WSDL_CACHE_GET_1(soap_binding->style,sdlEncodingStyle,&in); soap_binding->transport = sdl_deserialize_string(&in); } else { @@ -1295,11 +1295,11 @@ /* deserialize functions */ WSDL_CACHE_GET_INT(num_func, &in); - zend_hash_init(&sdl->functions, num_func, NULL, delete_function, SDL_PERSISTENT); + zend_hash_init(&sdl->functions, num_func, NULL, delete_function, 0); functions = do_alloca(num_func*sizeof(sdlFunctionPtr)); for (i = 0; i < num_func; i++) { int binding_num; - sdlFunctionPtr func = sdl_malloc(sizeof(sdlFunction)); + sdlFunctionPtr func = emalloc(sizeof(sdlFunction)); sdl_deserialize_key(&sdl->functions, func, &in); func->functionName = sdl_deserialize_string(&in); func->requestName = sdl_deserialize_string(&in); @@ -1313,7 +1313,7 @@ } if (func->binding && func->binding->bindingType == BINDING_SOAP) { if (*in != 0) { - sdlSoapBindingFunctionPtr binding = func->bindingAttributes = sdl_malloc(sizeof(sdlSoapBindingFunction)); + sdlSoapBindingFunctionPtr binding = func->bindingAttributes = emalloc(sizeof(sdlSoapBindingFunction)); memset(binding, 0, sizeof(sdlSoapBindingFunction)); WSDL_CACHE_GET_1(binding->style,sdlEncodingStyle,&in); binding->soapAction = sdl_deserialize_string(&in); @@ -1332,8 +1332,8 @@ /* deserialize requests */ WSDL_CACHE_GET_INT(i, &in); if (i > 0) { - sdl->requests = sdl_malloc(sizeof(HashTable)); - zend_hash_init(sdl->requests, i, NULL, NULL, SDL_PERSISTENT); + sdl->requests = emalloc(sizeof(HashTable)); + zend_hash_init(sdl->requests, i, NULL, NULL, 0); while (i > 0) { int function_num; @@ -1902,18 +1902,8 @@ { sdlPtr sdl = NULL; char* old_error_code = SOAP_GLOBAL(error_code); -#ifdef SDL_CACHE - sdlPtr *hndl; SOAP_GLOBAL(error_code) = "WSDL"; - if (zend_hash_find(SOAP_GLOBAL(sdls), uri, strlen(uri), (void **)&hndl) == FAILURE) { - sdl = load_wsdl(uri); - zend_hash_add(SOAP_GLOBAL(sdls), uri, strlen(uri), &sdl, sizeof(sdlPtr), NULL); - } else { - sdl = *hndl; - } -#else - SOAP_GLOBAL(error_code) = "WSDL"; if (SOAP_GLOBAL(cache_enabled)) { char fn[MAXPATHLEN]; @@ -1951,7 +1941,6 @@ } else { sdl = load_wsdl(uri); } -#endif SOAP_GLOBAL(error_code) = old_error_code; return sdl; } @@ -1963,36 +1952,36 @@ zend_hash_destroy(&tmp->functions); if (tmp->source) { - sdl_free(tmp->source); + efree(tmp->source); } if (tmp->target_ns) { - sdl_free(tmp->target_ns); + efree(tmp->target_ns); } if (tmp->elements) { zend_hash_destroy(tmp->elements); - sdl_free(tmp->elements); + efree(tmp->elements); } if (tmp->encoders) { zend_hash_destroy(tmp->encoders); - sdl_free(tmp->encoders); + efree(tmp->encoders); } if (tmp->types) { zend_hash_destroy(tmp->types); - sdl_free(tmp->types); + efree(tmp->types); } if (tmp->groups) { zend_hash_destroy(tmp->groups); - sdl_free(tmp->groups); + efree(tmp->groups); } if (tmp->bindings) { zend_hash_destroy(tmp->bindings); - sdl_free(tmp->bindings); + efree(tmp->bindings); } if (tmp->requests) { zend_hash_destroy(tmp->requests); - sdl_free(tmp->requests); + efree(tmp->requests); } - sdl_free(tmp); + efree(tmp); } void delete_sdl_ptr(void *handle) @@ -2005,36 +1994,36 @@ sdlBindingPtr binding = *((sdlBindingPtr*)data); if (binding->location) { - sdl_free(binding->location); + efree(binding->location); } if (binding->name) { - sdl_free(binding->name); + efree(binding->name); } if (binding->bindingType == BINDING_SOAP) { sdlSoapBindingPtr soapBind = binding->bindingAttributes; if (soapBind && soapBind->transport) { - sdl_free(soapBind->transport); + efree(soapBind->transport); } - sdl_free(soapBind); + efree(soapBind); } - sdl_free(binding); + efree(binding); } static void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body) { if (body.ns) { - sdl_free(body.ns); + efree(body.ns); } if (body.parts) { - sdl_free(body.parts); + efree(body.parts); } if (body.encodingStyle) { - sdl_free(body.encodingStyle); + efree(body.encodingStyle); } if (body.headers) { zend_hash_destroy(body.headers); - sdl_free(body.headers); + efree(body.headers); } } @@ -2043,58 +2032,58 @@ sdlFunctionPtr function = *((sdlFunctionPtr*)data); if (function->functionName) { - sdl_free(function->functionName); + efree(function->functionName); } if (function->requestName) { - sdl_free(function->requestName); + efree(function->requestName); } if (function->responseName) { - sdl_free(function->responseName); + efree(function->responseName); } if (function->requestParameters) { zend_hash_destroy(function->requestParameters); - sdl_free(function->requestParameters); + efree(function->requestParameters); } if (function->responseParameters) { zend_hash_destroy(function->responseParameters); - sdl_free(function->responseParameters); + efree(function->responseParameters); } if (function->bindingAttributes && function->binding && function->binding->bindingType == BINDING_SOAP) { sdlSoapBindingFunctionPtr soapFunction = function->bindingAttributes; if (soapFunction->soapAction) { - sdl_free(soapFunction->soapAction); + efree(soapFunction->soapAction); } delete_sdl_soap_binding_function_body(soapFunction->input); delete_sdl_soap_binding_function_body(soapFunction->output); - sdl_free(soapFunction); + efree(soapFunction); } - sdl_free(function); + efree(function); } static void delete_parameter(void *data) { sdlParamPtr param = *((sdlParamPtr*)data); if (param->paramName) { - sdl_free(param->paramName); + efree(param->paramName); } - sdl_free(param); + efree(param); } static void delete_header(void *data) { sdlSoapBindingFunctionHeaderPtr hdr = *((sdlSoapBindingFunctionHeaderPtr*)data); if (hdr->name) { - sdl_free(hdr->name); + efree(hdr->name); } if (hdr->ns) { - sdl_free(hdr->ns); + efree(hdr->ns); } if (hdr->encodingStyle) { - sdl_free(hdr->encodingStyle); + efree(hdr->encodingStyle); } - sdl_free(hdr); + efree(hdr); } static void delete_document(void *doc_ptr) http://cvs.php.net/diff.php/php-src/ext/soap/php_sdl.h?r1=1.27&r2=1.28&ty=u Index: php-src/ext/soap/php_sdl.h diff -u php-src/ext/soap/php_sdl.h:1.27 php-src/ext/soap/php_sdl.h:1.28 --- php-src/ext/soap/php_sdl.h:1.27 Thu Feb 12 11:42:34 2004 +++ php-src/ext/soap/php_sdl.h Fri Feb 13 06:03:58 2004 @@ -17,23 +17,11 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_sdl.h,v 1.27 2004/02/12 16:42:34 dmitry Exp $ */ +/* $Id: php_sdl.h,v 1.28 2004/02/13 11:03:58 dmitry Exp $ */ #ifndef PHP_SDL_H #define PHP_SDL_H -#ifdef SDL_CACHE -# define SDL_PERSISTENT 1 -# define sdl_malloc malloc -# define sdl_strdup strdup -# define sdl_free free -#else -# define SDL_PERSISTENT 0 -# define sdl_malloc emalloc -# define sdl_strdup estrdup -# define sdl_free efree -#endif - #define XSD_WHITESPACE_COLLAPSE 1 #define XSD_WHITESPACE_PRESERVE 1 #define XSD_WHITESPACE_REPLACE 1 http://cvs.php.net/diff.php/php-src/ext/soap/php_soap.h?r1=1.29&r2=1.30&ty=u Index: php-src/ext/soap/php_soap.h diff -u php-src/ext/soap/php_soap.h:1.29 php-src/ext/soap/php_soap.h:1.30 --- php-src/ext/soap/php_soap.h:1.29 Wed Feb 11 08:53:48 2004 +++ php-src/ext/soap/php_soap.h Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_soap.h,v 1.29 2004/02/11 13:53:48 dmitry Exp $ */ +/* $Id: php_soap.h,v 1.30 2004/02/13 11:03:58 dmitry Exp $ */ #ifndef PHP_SOAP_H #define PHP_SOAP_H @@ -142,7 +142,6 @@ HashTable defEncNs; /* mapping of default namespaces to prefixes */ HashTable defEnc; HashTable defEncIndex; - HashTable *sdls; HashTable *overrides; int cur_uniq_ns; int soap_version; http://cvs.php.net/diff.php/php-src/ext/soap/soap.c?r1=1.82&r2=1.83&ty=u Index: php-src/ext/soap/soap.c diff -u php-src/ext/soap/soap.c:1.82 php-src/ext/soap/soap.c:1.83 --- php-src/ext/soap/soap.c:1.82 Fri Feb 13 03:30:13 2004 +++ php-src/ext/soap/soap.c Fri Feb 13 06:03:58 2004 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: soap.c,v 1.82 2004/02/13 08:30:13 dmitry Exp $ */ +/* $Id: soap.c,v 1.83 2004/02/13 11:03:58 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -357,9 +357,6 @@ int i; long enc; - soap_globals->sdls = malloc(sizeof(HashTable)); - zend_hash_init(soap_globals->sdls, 0, NULL, delete_sdl_ptr, 1); - zend_hash_init(&soap_globals->defEnc, 0, NULL, NULL, 1); zend_hash_init(&soap_globals->defEncIndex, 0, NULL, NULL, 1); zend_hash_init(&soap_globals->defEncNs, 0, NULL, NULL, 1); @@ -407,8 +404,6 @@ zend_hash_destroy(&SOAP_GLOBAL(defEnc)); zend_hash_destroy(&SOAP_GLOBAL(defEncIndex)); zend_hash_destroy(&SOAP_GLOBAL(defEncNs)); - zend_hash_destroy(SOAP_GLOBAL(sdls)); - free(SOAP_GLOBAL(sdls)); return SUCCESS; } @@ -487,11 +482,8 @@ INIT_CLASS_ENTRY(ce, PHP_SOAP_HEADER_CLASSNAME, soap_header_functions); soap_header_class_entry = zend_register_internal_class(&ce TSRMLS_CC); -#ifdef SDL_CACHE - le_sdl = register_list_destructors(NULL, NULL); -#else + le_sdl = register_list_destructors(delete_sdl, NULL); -#endif le_url = register_list_destructors(delete_url, NULL); le_service = register_list_destructors(delete_service, NULL); @@ -952,7 +944,7 @@ if (!service->mapping) { service->mapping = emalloc(sizeof(HashTable)); - zend_hash_init(service->mapping, 0, NULL, delete_tmp_encoder, 0); + zend_hash_init(service->mapping, 0, NULL, delete_encoder, 0); } zend_hash_update(service->mapping, type, type_len + 1, &new_enc, sizeof(encodePtr), NULL); smart_str_free(&resloved_ns); @@ -3440,10 +3432,8 @@ if (service->uri) { efree(service->uri); } -#ifndef SDL_CACHE if (service->sdl) { delete_sdl(service->sdl); } -#endif efree(service); }