[master] 40a253b Simplify

Poul-Henning Kamp phk at FreeBSD.org
Fri May 26 23:43:05 CEST 2017


commit 40a253bd2f7275d17e0b014c2f9cc3c310b7a2d3
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri May 26 21:28:39 2017 +0000

    Simplify

diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index d9caf37..3528633 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -100,25 +100,27 @@ struct vsc {
 	struct VSM_fantom	iter_fantom;
 };
 
-/**********************************************************************
- * Precompiled VSC_type_desc's and VSC_desc's for all know VSCs.
+/*--------------------------------------------------------------------
+ * Build the static level, type and point descriptions
  */
 
-#define VSC_LEVEL_F(v,l,e,d) \
-	extern const struct VSC_level_desc VSC_level_desc_##v;
+#define VSC_LEVEL_F(v,l,e,d)			\
+	const struct VSC_level_desc VSC_level_desc_##v = \
+		{VSC_level_##v, l, e, d};
 #include "tbl/vsc_levels.h"
 #undef VSC_LEVEL_F
 
-#define VSC_TYPE_F(n,t,l,e,d) \
-	extern const struct VSC_type_desc VSC_type_desc_##n;
+#define VSC_TYPE_F(n,t,l,e,d)	const char *VSC_type_##n = t;
 #include "tbl/vsc_types.h"
-#undef VSC_TYPE_F
 
-#define VSC_DO(U,l,t,h) extern const struct VSC_desc VSC_desc_##l[];
-#define VSC_F(n,t,l,s,f,v,d,e)
-#define VSC_DONE(U,l,t)
-#include "tbl/vsc_all.h"
+#define VSC_TYPE_F(n,t,l,e,d)			\
+	const struct VSC_type_desc VSC_type_desc_##n = {l,e,d};
+#include "tbl/vsc_types.h"
 
+#define VSC_DO(U,l,t,h)		const struct VSC_desc VSC_desc_##l[] = {
+#define VSC_F(n,t,l,s,f,v,d,e)		{#n,#t,s,f,&VSC_level_desc_##v,d,e},
+#define VSC_DONE(U,l,t)		};
+#include "tbl/vsc_all.h"
 
 /*--------------------------------------------------------------------*/
 
@@ -496,24 +498,3 @@ VSC_LevelDesc(unsigned level)
 	}
 }
 
-/*--------------------------------------------------------------------
- * Build the static level, type and point descriptions
- */
-
-#define VSC_LEVEL_F(v,l,e,d)			\
-	const struct VSC_level_desc VSC_level_desc_##v = \
-		{VSC_level_##v, l, e, d};
-#include "tbl/vsc_levels.h"
-#undef VSC_LEVEL_F
-
-#define VSC_TYPE_F(n,t,l,e,d)	const char *VSC_type_##n = t;
-#include "tbl/vsc_types.h"
-
-#define VSC_TYPE_F(n,t,l,e,d)			\
-	const struct VSC_type_desc VSC_type_desc_##n = {l,e,d};
-#include "tbl/vsc_types.h"
-
-#define VSC_DO(U,l,t,h)		const struct VSC_desc VSC_desc_##l[] = {
-#define VSC_F(n,t,l,s,f,v,d,e)		{#n,#t,s,f,&VSC_level_desc_##v,d,e},
-#define VSC_DONE(U,l,t)		};
-#include "tbl/vsc_all.h"



More information about the varnish-commit mailing list