From: phk Date: Fri, 10 Aug 2007 10:28:08 +0000 (+0000) Subject: Don't call functions outside the VRT namespace, even if this means X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b2c95f78cdd6bd084238938ad27b30979767f41;p=varnish Don't call functions outside the VRT namespace, even if this means that we have to wrap strcmp(). git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1830 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index f3bdaed3..ca3ee0f6 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -501,6 +501,17 @@ VRT_purge(const char *regexp, int hash) AddBan(regexp, hash); } +/*-------------------------------------------------------------------- + * Simple stuff + */ + +int +VRT_strcmp(const char *s1, const char *s2) +{ + return (strcmp(s1, s2)); +} + + /*-------------------------------------------------------------------- * Backend stuff, should probably move to its own file eventually */ diff --git a/varnish-cache/include/vrt.h b/varnish-cache/include/vrt.h index d0049a43..2e3f8769 100644 --- a/varnish-cache/include/vrt.h +++ b/varnish-cache/include/vrt.h @@ -88,6 +88,10 @@ char *VRT_GetHdr(struct sess *, enum gethdr_e where, const char *); void VRT_SetHdr(struct sess *, enum gethdr_e where, const char *, const char *, ...); void VRT_handling(struct sess *sp, unsigned hand); +/* Simple stuff */ +int VRT_strcmp(const char *s1, const char *s2); + + /* Backend related */ void VRT_init_simple_backend(struct backend **, struct vrt_simple_backend *); void VRT_fini_backend(struct backend *); diff --git a/varnish-cache/lib/libvcl/vcc_fixed_token.c b/varnish-cache/lib/libvcl/vcc_fixed_token.c index bbf44f2d..992116d1 100644 --- a/varnish-cache/lib/libvcl/vcc_fixed_token.c +++ b/varnish-cache/lib/libvcl/vcc_fixed_token.c @@ -446,6 +446,10 @@ vcl_output_lang_h(struct vsb *sb) vsb_cat(sb, "void VRT_SetHdr(struct sess *, enum gethdr_e where, const char *, const char *, ...);\n"); vsb_cat(sb, "void VRT_handling(struct sess *sp, unsigned hand);\n"); vsb_cat(sb, "\n"); + vsb_cat(sb, "/* Simple stuff */\n"); + vsb_cat(sb, "int VRT_strcmp(const char *s1, const char *s2);\n"); + vsb_cat(sb, "\n"); + vsb_cat(sb, "\n"); vsb_cat(sb, "/* Backend related */\n"); vsb_cat(sb, "void VRT_init_simple_backend(struct backend **, struct vrt_simple_backend *);\n"); vsb_cat(sb, "void VRT_fini_backend(struct backend *);\n"); diff --git a/varnish-cache/lib/libvcl/vcc_parse.c b/varnish-cache/lib/libvcl/vcc_parse.c index 189b3001..bf5d7269 100644 --- a/varnish-cache/lib/libvcl/vcc_parse.c +++ b/varnish-cache/lib/libvcl/vcc_parse.c @@ -232,7 +232,7 @@ Cond_String(const struct var *vp, struct tokenlist *tl) break; case T_EQ: case T_NEQ: - Fb(tl, 1, "%sstrcmp(%s, ", + Fb(tl, 1, "%sVRT_strcmp(%s, ", tl->t->tok == T_EQ ? "!" : "", vp->rname); vcc_NextToken(tl); ExpectErr(tl, CSTR);