Clean up func_curl a bit.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75586 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Joshua Colp 18 years ago
parent 5ac24b25d3
commit 0772f62be7

@ -60,14 +60,12 @@ struct MemoryStruct {
size_t size;
};
/* There might be a realloc() out there that doesn't like reallocing
* NULL pointers, so we take care of it here
*/
static void *myrealloc(void *ptr, size_t size)
{
/* There might be a realloc() out there that doesn't like reallocing
NULL pointers, so we take care of it here */
if (ptr)
return ast_realloc(ptr, size);
else
return ast_malloc(size);
return (ptr ? ast_realloc(ptr, size) : ast_malloc(size));
}
static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
@ -75,12 +73,12 @@ static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *da
register int realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)data;
mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1);
if (mem->memory) {
if ((mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1))) {
memcpy(&(mem->memory[mem->size]), ptr, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
}
return realsize;
}

Loading…
Cancel
Save