]> granicus.if.org Git - curl/commitdiff
typecheck: allow NULL to unset CURLOPT_ERRORBUFFER
authorDave Reisner <d@falconindy.com>
Tue, 11 Oct 2011 01:24:40 +0000 (03:24 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 15 Oct 2011 21:59:22 +0000 (23:59 +0200)
There might be situations where a user would want to unset this option.
Avoid forcing him/her to cast the NULL argument to (char *) in order to
get past the compile time typecheck.

include/curl/typecheck-gcc.h

index 4e00ca9a45923b322a3ff6f966380d47aff5c295..5c584b00272ad157573aa6c7842a0d1ea41b366e 100644 (file)
@@ -392,7 +392,8 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
 /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
 /* XXX: also check size of an char[] array? */
 #define _curl_is_error_buffer(expr)                                           \
-  (__builtin_types_compatible_p(__typeof__(expr), char *) ||                  \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), char *) ||                  \
    __builtin_types_compatible_p(__typeof__(expr), char[]))
 
 /* evaluates to true if expr is of type (const) void* or (const) FILE* */