]> granicus.if.org Git - curl/commitdiff
- Added a macro for curl_easy_setopt() that accepts three arguments and simply
authorDaniel Stenberg <daniel@haxx.se>
Tue, 11 Mar 2008 13:14:16 +0000 (13:14 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 11 Mar 2008 13:14:16 +0000 (13:14 +0000)
  does nothing with them, just to make sure libcurl users always use three
  arguments to this function. Due to its use of ... for the third argument, it
  is otherwise hard to detect abuse.

CHANGES
RELEASE-NOTES
include/curl/curl.h

diff --git a/CHANGES b/CHANGES
index b891e2118b41d624464c3f4e64f6c1ad90c1f226..cd041504d830a557938e424f90751755d0b52bc6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,12 @@
 
                                   Changelog
 
+Daniel Stenberg (11 Mar 2008)
+- Added a macro for curl_easy_setopt() that accepts three arguments and simply
+  does nothing with them, just to make sure libcurl users always use three
+  arguments to this function. Due to its use of ... for the third argument, it
+  is otherwise hard to detect abuse.
+
 Michal Marek (11 Mar 2008)
 - Added a type checking macro for curl_easy_setopt(), needs gcc-4.3 and only
   works in C mode atm (http://curl.haxx.se/mail/lib-2008-02/0267.html ,
index c491d18b373db92c2170a698edb59470973f522c..0c20a07017c0d9b95750c626ce943a6b297001cb 100644 (file)
@@ -20,6 +20,7 @@ This release includes the following changes:
  o added a type checking macro for curl_easy_setopt(), watch out for new
    warnings in code using libcurl (needs gcc-4.3 and currently only works
    in C mode)
+ o curl_easy_setopt() uses are now checked to use three arguments
 
 This release includes the following bugfixes:
 
index 3027ca06d3867923e0b455963fb2b1941aff09cf..4af714291a84654554d7239994e04532b4d38785 100644 (file)
@@ -1792,8 +1792,16 @@ CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
 #include "multi.h"
 
 /* the typechecker doesn't work in C++ (yet) */
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && !defined(__cplusplus)
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
+    !defined(__cplusplus)
 #include "typecheck-gcc.h"
+#else
+#if defined(__STDC__) && (__STDC__ >= 1) 
+/* This preprocessor magic that replaces a call with the exact same call is
+   only done to make sure application authors use exactly three arguments
+   to this function. */
+#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
+#endif /* __STDC__ >= 1 */
 #endif /* gcc >= 4.3 && !__cplusplus */
 
 #endif /* __CURL_CURL_H */