Commit 80b3ecc0 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make VRT_String() return a const char *

parent c3f399ca
...@@ -638,7 +638,7 @@ struct req { ...@@ -638,7 +638,7 @@ struct req {
double t_resp; double t_resp;
struct http_conn htc[1]; struct http_conn htc[1];
char *client_identity; const char *client_identity;
/* HTTP request */ /* HTTP request */
struct http *http; struct http *http;
...@@ -1029,7 +1029,11 @@ const char *VCL_Method_Name(unsigned); ...@@ -1029,7 +1029,11 @@ const char *VCL_Method_Name(unsigned);
/* cache_vrt.c */ /* cache_vrt.c */
char *VRT_String(struct ws *ws, const char *h, const char *p, va_list ap); /*
* These prototypes go here, because we do not want to pollute vrt.h
* with va_list. VCC never generates direct calls to them.
*/
const char *VRT_String(struct ws *ws, const char *h, const char *p, va_list ap);
char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap); char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap);
void ESI_Deliver(struct req *); void ESI_Deliver(struct req *);
......
...@@ -116,11 +116,13 @@ vrt_selecthttp(const struct vrt_ctx *ctx, enum gethdr_e where) ...@@ -116,11 +116,13 @@ vrt_selecthttp(const struct vrt_ctx *ctx, enum gethdr_e where)
hp = ctx->http_obj; hp = ctx->http_obj;
break; break;
default: default:
INCOMPL(); WRONG("vrt_selecthttp 'where' invalid");
} }
return (hp); return (hp);
} }
/*--------------------------------------------------------------------*/
char * char *
VRT_GetHdr(const struct vrt_ctx *ctx, const struct gethdr_s *hs) VRT_GetHdr(const struct vrt_ctx *ctx, const struct gethdr_s *hs)
{ {
...@@ -136,7 +138,7 @@ VRT_GetHdr(const struct vrt_ctx *ctx, const struct gethdr_s *hs) ...@@ -136,7 +138,7 @@ VRT_GetHdr(const struct vrt_ctx *ctx, const struct gethdr_s *hs)
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* XXX: Optimize the single element case ? * Collapse a STRING_LIST in the space provided, or return NULL
*/ */
char * char *
...@@ -163,10 +165,10 @@ VRT_StringList(char *d, unsigned dl, const char *p, va_list ap) ...@@ -163,10 +165,10 @@ VRT_StringList(char *d, unsigned dl, const char *p, va_list ap)
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* XXX: Optimize the single element case ? * Copy and merge a STRING_LIST into a workspace.
*/ */
char * const char *
VRT_String(struct ws *ws, const char *h, const char *p, va_list ap) VRT_String(struct ws *ws, const char *h, const char *p, va_list ap)
{ {
char *b, *e; char *b, *e;
...@@ -196,14 +198,14 @@ VRT_String(struct ws *ws, const char *h, const char *p, va_list ap) ...@@ -196,14 +198,14 @@ VRT_String(struct ws *ws, const char *h, const char *p, va_list ap)
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* Build a string on the request workspace * Copy and merge a STRING_LIST on the current workspace
*/ */
const char * const char *
VRT_CollectString(const struct vrt_ctx *ctx, const char *p, ...) VRT_CollectString(const struct vrt_ctx *ctx, const char *p, ...)
{ {
va_list ap; va_list ap;
char *b; const char *b;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->ws, WS_MAGIC); CHECK_OBJ_NOTNULL(ctx->ws, WS_MAGIC);
...@@ -221,7 +223,7 @@ VRT_SetHdr(const struct vrt_ctx *ctx , const struct gethdr_s *hs, ...@@ -221,7 +223,7 @@ VRT_SetHdr(const struct vrt_ctx *ctx , const struct gethdr_s *hs,
{ {
struct http *hp; struct http *hp;
va_list ap; va_list ap;
char *b; const char *b;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(hs); AN(hs);
......
...@@ -50,7 +50,7 @@ static void ...@@ -50,7 +50,7 @@ static void
vrt_do_string(const struct http *hp, int fld, vrt_do_string(const struct http *hp, int fld,
const char *err, const char *p, va_list ap) const char *err, const char *p, va_list ap)
{ {
char *b; const char *b;
AN(hp); AN(hp);
b = VRT_String(hp->ws, NULL, p, ap); b = VRT_String(hp->ws, NULL, p, ap);
...@@ -165,7 +165,7 @@ void ...@@ -165,7 +165,7 @@ void
VRT_l_client_identity(const struct vrt_ctx *ctx, const char *str, ...) VRT_l_client_identity(const struct vrt_ctx *ctx, const char *str, ...)
{ {
va_list ap; va_list ap;
char *b; const char *b;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
...@@ -248,7 +248,7 @@ void ...@@ -248,7 +248,7 @@ void
VRT_l_beresp_storage(const struct vrt_ctx *ctx, const char *str, ...) VRT_l_beresp_storage(const struct vrt_ctx *ctx, const char *str, ...)
{ {
va_list ap; va_list ap;
char *b; const char *b;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
......
...@@ -260,5 +260,4 @@ char *VRT_REAL_string(const struct vrt_ctx *, double); ...@@ -260,5 +260,4 @@ char *VRT_REAL_string(const struct vrt_ctx *, double);
char *VRT_TIME_string(const struct vrt_ctx *, double); char *VRT_TIME_string(const struct vrt_ctx *, double);
const char *VRT_BOOL_string(unsigned); const char *VRT_BOOL_string(unsigned);
const char *VRT_BACKEND_string(const struct director *d); const char *VRT_BACKEND_string(const struct director *d);
const char *VRT_CollectString(const struct vrt_ctx *, const char *p, ...); const char *VRT_CollectString(const struct vrt_ctx *, const char *p, ...);
...@@ -39,7 +39,7 @@ VCL_VOID __match_proto__(td_debug_panic) ...@@ -39,7 +39,7 @@ VCL_VOID __match_proto__(td_debug_panic)
vmod_panic(const struct vrt_ctx *ctx, const char *str, ...) vmod_panic(const struct vrt_ctx *ctx, const char *str, ...)
{ {
va_list ap; va_list ap;
char *b; const char *b;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
va_start(ap, str); va_start(ap, str);
......
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