From 9d35c2026242697ae7ebf9669bb46c9a4b6380c7 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 21 Dec 2008 10:46:34 +0000 Subject: [PATCH] Add a VCC_Return_Name() function to convert a return action to a string. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3478 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/include/libvcl.h | 2 +- varnish-cache/lib/libvcl/vcc_compile.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/varnish-cache/include/libvcl.h b/varnish-cache/include/libvcl.h index f8c7c3f8..575b0ae7 100644 --- a/varnish-cache/include/libvcl.h +++ b/varnish-cache/include/libvcl.h @@ -31,5 +31,5 @@ char *VCC_Compile(struct vsb *sb, const char *b, const char *e); void VCC_InitCompile(const char *default_vcl); - +const char *VCC_Return_Name(unsigned action); diff --git a/varnish-cache/lib/libvcl/vcc_compile.c b/varnish-cache/lib/libvcl/vcc_compile.c index 625ec44c..5a8aceba 100644 --- a/varnish-cache/lib/libvcl/vcc_compile.c +++ b/varnish-cache/lib/libvcl/vcc_compile.c @@ -662,6 +662,23 @@ VCC_Compile(struct vsb *sb, const char *b, const char *e) return (r); } +/*--------------------------------------------------------------------*/ + +const char * +VCC_Return_Name(unsigned method) +{ + + switch (method) { + case 0: return (""); +#define VCL_RET_MAC(l, u, b, i) case b: return(#u); +#define VCL_RET_MAC_E(l, u, b, i) case b: return(#u); +#include "vcl_returns.h" +#undef VCL_RET_MAC_E +#undef VCL_RET_MAC + } + return (NULL); +} + /*-------------------------------------------------------------------- * Initialize the compiler and register the default VCL code for later * compilation runs. -- 2.39.5