[master] 52d289f Add a stringifier for enum req_body_state_e e
Poul-Henning Kamp
phk at varnish-cache.org
Fri Jul 5 12:53:18 CEST 2013
commit 52d289ff2f41dbddb9902737e7310d01fa7e30da
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Jul 5 10:53:05 2013 +0000
Add a stringifier for enum req_body_state_e e
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 4515dd1..fbf0989 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -981,6 +981,7 @@ void MPL_Free(struct mempool *mpl, void *item);
/* cache_panic.c */
void PAN_Init(void);
const char *body_status_2str(enum body_status e);
+const char *reqbody_status_2str(enum req_body_state_e e);
const char *sess_close_2str(enum sess_close sc, int want_desc);
/* cache_pipe.c */
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 824c53a..d7ab8f8 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -76,6 +76,20 @@ body_status_2str(enum body_status e)
/*--------------------------------------------------------------------*/
const char *
+reqbody_status_2str(enum req_body_state_e e)
+{
+ switch (e) {
+#define REQ_BODY(U) case REQ_BODY_##U: return("R_BODY_" #U); break;
+#include "tbl/req_body.h"
+#undef REQ_BODY
+ default:
+ return("?");
+ }
+}
+
+/*--------------------------------------------------------------------*/
+
+const char *
sess_close_2str(enum sess_close sc, int want_desc)
{
switch (sc) {
@@ -273,7 +287,7 @@ pan_busyobj(const struct busyobj *bo)
static void
pan_req(const struct req *req)
{
- const char *stp, *body;
+ const char *stp;
VSB_printf(pan_vsp, "req = %p {\n", req);
@@ -290,17 +304,8 @@ pan_req(const struct req *req)
else
VSB_printf(pan_vsp, " step = 0x%x,\n", req->req_step);
- switch (req->req_body_status) {
-#define REQ_BODY(U) case REQ_BODY_##U: body = "R_BODY_" #U; break;
-#include "tbl/req_body.h"
-#undef REQ_BODY
- default: body = NULL;
- }
- if (body != NULL)
- VSB_printf(pan_vsp, " req_body = %s,\n", body);
- else
- VSB_printf(pan_vsp, " req_body = 0x%x,\n",
- req->req_body_status);
+ VSB_printf(pan_vsp, " req_body = %s,\n",
+ reqbody_status_2str(req->req_body_status));
if (req->err_code)
VSB_printf(pan_vsp,
More information about the varnish-commit
mailing list