From 119f43360b60c903982104944145d9cd8b7ec054 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sun, 25 Sep 2011 18:53:29 +0200 Subject: allow write callbacks to indicate OOM to libcurl Allow (*curl_write_callback) write callbacks to return CURL_WRITEFUNC_OUT_OF_MEMORY to properly indicate libcurl of OOM conditions inside the callback itself. --- include/curl/curl.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/curl/curl.h b/include/curl/curl.h index ef6bda8f3..4f0182616 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -187,10 +187,15 @@ typedef int (*curl_progress_callback)(void *clientp, #define CURL_MAX_HTTP_HEADER (100*1024) #endif - /* This is a magic return code for the write callback that, when returned, will signal libcurl to pause receiving on the current transfer. */ #define CURL_WRITEFUNC_PAUSE 0x10000001 + +/* If the write callback itself allocates memory dynamically and this fails + due to an out of memory condition, returning CURL_WRITEFUNC_OUT_OF_MEMORY + is the proper way to tell libcurl of this condition. */ +#define CURL_WRITEFUNC_OUT_OF_MEMORY 0x10000002 + typedef size_t (*curl_write_callback)(char *buffer, size_t size, size_t nitems, -- cgit v1.2.3