Using TimeUnit()

Kristian Lyngstol kristian at varnish-software.com
Mon Apr 12 14:45:08 CEST 2010


In the DNS director I need to be able to set a TTL for caching dns. Since
this is set when the director is parsed, it's not relative to anything. For
this, I've used TimeUnit(), which does exactly what I need. However, as
that's a static function I either need to wrap it, rename it or find some
better alternative.

Am I missing something obvious here? I'm assuming I am since I'm not very
friendly with the VCC.

I'm attaching the "patch" (if you can call it that) that I use in the dns
director right now, which does the trick (I added the prototype in the
relevant .c-files temporarily):

diff --git a/varnish-cache/lib/libvcl/vcc_parse.c b/varnish-cache/lib/libvcl/vcc_parse.c
index 36fec17..7e669b8 100644
--- a/varnish-cache/lib/libvcl/vcc_parse.c
+++ b/varnish-cache/lib/libvcl/vcc_parse.c
@@ -63,7 +63,7 @@ static void Cond_0(struct tokenlist *tl);
  * Recognize and convert units of time, return seconds.
  */
 
-static double
+double
 TimeUnit(struct tokenlist *tl)
 {
        double sc = 1.0;


-- 
Kristian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20100412/4b26f0c8/attachment-0003.pgp>


More information about the varnish-dev mailing list