[master] 144840a Introduce typedef vcc_type_t

Poul-Henning Kamp phk at FreeBSD.org
Wed Jun 8 20:59:06 CEST 2016


commit 144840a65a9e78da52adcae3f5e5b913a39ae600
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jun 8 07:01:44 2016 +0000

    Introduce typedef vcc_type_t

diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c
index 467f5d2..67daa80 100644
--- a/lib/libvcc/vcc_action.c
+++ b/lib/libvcc/vcc_action.c
@@ -54,9 +54,9 @@ parse_call(struct vcc *tl)
 /*--------------------------------------------------------------------*/
 
 static const struct arith {
-	enum var_type		type;
+	vcc_type_t		type;
 	unsigned		oper;
-	enum var_type		want;
+	vcc_type_t		want;
 } arith[] = {
 	{ INT,		T_INCR,		INT },
 	{ INT,		T_DECR,		INT },
@@ -84,7 +84,7 @@ parse_set(struct vcc *tl)
 {
 	const struct symbol *sym;
 	const struct arith *ap;
-	enum var_type fmt;
+	vcc_type_t fmt;
 
 	vcc_NextToken(tl);
 	ExpectErr(tl, ID);
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index 9999230..ea626a8 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -74,6 +74,8 @@ enum var_type {
 #undef VCC_TYPE
 };
 
+typedef enum var_type vcc_type_t;
+
 struct source {
 	VTAILQ_ENTRY(source)	list;
 	char			*name;
@@ -100,7 +102,7 @@ enum symkind {
 };
 
 typedef void sym_expr_t(struct vcc *tl, struct expr **,
-    const struct symbol *sym, enum var_type);
+    const struct symbol *sym, vcc_type_t);
 typedef void sym_wildcard_t(struct vcc *, struct symbol *,
     const char *, const char *);
 
@@ -120,7 +122,7 @@ struct symbol {
 
 	const struct token		*def_b, *def_e;
 
-	enum var_type			fmt;
+	vcc_type_t			fmt;
 
 	sym_expr_t			*eval;
 	void				*eval_priv;
@@ -207,7 +209,7 @@ struct vcc {
 
 struct var {
 	const char		*name;
-	enum var_type		fmt;
+	vcc_type_t		fmt;
 	const char		*rname;
 	unsigned		r_methods;
 	const char		*lname;
@@ -267,7 +269,7 @@ char *TlDupTok(struct vcc *tl, const struct token *tok);
 double vcc_DoubleVal(struct vcc *tl);
 void vcc_Duration(struct vcc *tl, double *);
 unsigned vcc_UintVal(struct vcc *tl);
-void vcc_Expr(struct vcc *tl, enum var_type typ);
+void vcc_Expr(struct vcc *tl, vcc_type_t typ);
 void vcc_Expr_Call(struct vcc *tl, const struct symbol *sym);
 void vcc_Expr_Init(struct vcc *tl);
 sym_expr_t vcc_Eval_Var;
@@ -275,10 +277,10 @@ sym_expr_t vcc_Eval_Handle;
 sym_expr_t vcc_Eval_SymFunc;
 void vcc_Eval_Func(struct vcc *tl, const char *cfunc, const char *extra,
     const char *name, const char *args, const char *vmod);
-enum var_type VCC_arg_type(const char **p);
-enum symkind VCC_HandleKind(enum var_type fmt);
+vcc_type_t VCC_arg_type(const char **p);
+enum symkind VCC_HandleKind(vcc_type_t fmt);
 struct symbol *VCC_HandleSymbol(struct vcc *, const struct token *,
-    enum var_type fmt, const char *str, ...);
+    vcc_type_t fmt, const char *str, ...);
 
 /* vcc_obj.c */
 extern const struct var vcc_vars[];
@@ -304,7 +306,7 @@ struct symbol *VCC_Symbol(struct vcc *, struct symbol *,
 const char * VCC_SymKind(struct vcc *tl, const struct symbol *s);
 typedef void symwalk_f(struct vcc *tl, const struct symbol *s);
 void VCC_WalkSymbols(struct vcc *tl, symwalk_f *func, enum symkind kind);
-void VCC_GlobalSymbol(struct symbol *, enum var_type, const char *str, ...);
+void VCC_GlobalSymbol(struct symbol *, vcc_type_t, const char *str, ...);
 
 /* vcc_token.c */
 void vcc_Coord(const struct vcc *tl, struct vsb *vsb,
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 4f8cfe2..5e86895 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -40,7 +40,7 @@
 #include "vcc_compile.h"
 
 static const char *
-vcc_Type(enum var_type fmt)
+vcc_Type(vcc_type_t fmt)
 {
 	switch(fmt) {
 #define VCC_TYPE(a)	case a: return(#a);
@@ -214,7 +214,7 @@ vcc_ByteVal(struct vcc *tl, double *d)
 struct expr {
 	unsigned	magic;
 #define EXPR_MAGIC	0x38c794ab
-	enum var_type	fmt;
+	vcc_type_t	fmt;
 	struct vsb	*vsb;
 	uint8_t		constant;
 #define EXPR_VAR	(1<<0)
@@ -230,7 +230,7 @@ vcc_isconst(const struct expr *e)
 	return (e->constant & EXPR_CONST);
 }
 
-static void vcc_expr0(struct vcc *tl, struct expr **e, enum var_type fmt);
+static void vcc_expr0(struct vcc *tl, struct expr **e, vcc_type_t fmt);
 
 static struct expr *
 vcc_new_expr(void)
@@ -247,11 +247,11 @@ vcc_new_expr(void)
 }
 
 static struct expr *
-vcc_mk_expr(enum var_type fmt, const char *str, ...)
+vcc_mk_expr(vcc_type_t fmt, const char *str, ...)
     __v_printflike(2, 3);
 
 static struct expr *
-vcc_mk_expr(enum var_type fmt, const char *str, ...)
+vcc_mk_expr(vcc_type_t fmt, const char *str, ...)
 {
 	va_list ap;
 	struct expr *e;
@@ -296,7 +296,7 @@ vcc_delete_expr(struct expr *e)
  */
 
 static struct expr *
-vcc_expr_edit(enum var_type fmt, const char *p, struct expr *e1,
+vcc_expr_edit(vcc_type_t fmt, const char *p, struct expr *e1,
     struct expr *e2)
 {
 	struct expr *e;
@@ -381,7 +381,7 @@ vcc_expr_fmt(struct vsb *d, int ind, const struct expr *e1)
 /*--------------------------------------------------------------------
  */
 
-enum var_type
+vcc_type_t
 VCC_arg_type(const char **p)
 {
 
@@ -395,7 +395,7 @@ VCC_arg_type(const char **p)
  */
 
 static void
-vcc_expr_tostring(struct vcc *tl, struct expr **e, enum var_type fmt)
+vcc_expr_tostring(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 {
 	const char *p;
 	uint8_t	constant = EXPR_VAR;
@@ -448,7 +448,7 @@ vcc_expr_tostring(struct vcc *tl, struct expr **e, enum var_type fmt)
 
 static void __match_proto__(sym_expr_t)
 vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym,
-    enum var_type fmt)
+    vcc_type_t fmt)
 {
 	struct expr *e2;
 	int all = sym->eval_priv == NULL ? 0 : 1;
@@ -485,7 +485,7 @@ vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym,
 
 static void __match_proto__(sym_expr_t)
 vcc_Eval_BoolConst(struct vcc *tl, struct expr **e, const struct symbol *sym,
-    enum var_type fmt)
+    vcc_type_t fmt)
 {
 
 	(void)fmt;
@@ -499,7 +499,7 @@ vcc_Eval_BoolConst(struct vcc *tl, struct expr **e, const struct symbol *sym,
 
 void __match_proto__(sym_expr_t)
 vcc_Eval_Handle(struct vcc *tl, struct expr **e, const struct symbol *sym,
-    enum var_type fmt)
+    vcc_type_t fmt)
 {
 
 	assert(sym->kind == sym->kind);
@@ -522,7 +522,7 @@ vcc_Eval_Handle(struct vcc *tl, struct expr **e, const struct symbol *sym,
 
 void __match_proto__(sym_expr_t)
 vcc_Eval_Var(struct vcc *tl, struct expr **e, const struct symbol *sym,
-    enum var_type fmt)
+    vcc_type_t fmt)
 {
 
 	(void)fmt;
@@ -565,7 +565,7 @@ vcc_priv_arg(struct vcc *tl, const char *p, const char *name, const char *vmod)
 }
 
 struct func_arg {
-	enum var_type		type;
+	vcc_type_t		type;
 	const char		*enum_bits;
 	const char		*name;
 	const char		*val;
@@ -629,7 +629,7 @@ vcc_func(struct vcc *tl, struct expr **e, const char *cfunc,
 	const char *p;
 	struct expr *e1;
 	struct func_arg *fa, *fa2;
-	enum var_type rfmt;
+	vcc_type_t rfmt;
 	VTAILQ_HEAD(,func_arg) head;
 	struct token *t1;
 
@@ -763,7 +763,7 @@ vcc_Eval_Func(struct vcc *tl, const char *cfunc,
 
 void __match_proto__(sym_expr_t)
 vcc_Eval_SymFunc(struct vcc *tl, struct expr **e, const struct symbol *sym,
-    enum var_type fmt)
+    vcc_type_t fmt)
 {
 
 	(void)fmt;
@@ -787,7 +787,7 @@ vcc_Eval_SymFunc(struct vcc *tl, struct expr **e, const struct symbol *sym,
  */
 
 static void
-vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
+vcc_expr4(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 {
 	struct expr *e1, *e2;
 	const char *ip;
@@ -927,10 +927,10 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
  */
 
 static void
-vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt)
+vcc_expr_mul(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 {
 	struct expr *e2;
-	enum var_type f2, f3;
+	vcc_type_t f2, f3;
 	struct token *tk;
 
 	*e = NULL;
@@ -979,7 +979,7 @@ vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt)
 static void
 vcc_expr_string_add(struct vcc *tl, struct expr **e, struct expr *e2)
 {
-	enum var_type f2;
+	vcc_type_t f2;
 
 	AN(e);
 	AN(*e);
@@ -1023,10 +1023,10 @@ vcc_expr_string_add(struct vcc *tl, struct expr **e, struct expr *e2)
 }
 
 static void
-vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
+vcc_expr_add(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 {
 	struct expr  *e2;
-	enum var_type f2;
+	vcc_type_t f2;
 	struct token *tk;
 
 	*e = NULL;
@@ -1085,7 +1085,7 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
  */
 
 static void
-vcc_expr_strfold(struct vcc *tl, struct expr **e, enum var_type fmt)
+vcc_expr_strfold(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 {
 
 	vcc_expr_add(tl, e, fmt);
@@ -1119,7 +1119,7 @@ vcc_expr_strfold(struct vcc *tl, struct expr **e, enum var_type fmt)
 	{typ,		'>',	"(\v1 > \v2)" }
 
 static const struct cmps {
-	enum var_type		fmt;
+	vcc_type_t		fmt;
 	unsigned		token;
 	const char		*emit;
 } vcc_cmps[] = {
@@ -1138,7 +1138,7 @@ static const struct cmps {
 #undef NUM_REL
 
 static void
-vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
+vcc_expr_cmp(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 {
 	struct expr *e2;
 	const struct cmps *cp;
@@ -1243,7 +1243,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
  */
 
 static void
-vcc_expr_not(struct vcc *tl, struct expr **e, enum var_type fmt)
+vcc_expr_not(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 {
 	struct expr *e2;
 	struct token *tk;
@@ -1274,7 +1274,7 @@ vcc_expr_not(struct vcc *tl, struct expr **e, enum var_type fmt)
  */
 
 static void
-vcc_expr_cand(struct vcc *tl, struct expr **e, enum var_type fmt)
+vcc_expr_cand(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 {
 	struct expr *e2;
 	struct token *tk;
@@ -1309,7 +1309,7 @@ vcc_expr_cand(struct vcc *tl, struct expr **e, enum var_type fmt)
  */
 
 static void
-vcc_expr0(struct vcc *tl, struct expr **e, enum var_type fmt)
+vcc_expr0(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 {
 	struct expr *e2;
 	struct token *tk;
@@ -1349,7 +1349,7 @@ vcc_expr0(struct vcc *tl, struct expr **e, enum var_type fmt)
  */
 
 void
-vcc_Expr(struct vcc *tl, enum var_type fmt)
+vcc_Expr(struct vcc *tl, vcc_type_t fmt)
 {
 	struct expr *e;
 	struct token *t1;
diff --git a/lib/libvcc/vcc_storage.c b/lib/libvcc/vcc_storage.c
index 878c727..9d17b5e 100644
--- a/lib/libvcc/vcc_storage.c
+++ b/lib/libvcc/vcc_storage.c
@@ -66,7 +66,7 @@
  */
 
 static struct var *
-vcc_Stv_mkvar(struct vcc *tl, enum var_type fmt)
+vcc_Stv_mkvar(struct vcc *tl, vcc_type_t fmt)
 {
 	struct var *v;
 
@@ -84,7 +84,7 @@ vcc_Stv_mkvar(struct vcc *tl, enum var_type fmt)
 
 static struct stvars {
 	const char	*name;
-	enum var_type	fmt;
+	vcc_type_t	fmt;
 } stvars[] = {
 #define VRTSTVVAR(nm, vtype, ctype, dval)	{ #nm, vtype },
 #include "tbl/vrt_stv_var.h"
diff --git a/lib/libvcc/vcc_symb.c b/lib/libvcc/vcc_symb.c
index 4b9979d..ad223a7 100644
--- a/lib/libvcc/vcc_symb.c
+++ b/lib/libvcc/vcc_symb.c
@@ -39,7 +39,7 @@
 /*--------------------------------------------------------------------*/
 
 enum symkind
-VCC_HandleKind(enum var_type fmt)
+VCC_HandleKind(vcc_type_t fmt)
 {
 	switch(fmt) {
 	case ACL:	return(SYM_ACL);
@@ -182,7 +182,7 @@ VCC_WalkSymbols(struct vcc *tl, symwalk_f *func, enum symkind kind)
 
 static void
 vcc_global(struct vcc *tl, struct symbol *sym,
-    enum var_type fmt, const char *str, va_list ap)
+    vcc_type_t fmt, const char *str, va_list ap)
 {
 	struct vsb *vsb;
 
@@ -209,7 +209,7 @@ vcc_global(struct vcc *tl, struct symbol *sym,
 }
 
 void
-VCC_GlobalSymbol(struct symbol *sym, enum var_type fmt, const char *str, ...)
+VCC_GlobalSymbol(struct symbol *sym, vcc_type_t fmt, const char *str, ...)
 {
 	va_list ap;
 
@@ -219,7 +219,7 @@ VCC_GlobalSymbol(struct symbol *sym, enum var_type fmt, const char *str, ...)
 }
 
 struct symbol *
-VCC_HandleSymbol(struct vcc *tl, const struct token *tk, enum var_type fmt,
+VCC_HandleSymbol(struct vcc *tl, const struct token *tk, vcc_type_t fmt,
     const char *str, ...)
 {
 	struct symbol *sym;



More information about the varnish-commit mailing list