diff options
Diffstat (limited to 'ext/xmlrpc')
-rw-r--r-- | ext/xmlrpc/libxmlrpc/base64.c | 8 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/encodings.c | 17 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/queue.c | 47 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/simplestring.c | 7 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/xml_element.c | 21 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c | 29 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/xml_to_soap.c | 23 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c | 45 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/xmlrpc.c | 21 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/xmlrpc.h | 1 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c | 5 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/xmlrpc_private.h | 2 | ||||
-rw-r--r-- | ext/xmlrpc/libxmlrpc/xmlrpc_win32.h | 16 | ||||
-rw-r--r-- | ext/xmlrpc/xmlrpc-epi-php.c | 6 |
14 files changed, 101 insertions, 147 deletions
diff --git a/ext/xmlrpc/libxmlrpc/base64.c b/ext/xmlrpc/libxmlrpc/base64.c index 5ebdf31f7a..dd60dc9cd6 100644 --- a/ext/xmlrpc/libxmlrpc/base64.c +++ b/ext/xmlrpc/libxmlrpc/base64.c @@ -15,7 +15,7 @@ static const char rcsid[] = "#(@) $Id$"; /* ENCODE -- Encode binary file into base64. */ #include <stdlib.h> #include <ctype.h> -#include <limits.h> +#include <php.h> #include "base64.h" @@ -24,7 +24,7 @@ static unsigned char dtable[512]; void buffer_new(struct buffer_st *b) { b->length = 512; - b->data = malloc(sizeof(char)*(b->length)); + b->data = emalloc(sizeof(char)*(b->length)); b->data[0] = 0; b->ptr = b->data; b->offset = 0; @@ -39,14 +39,14 @@ void buffer_add(struct buffer_st *b, char c) b->offset++; if (b->offset == b->length) { b->length += 512; - b->data = realloc(b->data, b->length); + b->data = erealloc(b->data, b->length); b->ptr = b->data + b->offset; } } void buffer_delete(struct buffer_st *b) { - free(b->data); + efree(b->data); b->length = 0; b->offset = 0; b->ptr = NULL; diff --git a/ext/xmlrpc/libxmlrpc/encodings.c b/ext/xmlrpc/libxmlrpc/encodings.c index 081e38e5de..5777152ea8 100644 --- a/ext/xmlrpc/libxmlrpc/encodings.c +++ b/ext/xmlrpc/libxmlrpc/encodings.c @@ -30,16 +30,7 @@ */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifndef PHP_WIN32 -#include <php_config.h> -#else -#include <config.w32.h> -#include <stdlib.h> -#endif +#include <php.h> static const char rcsid[] = "#(@) $Id$"; @@ -74,7 +65,7 @@ static char* convert(const char* src, int src_len, int *new_len, const char* fro ic = iconv_open(to_enc, from_enc); if(ic != (iconv_t)-1) { size_t st; - outbuf = (char*)malloc(outlen + 1); + outbuf = (char*)emalloc(outlen + 1); if(outbuf) { out_ptr = (char*)outbuf; @@ -85,14 +76,14 @@ static char* convert(const char* src, int src_len, int *new_len, const char* fro int diff = out_ptr - outbuf; outlen += inlenleft; outlenleft += inlenleft; - outbuf = (char*)realloc(outbuf, outlen + 1); + outbuf = (char*)erealloc(outbuf, outlen + 1); if(!outbuf) { break; } out_ptr = outbuf + diff; } else { - free(outbuf); + efree(outbuf); outbuf = 0; break; } diff --git a/ext/xmlrpc/libxmlrpc/queue.c b/ext/xmlrpc/libxmlrpc/queue.c index 6a0ba1df47..961b4ca873 100644 --- a/ext/xmlrpc/libxmlrpc/queue.c +++ b/ext/xmlrpc/libxmlrpc/queue.c @@ -97,13 +97,10 @@ static const char rcsid[] = "#(@) $Id$"; * ****************************************************************/ -#ifdef _WIN32 -#include "xmlrpc_win32.h" -#endif #include <stdlib.h> +#include <php.h> #include "queue.h" - static void QuickSort(void *list[], int low, int high, int (*Comp)(const void *, const void *)); static int Q_BSearch(queue *q, void *key, @@ -111,8 +108,8 @@ static int Q_BSearch(queue *q, void *key, /* The index: a pointer to pointers */ -static void **index; -static datanode **posn_index; +static void **queue_index; +static datanode **queue_posn_index; /*** @@ -289,7 +286,7 @@ int Q_PushHead(queue *q, void *d) node *n; datanode *p; - p = malloc(sizeof(datanode)); + p = emalloc(sizeof(datanode)); if(p == NULL) return False_; @@ -341,7 +338,7 @@ int Q_PushTail(queue *q, void *d) node *p; datanode *n; - n = malloc(sizeof(datanode)); + n = emalloc(sizeof(datanode)); if(n == NULL) return False_; @@ -397,7 +394,7 @@ void *Q_PopHead(queue *q) d = q->head->data; n = q->head->next; - free(q->head); + efree(q->head); q->size--; @@ -440,7 +437,7 @@ void *Q_PopTail(queue *q) d = q->tail->data; p = q->tail->prev; - free(q->tail); + efree(q->tail); q->size--; if(q->size == 0) @@ -539,7 +536,7 @@ void *Q_Iter_Del(queue *q, q_iter iter) p = ((node*)iter)->prev; d = ((node*)iter)->data; - free(iter); + efree(iter); if(p) { p->next = n; @@ -783,20 +780,20 @@ int Q_Sort(queue *q, int (*Comp)(const void *, const void *)) /* if already sorted free memory for tag array */ if(q->sorted) { - free(index); - free(posn_index); + efree(queue_index); + efree(queue_posn_index); q->sorted = False_; } /* Now allocate memory of array, array of pointers */ - index = malloc(q->size * sizeof(q->cursor->data)); - if(index == NULL) + queue_index = emalloc(q->size * sizeof(q->cursor->data)); + if(queue_index == NULL) return False_; - posn_index = malloc(q->size * sizeof(q->cursor)); - if(posn_index == NULL) { - free(index); + queue_posn_index = emalloc(q->size * sizeof(q->cursor)); + if(queue_posn_index == NULL) { + efree(queue_index); return False_; } @@ -804,21 +801,21 @@ int Q_Sort(queue *q, int (*Comp)(const void *, const void *)) d = Q_Head(q); for(i=0; i < q->size; i++) { - index[i] = d; - posn_index[i] = q->cursor; + queue_index[i] = d; + queue_posn_index[i] = q->cursor; d = Q_Next(q); } /* Now sort the index */ - QuickSort(index, 0, q->size - 1, Comp); + QuickSort(queue_index, 0, q->size - 1, Comp); /* Rearrange the actual queue into correct order */ dn = q->head; i = 0; while(dn != NULL) { - dn->data = index[i++]; + dn->data = queue_index[i++]; dn = dn->next; } @@ -860,7 +857,7 @@ static int Q_BSearch( queue *q, void *key, while(low <= hi) { mid = (low + hi) / 2; - val = Comp(key, index[ mid ]); + val = Comp(key, queue_index[ mid ]); if(val < 0) hi = mid - 1; @@ -912,9 +909,9 @@ void *Q_Seek(queue *q, void *data, int (*Comp)(const void *, const void *)) if(idx < 0) return NULL; - q->cursor = posn_index[idx]; + q->cursor = queue_posn_index[idx]; - return index[idx]; + return queue_index[idx]; } diff --git a/ext/xmlrpc/libxmlrpc/simplestring.c b/ext/xmlrpc/libxmlrpc/simplestring.c index 98b5c81e42..745f71ef02 100644 --- a/ext/xmlrpc/libxmlrpc/simplestring.c +++ b/ext/xmlrpc/libxmlrpc/simplestring.c @@ -30,6 +30,7 @@ */ +#include <php.h> static const char rcsid[] = "#(@) $Id$"; @@ -83,7 +84,7 @@ static const char rcsid[] = "#(@) $Id$"; #include <limits.h> #include "simplestring.h" -#define my_free(thing) if(thing) {free(thing); thing = 0;} +#define my_free(thing) if(thing) {efree(thing); thing = 0;} /*----------------------** * Begin String Functions * @@ -112,7 +113,7 @@ void simplestring_init(simplestring* string) { /******/ static void simplestring_init_str(simplestring* string) { - string->str = (char*)malloc(SIMPLESTRING_INCR); + string->str = (char*)emalloc(SIMPLESTRING_INCR); if(string->str) { string->str[0] = 0; string->len = 0; @@ -219,7 +220,7 @@ void simplestring_addn(simplestring* target, const char* source, size_t add_len) /* some kind of overflow happened */ return; } - target->str = (char*)realloc(target->str, newsize); + target->str = (char*)erealloc(target->str, newsize); target->size = target->str ? newsize : 0; } diff --git a/ext/xmlrpc/libxmlrpc/xml_element.c b/ext/xmlrpc/libxmlrpc/xml_element.c index 6fc6bd3977..070680d4a7 100644 --- a/ext/xmlrpc/libxmlrpc/xml_element.c +++ b/ext/xmlrpc/libxmlrpc/xml_element.c @@ -119,9 +119,6 @@ static const char rcsid[] = "#(@) $Id$"; ******/ #include "ext/xml/expat_compat.h" -#ifdef _WIN32 -#include "xmlrpc_win32.h" -#endif #include <stdlib.h> #include <string.h> #include <ctype.h> @@ -130,7 +127,7 @@ static const char rcsid[] = "#(@) $Id$"; #include "queue.h" #include "encodings.h" -#define my_free(thing) if(thing) {free(thing); thing = NULL;} +#define my_free(thing) if(thing) {efree(thing); thing = NULL;} #define XML_DECL_START "<?xml" #define XML_DECL_START_LEN sizeof(XML_DECL_START) - 1 @@ -207,7 +204,7 @@ void xml_elem_free_non_recurse(xml_element* root) { Q_Destroy(&root->children); Q_Destroy(&root->attrs); if(root->name) { - free((char *)root->name); + efree((char *)root->name); root->name = NULL; } simplestring_free(&root->text); @@ -263,7 +260,7 @@ void xml_elem_free(xml_element* root) { * SOURCE */ xml_element* xml_elem_new() { - xml_element* elem = calloc(1, sizeof(xml_element)); + xml_element* elem = ecalloc(1, sizeof(xml_element)); if(elem) { Q_Init(&elem->children); Q_Init(&elem->attrs); @@ -347,7 +344,7 @@ static char* xml_elem_entity_escape(const char* buf, int old_len, int *newlen, X if(ToBeXmlEscaped) { - NewBuffer= malloc(iLength+1); + NewBuffer= emalloc(iLength+1); if(NewBuffer) { bufcopy=buf; while(*bufcopy) { @@ -602,15 +599,15 @@ static void _xmlrpc_startElement(void *userData, const char *name, const char ** c = mydata->current; mydata->current = xml_elem_new(); - mydata->current->name = (char*)strdup(name); + mydata->current->name = (char*)estrdup(name); mydata->current->parent = c; /* init attrs */ while(p && *p) { - xml_element_attr* attr = malloc(sizeof(xml_element_attr)); + xml_element_attr* attr = emalloc(sizeof(xml_element_attr)); if(attr) { - attr->key = strdup(*p); - attr->val = strdup(*(p+1)); + attr->key = estrdup(*p); + attr->val = estrdup(*(p+1)); Q_PushTail(&mydata->current->attrs, attr); p += 2; @@ -646,7 +643,7 @@ static void _xmlrpc_charHandler(void *userData, if(add_text) { len = new_len; simplestring_addn(&mydata->current->text, add_text, len); - free(add_text); + efree(add_text); return; } } diff --git a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c b/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c index 000df192fd..63cc52d6b7 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c +++ b/ext/xmlrpc/libxmlrpc/xml_to_dandarpc.c @@ -30,9 +30,6 @@ */ -#ifdef _WIN32 -#include "xmlrpc_win32.h" -#endif #include <string.h> #include <stdlib.h> #include "xml_to_dandarpc.h" @@ -180,21 +177,21 @@ xml_element* DANDARPC_to_xml_element_worker(XMLRPC_REQUEST request, XMLRPC_VALUE xml_element* elem_val = xml_elem_new(); const char* pAttrType = NULL; - xml_element_attr* attr_type = bNoAddType ? NULL : malloc(sizeof(xml_element_attr)); + xml_element_attr* attr_type = bNoAddType ? NULL : emalloc(sizeof(xml_element_attr)); if(attr_type) { - attr_type->key = strdup(ATTR_TYPE); + attr_type->key = estrdup(ATTR_TYPE); attr_type->val = 0; Q_PushTail(&elem_val->attrs, attr_type); } - elem_val->name = (type == xmlrpc_vector) ? strdup(ATTR_VECTOR) : strdup(ATTR_SCALAR); + elem_val->name = (type == xmlrpc_vector) ? estrdup(ATTR_VECTOR) : estrdup(ATTR_SCALAR); if(id && *id) { - xml_element_attr* attr_id = malloc(sizeof(xml_element_attr)); + xml_element_attr* attr_id = emalloc(sizeof(xml_element_attr)); if(attr_id) { - attr_id->key = strdup(ATTR_ID); - attr_id->val = strdup(id); + attr_id->key = estrdup(ATTR_ID); + attr_id->val = estrdup(id); Q_PushTail(&elem_val->attrs, attr_id); } } @@ -265,7 +262,7 @@ xml_element* DANDARPC_to_xml_element_worker(XMLRPC_REQUEST request, XMLRPC_VALUE break; } if(pAttrType && attr_type && !bNoAddType) { - attr_type->val = strdup(pAttrType); + attr_type->val = estrdup(pAttrType); } root = elem_val; } @@ -282,9 +279,9 @@ xml_element* DANDARPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) { if(request) { XMLRPC_REQUEST_TYPE request_type = XMLRPC_RequestGetRequestType(request); const char* pStr = NULL; - xml_element_attr* version = malloc(sizeof(xml_element_attr)); - version->key = strdup(ATTR_VERSION); - version->val = strdup(VAL_VERSION_0_9); + xml_element_attr* version = emalloc(sizeof(xml_element_attr)); + version->key = estrdup(ATTR_VERSION); + version->val = estrdup(VAL_VERSION_0_9); wrapper = xml_elem_new(); @@ -295,11 +292,11 @@ xml_element* DANDARPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) { pStr = ELEM_METHODCALL; } if(pStr) { - wrapper->name = strdup(pStr); + wrapper->name = estrdup(pStr); } root = xml_elem_new(); - root->name = strdup(ELEM_ROOT); + root->name = estrdup(ELEM_ROOT); Q_PushTail(&root->attrs, version); Q_PushTail(&root->children, wrapper); @@ -307,7 +304,7 @@ xml_element* DANDARPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) { if(pStr) { xml_element* method = xml_elem_new(); - method->name = strdup(ELEM_METHODNAME); + method->name = estrdup(ELEM_METHODNAME); simplestring_add(&method->text, pStr); Q_PushTail(&wrapper->children, method); } diff --git a/ext/xmlrpc/libxmlrpc/xml_to_soap.c b/ext/xmlrpc/libxmlrpc/xml_to_soap.c index e0604bae62..64a9a6eaa5 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_soap.c +++ b/ext/xmlrpc/libxmlrpc/xml_to_soap.c @@ -23,9 +23,6 @@ static const char rcsid[] = "#(@) $Id:"; -#ifdef _WIN32 -#include "xmlrpc_win32.h" -#endif #include <string.h> #include <stdlib.h> #include "xml_to_soap.h" @@ -66,10 +63,10 @@ static inline int is_soap_type(const char* soap_type) { /* utility func to generate a new attribute. possibly should be in xml_element.c?? */ static xml_element_attr* new_attr(const char* key, const char* val) { - xml_element_attr* attr = malloc(sizeof(xml_element_attr)); + xml_element_attr* attr = emalloc(sizeof(xml_element_attr)); if (attr) { - attr->key = key ? strdup(key) : NULL; - attr->val = val ? strdup(val) : NULL; + attr->key = key ? estrdup(key) : NULL; + attr->val = val ? estrdup(val) : NULL; } return attr; } @@ -87,7 +84,7 @@ struct array_info { static struct array_info* parse_array_type_info(const char* array_type) { struct array_info* ai = NULL; if (array_type) { - ai = (struct array_info*)calloc(1, sizeof(struct array_info)); + ai = (struct array_info*)ecalloc(1, sizeof(struct array_info)); if (ai) { char buf[128], *p; snprintf(buf, sizeof(buf), "%s", array_type); @@ -407,7 +404,7 @@ XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request, } /* cleanup */ if (ai) { - free(ai); + efree(ai); } } } @@ -563,7 +560,7 @@ xml_element* SOAP_to_xml_element_worker(XMLRPC_REQUEST request, XMLRPC_VALUE nod } } } - elem_val->name = strdup(pName); + elem_val->name = estrdup(pName); /* cleanup */ if (bFreeNode) { @@ -585,7 +582,7 @@ xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request) { /* safety first. */ if (root) { xml_element* body = xml_elem_new(); - root->name = strdup("SOAP-ENV:Envelope"); + root->name = estrdup("SOAP-ENV:Envelope"); /* silly namespace stuff */ Q_PushTail(&root->attrs, new_attr("xmlns:SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/")); @@ -620,7 +617,7 @@ xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request) { /* if we are making a request, we want to use the methodname as is. */ if (rtype == xmlrpc_request_call) { if (methodname) { - rpc->name = strdup(methodname); + rpc->name = estrdup(methodname); } } /* if it's a response, we append "Response". Also, given xmlrpc-epi @@ -632,7 +629,7 @@ xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request) { methodname ? methodname : "", "Response"); - rpc->name = strdup(buf); + rpc->name = estrdup(buf); } /* add serialized data to method call/response. @@ -660,7 +657,7 @@ xml_element* SOAP_REQUEST_to_xml_element(XMLRPC_REQUEST request) { } } } - body->name = strdup("SOAP-ENV:Body"); + body->name = estrdup("SOAP-ENV:Body"); Q_PushTail(&root->children, body); } } diff --git a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c index c557ee06d8..309f0dce3d 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c +++ b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c @@ -35,9 +35,6 @@ static const char rcsid[] = "#(@) $Id$"; #include "php.h" #include "main/snprintf.h" -#ifdef _WIN32 -#include "xmlrpc_win32.h" -#endif #include <string.h> #include <stdlib.h> #include "xml_to_xmlrpc.h" @@ -207,40 +204,40 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA if (next_el) { Q_PushTail(&elem_val->children, next_el); } - elem_val->name = strdup(bIsFault ? ELEM_FAULT : ELEM_PARAMS); + elem_val->name = estrdup(bIsFault ? ELEM_FAULT : ELEM_PARAMS); } else { switch (type) { case xmlrpc_empty: /* treat null value as empty string in xmlrpc. */ case xmlrpc_string: - elem_val->name = strdup(ELEM_STRING); + elem_val->name = estrdup(ELEM_STRING); simplestring_addn(&elem_val->text, XMLRPC_GetValueString(node), XMLRPC_GetValueStringLen(node)); break; case xmlrpc_int: - elem_val->name = strdup(ELEM_INT); + elem_val->name = estrdup(ELEM_INT); snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueInt(node)); simplestring_add(&elem_val->text, buf); break; case xmlrpc_boolean: - elem_val->name = strdup(ELEM_BOOLEAN); + elem_val->name = estrdup(ELEM_BOOLEAN); snprintf(buf, BUF_SIZE, "%i", XMLRPC_GetValueBoolean(node)); simplestring_add(&elem_val->text, buf); break; case xmlrpc_double: { - elem_val->name = strdup(ELEM_DOUBLE); + elem_val->name = estrdup(ELEM_DOUBLE); ap_php_snprintf(buf, BUF_SIZE, "%.*G", (int) EG(precision), XMLRPC_GetValueDouble(node)); simplestring_add(&elem_val->text, buf); } break; case xmlrpc_datetime: - elem_val->name = strdup(ELEM_DATETIME); + elem_val->name = estrdup(ELEM_DATETIME); simplestring_add(&elem_val->text, XMLRPC_GetValueDateTime_ISO8601(node)); break; case xmlrpc_base64: { struct buffer_st buf; - elem_val->name = strdup(ELEM_BASE64); + elem_val->name = estrdup(ELEM_BASE64); base64_encode_xmlrpc(&buf, XMLRPC_GetValueBase64(node), XMLRPC_GetValueStringLen(node)); simplestring_addn(&elem_val->text, buf.data, buf.offset ); buffer_delete(&buf); @@ -256,7 +253,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA case xmlrpc_vector_array: { if(depth == 0) { - elem_val->name = strdup(ELEM_PARAMS); + elem_val->name = estrdup(ELEM_PARAMS); } else { /* Hi my name is Dave and I like to make things as confusing @@ -268,9 +265,9 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA * GRRRRRRRRR! */ xml_element* data = xml_elem_new(); - data->name = strdup(ELEM_DATA); + data->name = estrdup(ELEM_DATA); - elem_val->name = strdup(ELEM_ARRAY); + elem_val->name = estrdup(ELEM_ARRAY); Q_PushTail(&elem_val->children, data); root_vector_elem = data; } @@ -278,7 +275,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA break; case xmlrpc_vector_mixed: /* not officially supported */ case xmlrpc_vector_struct: - elem_val->name = strdup(ELEM_STRUCT); + elem_val->name = estrdup(ELEM_STRUCT); break; default: break; @@ -304,7 +301,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA if (depth == 1) { xml_element* value = xml_elem_new(); - value->name = strdup(ELEM_VALUE); + value->name = estrdup(ELEM_VALUE); /* yet another hack for the "fault" crap */ if (XMLRPC_VectorGetValueWithID(node, ELEM_FAULTCODE)) { @@ -312,7 +309,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA } else { xml_element* param = xml_elem_new(); - param->name = strdup(ELEM_PARAM); + param->name = estrdup(ELEM_PARAM); Q_PushTail(¶m->children, value); @@ -325,9 +322,9 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA xml_element* name = xml_elem_new(); xml_element* value = xml_elem_new(); - member->name = strdup(ELEM_MEMBER); - name->name = strdup(ELEM_NAME); - value->name = strdup(ELEM_VALUE); + member->name = estrdup(ELEM_MEMBER); + name->name = estrdup(ELEM_NAME); + value->name = estrdup(ELEM_VALUE); simplestring_add(&name->text, XMLRPC_GetValueID(node)); @@ -340,7 +337,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA else if (vtype == xmlrpc_vector_array) { xml_element* value = xml_elem_new(); - value->name = strdup(ELEM_VALUE); + value->name = estrdup(ELEM_VALUE); Q_PushTail(&value->children, elem_val); @@ -353,7 +350,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA else { xml_element* value = xml_elem_new(); - value->name = strdup(ELEM_VALUE); + value->name = estrdup(ELEM_VALUE); Q_PushTail(&value->children, elem_val); @@ -384,7 +381,7 @@ xml_element* XMLRPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) { pStr = ELEM_METHODRESPONSE; } if (pStr) { - wrapper->name = strdup(pStr); + wrapper->name = estrdup(pStr); } if(request_type == xmlrpc_request_call) { @@ -392,7 +389,7 @@ xml_element* XMLRPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) { if (pStr) { xml_element* method = xml_elem_new(); - method->name = strdup(ELEM_METHODNAME); + method->name = estrdup(ELEM_METHODNAME); simplestring_add(&method->text, pStr); Q_PushTail(&wrapper->children, method); } @@ -404,7 +401,7 @@ xml_element* XMLRPC_REQUEST_to_xml_element(XMLRPC_REQUEST request) { else { /* Despite the spec, the xml-rpc list folk want me to send an empty params element */ xml_element* params = xml_elem_new(); - params->name = strdup(ELEM_PARAMS); + params->name = estrdup(ELEM_PARAMS); Q_PushTail(&wrapper->children, params); } } diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.c b/ext/xmlrpc/libxmlrpc/xmlrpc.c index 0836f27291..7a7d9c833c 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc.c +++ b/ext/xmlrpc/libxmlrpc/xmlrpc.c @@ -145,9 +145,6 @@ static const char rcsid[] = "#(@) $Id$"; #include "ext/xml/expat_compat.h" #include "main/php_reentrancy.h" -#ifdef _WIN32 -#include "xmlrpc_win32.h" -#endif #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -308,7 +305,7 @@ static int date_to_ISO8601 (time_t value, char *buf, int length) { * SOURCE */ XMLRPC_REQUEST XMLRPC_RequestNew() { - XMLRPC_REQUEST xRequest = calloc(1, sizeof(STRUCT_XMLRPC_REQUEST)); + XMLRPC_REQUEST xRequest = ecalloc(1, sizeof(STRUCT_XMLRPC_REQUEST)); if(xRequest) { simplestring_init(&xRequest->methodName); } @@ -861,7 +858,7 @@ XMLRPC_REQUEST XMLRPC_REQUEST_FromXML (const char *in_buf, int len, * SOURCE */ XMLRPC_VALUE XMLRPC_CreateValueEmpty() { - XMLRPC_VALUE v = calloc(1, sizeof(STRUCT_XMLRPC_VALUE)); + XMLRPC_VALUE v = ecalloc(1, sizeof(STRUCT_XMLRPC_VALUE)); if(v) { #ifdef XMLRPC_DEBUG_REFCOUNT printf ("calloc'd 0x%x\n", v); @@ -1053,9 +1050,9 @@ int XMLRPC_SetIsVector(XMLRPC_VALUE value, XMLRPC_VECTOR_TYPE type) { } } else { - value->v = calloc(1, sizeof(STRUCT_XMLRPC_VECTOR)); + value->v = ecalloc(1, sizeof(STRUCT_XMLRPC_VECTOR)); if(value->v) { - value->v->q = (queue*)malloc(sizeof(queue)); + value->v->q = (queue*)emalloc(sizeof(queue)); if(value->v->q) { Q_Init(value->v->q); value->v->type = type; @@ -2322,7 +2319,7 @@ XMLRPC_VALUE_TYPE_EASY XMLRPC_GetValueTypeEasy (XMLRPC_VALUE value) { * SOURCE */ XMLRPC_SERVER XMLRPC_ServerCreate() { - XMLRPC_SERVER server = calloc(1, sizeof(STRUCT_XMLRPC_SERVER)); + XMLRPC_SERVER server = ecalloc(1, sizeof(STRUCT_XMLRPC_SERVER)); if(server) { Q_Init(&server->methodlist); Q_Init(&server->docslist); @@ -2392,9 +2389,7 @@ void XMLRPC_ServerDestroy(XMLRPC_SERVER server) { dm = Q_Next(&server->docslist); } while( sm ) { - if(sm->name) { - my_free(sm->name); - } + my_free(sm->name); if(sm->desc) { XMLRPC_CleanupValue(sm->desc); } @@ -2439,10 +2434,10 @@ void XMLRPC_ServerDestroy(XMLRPC_SERVER server) { int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb) { if(server && name && cb) { - server_method* sm = malloc(sizeof(server_method)); + server_method* sm = emalloc(sizeof(server_method)); if(sm) { - sm->name = strdup(name); + sm->name = estrdup(name); sm->method = cb; sm->desc = NULL; diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.h b/ext/xmlrpc/libxmlrpc/xmlrpc.h index 9b0d934129..12b6c7a8ee 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc.h +++ b/ext/xmlrpc/libxmlrpc/xmlrpc.h @@ -36,6 +36,7 @@ /* includes */ #include "xml_element.h" #include <time.h> /* for time_t */ +#include <php.h> #ifdef __cplusplus extern "C" { diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c index 6da21b974e..c554e73dc4 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c +++ b/ext/xmlrpc/libxmlrpc/xmlrpc_introspection.c @@ -51,9 +51,6 @@ *******/ -#ifdef _WIN32 -#include "xmlrpc_win32.h" -#endif #include "queue.h" #include "xmlrpc.h" #include "xmlrpc_private.h" @@ -578,7 +575,7 @@ int XMLRPC_ServerRegisterIntrospectionCallback(XMLRPC_SERVER server, XMLRPC_Intr int bSuccess = 0; if(server && cb) { - doc_method* dm = calloc(1, sizeof(doc_method)); + doc_method* dm = ecalloc(1, sizeof(doc_method)); if(dm) { dm->method = cb; diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_private.h b/ext/xmlrpc/libxmlrpc/xmlrpc_private.h index fbe7104aac..e43f78ecfb 100644 --- a/ext/xmlrpc/libxmlrpc/xmlrpc_private.h +++ b/ext/xmlrpc/libxmlrpc/xmlrpc_private.h @@ -166,7 +166,7 @@ const char* type_to_str(XMLRPC_VALUE_TYPE type, XMLRPC_VECTOR_TYPE vtype); /*---------------------------------------------------------------------------- * Macros */ -#define my_free(thing) if(thing) {free(thing); thing = 0;} +#define my_free(thing) if(thing) {efree(thing); thing = 0;} #ifdef __cplusplus diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h b/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h deleted file mode 100644 index 3e45052b0d..0000000000 --- a/ext/xmlrpc/libxmlrpc/xmlrpc_win32.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _XMLRPC_WIN32_H -#define _XMLRPC_WIN32_H -/* just some things needed to compile win32 */ -#include <windows.h> -#include <stdlib.h> -#ifndef inline -# define inline __inline -#endif -#if !defined(snprintf) && _MSC_VER < 1900 -# define snprintf _snprintf -#endif -#ifndef strcasecmp -# define strcasecmp(s1, s2) stricmp(s1, s2) -#endif - -#endif diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 368f8954ea..782a1317ec 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -701,7 +701,7 @@ PHP_FUNCTION(xmlrpc_encode_request) outBuf = XMLRPC_REQUEST_ToXML(xRequest, 0); if (outBuf) { RETVAL_STRING(outBuf); - free(outBuf); + efree(outBuf); } XMLRPC_RequestFree(xRequest, 1); } @@ -735,7 +735,7 @@ PHP_FUNCTION(xmlrpc_encode) if (xOut) { if (outBuf) { RETVAL_STRING(outBuf); - free(outBuf); + efree(outBuf); } /* cleanup */ XMLRPC_CleanupValue(xOut); @@ -1102,7 +1102,7 @@ PHP_FUNCTION(xmlrpc_server_call_method) outBuf = XMLRPC_REQUEST_ToXML(xResponse, &buf_len); if (outBuf) { RETVAL_STRINGL(outBuf, buf_len); - free(outBuf); + efree(outBuf); } /* cleanup after ourselves. what a sty! */ XMLRPC_RequestFree(xResponse, 0); |