[master] 8e540d38f sync VTIM_timeval/VTIM_timespec argument type with reality

Nils Goroll nils.goroll at uplex.de
Wed Apr 24 09:32:09 UTC 2019


commit 8e540d38fedf620991db8c9a936d5d2415174278
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Apr 24 07:33:56 2019 +0200

    sync VTIM_timeval/VTIM_timespec argument type with reality
    
    timevals and timespecs could represent vtim_real / vmtim_mono
    also, but for now, all use cases within varnish-cache are for vtim_dur
    
    As we typedef vtim_{real,mono,dur} to double at the moment, this should
    not break any vmods.

diff --git a/include/vtim.h b/include/vtim.h
index b1898a39d..3eab38d69 100644
--- a/include/vtim.h
+++ b/include/vtim.h
@@ -36,5 +36,5 @@ vtim_real VTIM_parse(const char *p);
 vtim_mono VTIM_mono(void);
 vtim_real VTIM_real(void);
 void VTIM_sleep(vtim_dur t);
-struct timespec VTIM_timespec(vtim_real t);
-struct timeval VTIM_timeval(vtim_real t);
+struct timespec VTIM_timespec(vtim_dur t);
+struct timeval VTIM_timeval(vtim_dur t);
diff --git a/lib/libvarnish/vtim.c b/lib/libvarnish/vtim.c
index 14b9752d6..ddc0201a6 100644
--- a/lib/libvarnish/vtim.c
+++ b/lib/libvarnish/vtim.c
@@ -414,8 +414,13 @@ VTIM_sleep(vtim_dur t)
 #endif
 }
 
+/*
+ * VTIM_timeval and VTIM_timespec may need variants with different signatures
+ * when vtim_real / vtim_mono typedefs are changed
+ */
+
 struct timeval
-VTIM_timeval(vtim_real t)
+VTIM_timeval(vtim_dur t)
 {
 	struct timeval tv;
 
@@ -426,7 +431,7 @@ VTIM_timeval(vtim_real t)
 }
 
 struct timespec
-VTIM_timespec(vtim_real t)
+VTIM_timespec(vtim_dur t)
 {
 	struct timespec tv;
 


More information about the varnish-commit mailing list