aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-08-12 03:00:24 +0000
committerYang Tse <yangsita@gmail.com>2008-08-12 03:00:24 +0000
commit60a3773c50671079709f7711180358cb97476344 (patch)
tree503a90a15e4f352ee847a283c02619f10a2e75f7
parente8e8177e9d7ac270c630b8e1e4041d08a2cc7fe2 (diff)
Added macros for minimum-width signed and unsigned curl_off_t integer
constants CURL_OFF_T_C and CURL_OFF_TU_C. The clever double helper macro used internally to provide its functionality is thanks to Lars Nilsson.
-rw-r--r--CHANGES4
-rw-r--r--RELEASE-NOTES2
-rw-r--r--include/curl/curl.h17
-rw-r--r--include/curl/curlrules.h53
4 files changed, 58 insertions, 18 deletions
diff --git a/CHANGES b/CHANGES
index 755c79d2f..ed925e80c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
Changelog
+Yang Tse (12 Aug 2008)
+- Added macros for minimum-width signed and unsigned curl_off_t integer
+ constants CURL_OFF_T_C and CURL_OFF_TU_C. The clever double helper macro
+ used internally to provide its functionality is thanks to Lars Nilsson.
Daniel Fandrich (11 Aug 2008)
- Fixed a boundary condition error in ftp_readresp() whereby a non-terminal
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index b5ade6f3c..8d12c7d5d 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -72,7 +72,7 @@ advice from friends like these:
Phil Pellouchoud, Eduard Bloch, John Lightsey, Stephen Collyer, Tor Arntsen,
Rolland Dudemaine, Phil Blundell, Scott Barrett, Andreas Schuldei,
Peter Lamberg, David Bau, Pramod Sharma, Yehoshua Hershberg,
- Constantine Sapuntzakis
+ Constantine Sapuntzakis, Lars Nilsson
Thanks! (and sorry if I forgot to mention someone)
diff --git a/include/curl/curl.h b/include/curl/curl.h
index 9dd54ff69..0aaad88fa 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -548,23 +548,6 @@ typedef enum {
#ifdef CINIT
#undef CINIT
#endif
-/*
- * Figure out if we can use the ## operator, which is supported by ISO/ANSI C
- * and C++. Some compilers support it without setting __STDC__ or __cplusplus
- * so we need to carefully check for them too. We don't use configure-checks
- * for these since we want these headers to remain generic and working for all
- * platforms.
- */
-#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
- defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
- defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
- defined(__ILEC400__)
- /* This compiler is believed to have an ISO compatible preprocessor */
-#define CURL_ISOCPP
-#else
- /* This compiler is believed NOT to have an ISO compatible preprocessor */
-#undef CURL_ISOCPP
-#endif
#ifdef CURL_ISOCPP
#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
diff --git a/include/curl/curlrules.h b/include/curl/curlrules.h
index 56499f9a2..cda33b21b 100644
--- a/include/curl/curlrules.h
+++ b/include/curl/curlrules.h
@@ -101,6 +101,16 @@
Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
#endif
+#ifndef CURL_SUFFIX_CURL_OFF_T
+# error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
+ Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing
+#endif
+
+#ifndef CURL_SUFFIX_CURL_OFF_TU
+# error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
+ Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing
+#endif
+
/*
* Macros private to this header file.
*/
@@ -129,6 +139,49 @@ typedef char
__curl_rule_02__
[CurlchkszGE(curl_off_t, long)];
+/* ================================================================ */
+/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */
+/* ================================================================ */
+
+/*
+ * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
+ * these to be visible and exported by the external libcurl interface API,
+ * while also making them visible to the library internals, simply including
+ * setup.h, without actually needing to include curl.h internally.
+ * If some day this section would grow big enough, all this should be moved
+ * to its own header file.
+ */
+
+/*
+ * Figure out if we can use the ## preprocessor operator, which is supported
+ * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
+ * or __cplusplus so we need to carefully check for them too.
+ */
+
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
+ defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
+ defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
+ defined(__ILEC400__)
+ /* This compiler is believed to have an ISO compatible preprocessor */
+#define CURL_ISOCPP
+#else
+ /* This compiler is believed NOT to have an ISO compatible preprocessor */
+#undef CURL_ISOCPP
+#endif
+
+/*
+ * Macros for minimum-width signed and unsigned curl_off_t integer constants.
+ */
+
+#ifdef CURL_ISOCPP
+# define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val ## Suffix
+#else
+# define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val/**/Suffix
+#endif
+#define __CURL_OFF_T_C_HELPER1(Val,Suffix) __CURL_OFF_T_C_HELPER2(Val,Suffix)
+#define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_T)
+#define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_TU)
+
/*
* Get rid of macros private to this header file.
*/