[master] d5a8bac un-inline a couple of enum-to-string functions
Poul-Henning Kamp
phk at varnish-cache.org
Mon Jan 28 09:00:18 CET 2013
commit d5a8bac12896dbfc4dc30b61c3351d4904c0bfee
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jan 28 08:00:02 2013 +0000
un-inline a couple of enum-to-string functions
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index e75535b..cb5b24f 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -54,7 +54,6 @@
#include <sys/epoll.h>
#endif
-
#include "common/params.h"
/*--------------------------------------------------------------------*/
@@ -73,18 +72,6 @@ enum body_status {
#undef BODYSTATUS
};
-static inline const char *
-body_status(enum body_status e)
-{
- switch(e) {
-#define BODYSTATUS(U,l) case BS_##U: return (#l);
-#include "tbl/body_status.h"
-#undef BODYSTATUS
- default:
- return ("?");
- }
-}
-
/*--------------------------------------------------------------------*/
enum req_body_state_e {
@@ -102,19 +89,6 @@ enum sess_close {
#undef SESS_CLOSE
};
-static inline const char *
-sess_close_str(enum sess_close sc, int want_desc)
-{
- switch (sc) {
- case SC_NULL: return(want_desc ? "(null)": "NULL");
-#define SESS_CLOSE(nm, desc) case SC_##nm: return(want_desc ? desc : #nm);
-#include "tbl/sess_close.h"
-#undef SESS_CLOSE
-
- default: return(want_desc ? "(invalid)" : "INVALID");
- }
-}
-
/*--------------------------------------------------------------------*/
/*
@@ -129,6 +103,8 @@ enum {
#undef SLTH
};
+/*--------------------------------------------------------------------*/
+
struct SHA256Context;
struct VSC_C_lck;
struct ban;
@@ -960,6 +936,8 @@ 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 *sess_close_2str(enum sess_close sc, int want_desc);
/* cache_pipe.c */
void PipeRequest(struct req *req);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index ea110bb..c2ebbea 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -611,7 +611,7 @@ FetchBody(struct worker *wrk, void *priv)
bo->vfp = NULL;
VSLb(bo->vsl, SLT_Fetch_Body, "%u(%s) cls %d mklen %d",
- htc->body_status, body_status(htc->body_status),
+ htc->body_status, body_status_2str(htc->body_status),
cls, mklen);
http_Teardown(bo->bereq);
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 60f30f4..dd9b2d7 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -61,6 +61,35 @@ static void pan_sess(const struct sess *sp);
/*--------------------------------------------------------------------*/
+const char *
+body_status_2str(enum body_status e)
+{
+ switch(e) {
+#define BODYSTATUS(U,l) case BS_##U: return (#l);
+#include "tbl/body_status.h"
+#undef BODYSTATUS
+ default:
+ return ("?");
+ }
+}
+
+/*--------------------------------------------------------------------*/
+
+const char *
+sess_close_2str(enum sess_close sc, int want_desc)
+{
+ switch (sc) {
+ case SC_NULL: return(want_desc ? "(null)": "NULL");
+#define SESS_CLOSE(nm, desc) case SC_##nm: return(want_desc ? desc : #nm);
+#include "tbl/sess_close.h"
+#undef SESS_CLOSE
+
+ default: return(want_desc ? "(invalid)" : "INVALID");
+ }
+}
+
+/*--------------------------------------------------------------------*/
+
static void
pan_ws(const struct ws *ws, int indent)
{
@@ -216,7 +245,7 @@ pan_busyobj(const struct busyobj *bo)
if (bo->do_stream) VSB_printf(pan_vsp, " do_stream\n");
if (bo->should_close) VSB_printf(pan_vsp, " should_close\n");
VSB_printf(pan_vsp, " bodystatus = %d (%s),\n",
- bo->htc.body_status, body_status(bo->htc.body_status));
+ bo->htc.body_status, body_status_2str(bo->htc.body_status));
VSB_printf(pan_vsp, " },\n");
if (VALID_OBJ(bo->vbc, BACKEND_MAGIC))
pan_vbc(bo->vbc);
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index f7a5a39..1630007 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -327,7 +327,7 @@ SES_Delete(struct sess *sp, enum sess_close reason, double now)
b = &sp->acct_ses;
VSL(SLT_SessClose, sp->vxid, "%s %.3f %ju %ju %ju %ju %ju %ju",
- sess_close_str(sp->reason, 0), now - sp->t_open, b->req,
+ sess_close_2str(sp->reason, 0), now - sp->t_open, b->req,
b->pipe, b->pass, b->fetch, b->hdrbytes, b->bodybytes);
MPL_Free(pp->mpl_sess, sp);
More information about the varnish-commit
mailing list