Commit bae18246 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add conversion from BOOL to STRING



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5422 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent b3c8e86f
...@@ -355,6 +355,14 @@ VRT_backend_string(struct sess *sp, const struct director *d) ...@@ -355,6 +355,14 @@ VRT_backend_string(struct sess *sp, const struct director *d)
return (d->vcl_name); return (d->vcl_name);
} }
const char *
VRT_bool_string(const struct sess *sp, unsigned val)
{
(void)sp;
return (val ? "true" : "false");
}
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
void void
......
...@@ -213,6 +213,7 @@ char *VRT_IP_string(const struct sess *sp, const struct sockaddr_storage *sa); ...@@ -213,6 +213,7 @@ char *VRT_IP_string(const struct sess *sp, const struct sockaddr_storage *sa);
char *VRT_int_string(const struct sess *sp, int); char *VRT_int_string(const struct sess *sp, int);
char *VRT_double_string(const struct sess *sp, double); char *VRT_double_string(const struct sess *sp, double);
char *VRT_time_string(const struct sess *sp, double); char *VRT_time_string(const struct sess *sp, double);
const char *VRT_bool_string(const struct sess *sp, unsigned);
const char *VRT_backend_string(struct sess *sp, const struct director *d); const char *VRT_backend_string(struct sess *sp, const struct director *d);
#define VRT_done(sp, hand) \ #define VRT_done(sp, hand) \
......
...@@ -359,12 +359,12 @@ vcc_expr_tostring(struct expr **e, enum var_type fmt) ...@@ -359,12 +359,12 @@ vcc_expr_tostring(struct expr **e, enum var_type fmt)
p = NULL; p = NULL;
switch((*e)->fmt) { switch((*e)->fmt) {
case BACKEND: p = "VRT_backend_string(sp, \v1)"; break; case BACKEND: p = "VRT_backend_string(sp, \v1)"; break;
case BOOL: p = "VRT_bool_string(sp, \v1)"; break;
case DURATION: p = "VRT_double_string(sp, \v1)"; break; /* XXX: should have "s" suffix ? */
case INT: p = "VRT_int_string(sp, \v1)"; break; case INT: p = "VRT_int_string(sp, \v1)"; break;
case IP: p = "VRT_IP_string(sp, \v1)"; break; case IP: p = "VRT_IP_string(sp, \v1)"; break;
case TIME: p = "VRT_time_string(sp, \v1)"; break;
case REAL: p = "VRT_double_string(sp, \v1)"; break; case REAL: p = "VRT_double_string(sp, \v1)"; break;
case DURATION: p = "VRT_double_string(sp, \v1)"; break; case TIME: p = "VRT_time_string(sp, \v1)"; break;
/* XXX: should have "s" suffix ? */
default: break; default: break;
} }
if (p != NULL) if (p != NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment