mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
Clean up func_curl a bit.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75586 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user