]> granicus.if.org Git - curl/commitdiff
Curl_gmtime: avoid future mistakes
authorDaniel Stenberg <daniel@haxx.se>
Mon, 7 Feb 2011 14:09:24 +0000 (15:09 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 7 Feb 2011 14:09:24 +0000 (15:09 +0100)
Document Curl_gmtime() and define away the old functions so that they
won't be used internally again by mistake.

lib/parsedate.c
lib/setup_once.h

index ea1f36e7380563f99fd460734ebbe720c76f3e4f..1d7f035f2a7177c343bdeceec80a00b302b1225e 100644 (file)
@@ -515,6 +515,15 @@ time_t curl_getdate(const char *p, const time_t *now)
   return -1;
 }
 
+/*
+ * Curl_gmtime() is a gmtime() replacement for portability. Do not use the
+ * gmtime_r() or gmtime() functions anywhere else but here.
+ *
+ * To make sure no such function calls slip in, we define them to cause build
+ * errors, which is why we use the name within parentheses in this function.
+ *
+ */
+
 CURLcode Curl_gmtime(time_t intime, struct tm *store)
 {
   const struct tm *tm;
index 85e78e8d81d3f6ef0bb54d1f9fed382f6ae06b23..e817b6dea8eaaa85e14f4948eb04e18895733bee 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -488,6 +488,8 @@ typedef int sig_atomic_t;
 
 #define ZERO_NULL 0
 
+#define gmtime(x) do_not_use_gmtime_use_Curl_gmtime()
+#define gmtime_r(x,y) do_not_use_gmtime_r_use_Curl_gmtime()
 
 #endif /* __SETUP_ONCE_H */