[master] 20a3eee Eliminate the VSC-sections.

Poul-Henning Kamp phk at FreeBSD.org
Fri Jun 16 01:00:08 CEST 2017


commit 20a3eee64da44939c2271fe1ee2a54d566d66fee
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jun 15 22:58:57 2017 +0000

    Eliminate the VSC-sections.

diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index 1290408..23056e7 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -56,21 +56,19 @@ static int
 do_xml_cb(void *priv, const struct VSC_point * const pt)
 {
 	uint64_t val;
-	const struct VSC_section *sec;
 
 	(void)priv;
 	if (pt == NULL)
 		return (0);
-	AZ(strcmp(pt->desc->ctype, "uint64_t"));
+	AZ(strcmp(pt->ctype, "uint64_t"));
 	val = *(const volatile uint64_t*)pt->ptr;
-	sec = pt->section;
 
 	printf("\t<stat>\n");
-	printf("\t\t<name>%s.%s</name>\n", sec->ident, pt->desc->name);
+	printf("\t\t<name>%s</name>\n", pt->name);
 	printf("\t\t<value>%ju</value>\n", (uintmax_t)val);
-	printf("\t\t<flag>%c</flag>\n", pt->desc->semantics);
-	printf("\t\t<format>%c</format>\n", pt->desc->format);
-	printf("\t\t<description>%s</description>\n", pt->desc->sdesc);
+	printf("\t\t<flag>%c</flag>\n", pt->semantics);
+	printf("\t\t<format>%c</format>\n", pt->format);
+	printf("\t\t<description>%s</description>\n", pt->sdesc);
 	printf("\t</stat>\n");
 	return (0);
 }
@@ -97,15 +95,13 @@ do_json_cb(void *priv, const struct VSC_point * const pt)
 {
 	uint64_t val;
 	int *jp;
-	const struct VSC_section *sec;
 
 	if (pt == NULL)
 		return (0);
 
 	jp = priv;
-	AZ(strcmp(pt->desc->ctype, "uint64_t"));
+	AZ(strcmp(pt->ctype, "uint64_t"));
 	val = *(const volatile uint64_t*)pt->ptr;
-	sec = pt->section;
 
 	if (*jp)
 		*jp = 0;
@@ -114,13 +110,11 @@ do_json_cb(void *priv, const struct VSC_point * const pt)
 
 	printf("  \"");
 	/* build the JSON key name.  */
-	if (sec->ident[0])
-		printf("%s.", sec->ident);
-	printf("%s\": {\n", pt->desc->name);
-	printf("    \"description\": \"%s\",\n", pt->desc->sdesc);
+	printf("%s\": {\n", pt->name);
+	printf("    \"description\": \"%s\",\n", pt->sdesc);
 
-	printf("    \"flag\": \"%c\", ", pt->desc->semantics);
-	printf("\"format\": \"%c\",\n", pt->desc->format);
+	printf("    \"flag\": \"%c\", ", pt->semantics);
+	printf("\"format\": \"%c\",\n", pt->format);
 	printf("    \"value\": %ju", (uintmax_t)val);
 	printf("\n  }");
 
@@ -160,14 +154,12 @@ do_once_cb_first(void *priv, const struct VSC_point * const pt)
 {
 	struct once_priv *op;
 	uint64_t val;
-	const struct VSC_section *sec;
 
 	if (pt == NULL)
 		return (0);
 	op = priv;
-	AZ(strcmp(pt->desc->ctype, "uint64_t"));
-	sec = pt->section;
-	if (strcmp(sec->ident, "MAIN") || strcmp(pt->desc->name, "uptime"))
+	AZ(strcmp(pt->ctype, "uint64_t"));
+	if (strcmp(pt->name, "MAIN.uptime"))
 		return (0);
 	val = *(const volatile uint64_t*)pt->ptr;
 	op->up = (double)val;
@@ -180,28 +172,24 @@ do_once_cb(void *priv, const struct VSC_point * const pt)
 	struct once_priv *op;
 	uint64_t val;
 	int i;
-	const struct VSC_section *sec;
 
 	if (pt == NULL)
 		return (0);
 	op = priv;
-	AZ(strcmp(pt->desc->ctype, "uint64_t"));
+	AZ(strcmp(pt->ctype, "uint64_t"));
 	val = *(const volatile uint64_t*)pt->ptr;
-	sec = pt->section;
 	i = 0;
-	if (strcmp(sec->ident, ""))
-		i += printf("%s.", sec->ident);
-	i += printf("%s", pt->desc->name);
+	i += printf("%s", pt->name);
 	if (i >= op->pad)
 		op->pad = i + 1;
 	printf("%*.*s", op->pad - i, op->pad - i, "");
-	if (pt->desc->semantics == 'c')
+	if (pt->semantics == 'c')
 		printf("%12ju %12.2f %s\n",
 		    (uintmax_t)val, op->up ? val / op->up : 0,
-		    pt->desc->sdesc);
+		    pt->sdesc);
 	else
 		printf("%12ju %12s %s\n",
-		    (uintmax_t)val, ".  ", pt->desc->sdesc);
+		    (uintmax_t)val, ".  ", pt->sdesc);
 	return (0);
 }
 
@@ -223,21 +211,17 @@ static int
 do_list_cb(void *priv, const struct VSC_point * const pt)
 {
 	int i;
-	const struct VSC_section * sec;
 
 	(void)priv;
 
 	if (pt == NULL)
 		return (0);
 
-	sec = pt->section;
 	i = 0;
-	if (strcmp(sec->ident, ""))
-		i += printf("%s.", sec->ident);
-	i += printf("%s", pt->desc->name);
+	i += printf("%s", pt->name);
 	if (i < 30)
 		printf("%*s", i - 30, "");
-	printf(" %s\n", pt->desc->sdesc);
+	printf(" %s\n", pt->sdesc);
 	return (0);
 }
 
diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index c517bc6..ab32eca 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -73,9 +73,7 @@ struct pt {
 #define PT_MAGIC		0x41698E4F
 	VTAILQ_ENTRY(pt)	list;
 
-	const struct VSC_point	*vpt;
-
-	char			*name;
+	struct VSC_point	*vpt;
 
 	char			seen;
 
@@ -210,7 +208,7 @@ build_pt_array(void)
 		CHECK_OBJ_NOTNULL(pt, PT_MAGIC);
 		if (!pt->seen && hide_unseen)
 			continue;
-		if (pt->vpt->desc->level > verbosity)
+		if (pt->vpt->level > verbosity)
 			continue;
 		assert(n_ptarray < n_ptlist);
 		ptarray[n_ptarray++] = pt;
@@ -240,7 +238,7 @@ delete_pt_list(void)
 		pt = VTAILQ_FIRST(&ptlist);
 		CHECK_OBJ_NOTNULL(pt, PT_MAGIC);
 		VTAILQ_REMOVE(&ptlist, pt, list);
-		free(pt->name);
+		VSC_Destroy_Point(&pt->vpt);
 		FREE_OBJ(pt);
 		i++;
 	}
@@ -262,34 +260,34 @@ build_pt_list_cb(void *priv, const struct VSC_point *vpt)
 {
 	struct pt_priv *pt_priv;
 	struct pt *pt;
-	char buf[128];
 
 	if (vpt == NULL)
 		return (0);
 
 	CAST_OBJ_NOTNULL(pt_priv, priv, PT_PRIV_MAGIC);
 
-	AZ(strcmp(vpt->desc->ctype, "uint64_t"));
-	bprintf(buf, "%s.%s", vpt->section->ident, vpt->desc->name);
+	AZ(strcmp(vpt->ctype, "uint64_t"));
 
-	if (!strcmp(buf, "MGT.uptime"))
+	if (!strcmp(vpt->name, "MGT.uptime"))
 		mgt_uptime = vpt->ptr;
-	if (!strcmp(buf, "MAIN.uptime"))
+	if (!strcmp(vpt->name, "MAIN.uptime"))
 		main_uptime = vpt->ptr;
-	if (!strcmp(buf, "MAIN.cache_hit"))
+	if (!strcmp(vpt->name, "MAIN.cache_hit"))
 		main_cache_hit = vpt->ptr;
-	if (!strcmp(buf, "MAIN.cache_miss"))
+	if (!strcmp(vpt->name, "MAIN.cache_miss"))
 		main_cache_miss = vpt->ptr;
 
 	VTAILQ_FOREACH(pt, &ptlist, list) {
 		CHECK_OBJ_NOTNULL(pt, PT_MAGIC);
-		AN(pt->name);
-		if (strcmp(buf, pt->name))
+		AN(pt->vpt->name);
+		if (strcmp(vpt->name, pt->vpt->name))
 			continue;
 		VTAILQ_REMOVE(&ptlist, pt, list);
 		AN(n_ptlist);
 		n_ptlist--;
-		pt->vpt = vpt;
+		VSC_Destroy_Point(&pt->vpt);
+		pt->vpt = VSC_Clone_Point(vpt);
+		AN(pt->vpt);
 		VTAILQ_INSERT_TAIL(&pt_priv->ptlist, pt, list);
 		pt_priv->n_ptlist++;
 		return (0);
@@ -299,10 +297,8 @@ build_pt_list_cb(void *priv, const struct VSC_point *vpt)
 	ALLOC_OBJ(pt, PT_MAGIC);
 	AN(pt);
 
-	REPLACE(pt->name, buf);
-	AN(pt->name);
-
-	pt->vpt = vpt;
+	pt->vpt = VSC_Clone_Point(vpt);
+	AN(pt->vpt);
 
 	pt->last = *pt->vpt->ptr;
 
@@ -379,12 +375,12 @@ sample_points(void)
 			pt->chg = ((int64_t)pt->cur - (int64_t)pt->last) /
 			    (pt->t_cur - pt->t_last);
 
-		if (pt->vpt->desc->semantics == 'g') {
+		if (pt->vpt->semantics == 'g') {
 			pt->avg = 0.;
 			update_ma(&pt->ma_10, (int64_t)pt->cur);
 			update_ma(&pt->ma_100, (int64_t)pt->cur);
 			update_ma(&pt->ma_1000, (int64_t)pt->cur);
-		} else if (pt->vpt->desc->semantics == 'c') {
+		} else if (pt->vpt->semantics == 'c') {
 			if (main_uptime != NULL && *main_uptime)
 				pt->avg = pt->cur / *main_uptime;
 			else
@@ -781,7 +777,7 @@ draw_line_bitmap(WINDOW *w, int y, int x, int X, const struct pt *pt)
 
 	AN(w);
 	AN(pt);
-	assert(pt->vpt->desc->format == 'b');
+	assert(pt->vpt->format == 'b');
 
 	col = 0;
 	while (col < COL_LAST) {
@@ -851,13 +847,13 @@ draw_line(WINDOW *w, int y, const struct pt *pt)
 	assert(colw_name >= COLW_NAME_MIN);
 	X = getmaxx(w);
 	x = 0;
-	if (strlen(pt->name) > colw_name)
-		mvwprintw(w, y, x, "%.*s...", colw_name - 3, pt->name);
+	if (strlen(pt->vpt->name) > colw_name)
+		mvwprintw(w, y, x, "%.*s...", colw_name - 3, pt->vpt->name);
 	else
-		mvwprintw(w, y, x, "%.*s", colw_name, pt->name);
+		mvwprintw(w, y, x, "%.*s", colw_name, pt->vpt->name);
 	x += colw_name;
 
-	switch (pt->vpt->desc->format) {
+	switch (pt->vpt->format) {
 	case 'b':
 		draw_line_bitmap(w, y, x, X, pt);
 		break;
@@ -926,7 +922,7 @@ draw_bar_b(void)
 		mvwprintw(w_bar_b, 0, x, "vvv");
 	x += 4;
 	if (current < n_ptarray - 1)
-		mvwprintw(w_bar_b, 0, x, "%s", ptarray[current]->name);
+		mvwprintw(w_bar_b, 0, x, "%s", ptarray[current]->vpt->name);
 
 	bprintf(buf, "%d-%d/%d", page_start + 1,
 	    page_start + l_points < n_ptarray ?
@@ -957,9 +953,9 @@ draw_info(void)
 	if (current < n_ptarray - 1) {
 		/* XXX: Word wrapping, and overflow handling? */
 		mvwprintw(w_info, 0, 0, "%s:",
-		    ptarray[current]->vpt->desc->sdesc);
+		    ptarray[current]->vpt->sdesc);
 		mvwprintw(w_info, 1, 0, "%s",
-		    ptarray[current]->vpt->desc->ldesc);
+		    ptarray[current]->vpt->ldesc);
 	}
 	wnoutrefresh(w_info);
 }
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 7e41d07..96046c2 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -813,25 +813,22 @@ do_stat_dump_cb(void *priv, const struct VSC_point * const pt)
 	const struct varnish *v;
 	struct dump_priv *dp;
 	uint64_t u;
-	char buf[1024];
 
 	if (pt == NULL)
 		return (0);
 	dp = priv;
 	v = dp->v;
 
-	if (strcmp(pt->desc->ctype, "uint64_t"))
+	if (strcmp(pt->ctype, "uint64_t"))
 		return (0);
 	u = *pt->ptr;
 
-	bprintf(buf, "%s.%s", pt->section->ident, pt->desc->name);
-
 	if (strcmp(dp->arg, "*")) {
-		if (fnmatch(dp->arg, buf, 0))
+		if (fnmatch(dp->arg, pt->name, 0))
 			return (0);
 	}
 
-	vtc_log(v->vl, 4, "VSC %s %ju",  buf, (uintmax_t)u);
+	vtc_log(v->vl, 4, "VSC %s %ju",  pt->name, (uintmax_t)u);
 	return (0);
 }
 
@@ -858,7 +855,6 @@ varnish_vsc(struct varnish *v, const char *arg)
  */
 
 struct stat_priv {
-	char target_ident[256];
 	char target_name[256];
 	uintmax_t val;
 	const struct varnish *v;
@@ -872,12 +868,10 @@ do_stat_cb(void *priv, const struct VSC_point * const pt)
 	if (pt == NULL)
 		return(0);
 
-	if (strcmp(pt->section->ident, sp->target_ident))
-		return(0);
-	if (strcmp(pt->desc->name, sp->target_name))
+	if (strcmp(pt->name, sp->target_name))
 		return(0);
 
-	AZ(strcmp(pt->desc->ctype, "uint64_t"));
+	AZ(strcmp(pt->ctype, "uint64_t"));
 	AN(pt->ptr);
 	sp->val = *pt->ptr;
 	return (1);
@@ -907,11 +901,9 @@ varnish_expect(struct varnish *v, char * const *av)
 	}
 	p = strrchr(r, '.');
 	if (p == NULL) {
-		strcpy(sp.target_ident, "MAIN");
-		bprintf(sp.target_name, "%s", r);
+		bprintf(sp.target_name, "MAIN.%s", r);
 	} else {
-		bprintf(sp.target_ident, "%.*s", (int)(p - r), r);
-		bprintf(sp.target_name, "%s", p + 1);
+		bprintf(sp.target_name, "%s", r);
 	}
 
 	sp.val = 0;
diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h
index a3d847d..b46593e 100644
--- a/include/vapi/vsc.h
+++ b/include/vapi/vsc.h
@@ -56,7 +56,6 @@ int VSC_Arg(struct vsm *vd, int arg, const char *opt);
 struct VSC_level_desc;
 struct VSC_type_desc;
 struct VSC_section;
-struct VSC_desc;
 struct VSC_point;
 
 struct VSC_level_desc {
@@ -66,12 +65,8 @@ struct VSC_level_desc {
 	const char *ldesc;		/* long description */
 };
 
-struct VSC_section {
-	char *ident;
-};
-
-/* See include/tbl/vsc_fields.h for descriptions */
-struct VSC_desc {
+struct VSC_point {
+	const volatile uint64_t *ptr;	/* field value			*/
 	const char *name;		/* field name			*/
 	const char *ctype;		/* C-type			*/
 	int semantics;			/* semantics			*/
@@ -81,11 +76,9 @@ struct VSC_desc {
 	const char *ldesc;		/* long description		*/
 };
 
-struct VSC_point {
-	const struct VSC_desc *desc;	/* point description		*/
-	const volatile uint64_t *ptr;	/* field value			*/
-	const struct VSC_section *section;
-};
+struct VSC_point *VSC_Clone_Point(const struct VSC_point * const);
+
+void VSC_Destroy_Point(struct VSC_point **);
 
 typedef int VSC_iter_f(void *priv, const struct VSC_point *const pt);
 
diff --git a/lib/libvarnishapi/libvarnishapi.map b/lib/libvarnishapi/libvarnishapi.map
index 01c39f7..097be21 100644
--- a/lib/libvarnishapi/libvarnishapi.map
+++ b/lib/libvarnishapi/libvarnishapi.map
@@ -183,4 +183,6 @@ LIBVARNISHAPI_1.7 {
 	VSM_valid;
 	VSM_similar;
 	VSM_Map;
+	VSC_Destroy_Point;
+	VSC_Clone_Point;
 } LIBVARNISHAPI_1.0;
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index 737af89..298e9bb 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -58,7 +58,7 @@ struct vsc_vf {
 #define VSC_VF_MAGIC		0x516519f8
 	VTAILQ_ENTRY(vsc_vf)	list;
 	struct VSM_fantom	fantom;
-	struct VSC_section	section;
+	char			*ident;
 	struct vjsn		*vjsn;
 	int			order;
 };
@@ -68,6 +68,7 @@ struct vsc_pt {
 	unsigned		magic;
 #define VSC_PT_MAGIC		0xa4ff159a
 	VTAILQ_ENTRY(vsc_pt)	list;
+	char			*name;
 	struct VSC_point	point;
 };
 VTAILQ_HEAD(vsc_pt_head, vsc_pt);
@@ -110,6 +111,21 @@ static const size_t nlevels =
 
 /*--------------------------------------------------------------------*/
 
+struct VSC_point *
+VSC_Clone_Point(const struct VSC_point * const vp)
+{
+	return ((void*)(uintptr_t)vp);
+}
+
+void
+VSC_Destroy_Point(struct VSC_point **p)
+{
+	AN(p);
+	*p = NULL;
+}
+
+/*--------------------------------------------------------------------*/
+
 static struct vsc *
 vsc_setup(struct vsm *vd)
 {
@@ -153,6 +169,7 @@ vsc_delete_pt_list(struct vsc_pt_head *head)
 		pt = VTAILQ_FIRST(head);
 		CHECK_OBJ_NOTNULL(pt, VSC_PT_MAGIC);
 		VTAILQ_REMOVE(head, pt, list);
+		REPLACE(pt->name, NULL);
 		FREE_OBJ(pt);
 	}
 }
@@ -245,7 +262,7 @@ vsc_add_vf(struct vsc *vsc, const struct VSM_fantom *fantom, int order)
 	if (*vf->fantom.ident != '\0')
 		VSB_printf(vsb, ".%s", vf->fantom.ident);
 	AZ(VSB_finish(vsb));
-	REPLACE(vf->section.ident, VSB_data(vsb));
+	REPLACE(vf->ident, VSB_data(vsb));
 	VSB_destroy(&vsb);
 	vf->order = order;
 
@@ -260,24 +277,6 @@ vsc_add_vf(struct vsc *vsc, const struct VSM_fantom *fantom, int order)
 	return (vf);
 }
 
-/*lint -esym(528, vsc_add_pt) */
-/*lint -sem(vsc_add_pt, custodial(3)) */
-static void
-vsc_add_pt(struct vsc *vsc, const volatile void *ptr,
-    const struct VSC_desc *desc, const struct vsc_vf *vf)
-{
-	struct vsc_pt *pt;
-
-	ALLOC_OBJ(pt, VSC_PT_MAGIC);
-	AN(pt);
-
-	pt->point.desc = desc;
-	pt->point.ptr = ptr;
-	pt->point.section = &vf->section;
-
-	VTAILQ_INSERT_TAIL(&vsc->pt_list, pt, list);
-}
-
 /*--------------------------------------------------------------------
  */
 
@@ -331,24 +330,36 @@ vsc_build_pt_list(struct vsm *vd)
 	struct vsc *vsc = vsc_setup(vd);
 	struct vsc_vf *vf;
 	struct vjsn_val *vve, *vv, *vt;
-	struct VSC_desc *vdsc = NULL;
+	struct vsc_pt *pt;
+	struct vsb *vsb;
 
 	vsc_delete_pt_list(&vsc->pt_list);
+	vsb = VSB_new_auto();
+	AN(vsb);
 
 	VTAILQ_FOREACH(vf, &vsc->vf_list, list) {
 		vve = vjsn_child(vf->vjsn->value, "elem");
 		AN(vve);
 		VTAILQ_FOREACH(vv, &vve->children, list) {
-			vdsc = calloc(sizeof *vdsc, 1);
-			AN(vdsc);
+			ALLOC_OBJ(pt, VSC_PT_MAGIC);
+			AN(pt);
+
+			vt = vjsn_child(vv, "name");
+			AN(vt);
+			assert(vt->type == VJSN_STRING);
+
+			VSB_clear(vsb);
+			VSB_printf(vsb, "%s.%s", vf->ident, vt->value);
+			AZ(VSB_finish(vsb));
+			REPLACE(pt->name, VSB_data(vsb));
+			pt->point.name = pt->name;
 
 #define DOF(n, k)						\
 			vt = vjsn_child(vv, k);			\
 			AN(vt);					\
 			assert(vt->type == VJSN_STRING);	\
-			vdsc->n = vt->value;
+			pt->point.n = vt->value;
 
-			DOF(name,  "name");
 			DOF(ctype, "ctype");
 			DOF(sdesc, "oneliner");
 			DOF(ldesc, "docs");
@@ -358,13 +369,13 @@ vsc_build_pt_list(struct vsm *vd)
 			assert(vt->type == VJSN_STRING);
 
 			if (!strcmp(vt->value, "counter")) {
-				vdsc->semantics = 'c';
+				pt->point.semantics = 'c';
 			} else if (!strcmp(vt->value, "gauge")) {
-				vdsc->semantics = 'g';
+				pt->point.semantics = 'g';
 			} else if (!strcmp(vt->value, "bitmap")) {
-				vdsc->semantics = 'b';
+				pt->point.semantics = 'b';
 			} else {
-				vdsc->semantics = '?';
+				pt->point.semantics = '?';
 			}
 
 			vt = vjsn_child(vv, "format");
@@ -372,41 +383,38 @@ vsc_build_pt_list(struct vsm *vd)
 			assert(vt->type == VJSN_STRING);
 
 			if (!strcmp(vt->value, "integer")) {
-				vdsc->format = 'i';
+				pt->point.format = 'i';
 			} else if (!strcmp(vt->value, "bytes")) {
-				vdsc->format = 'B';
+				pt->point.format = 'B';
 			} else if (!strcmp(vt->value, "bitmap")) {
-				vdsc->format = 'b';
+				pt->point.format = 'b';
 			} else if (!strcmp(vt->value, "duration")) {
-				vdsc->format = 'd';
+				pt->point.format = 'd';
 			} else {
-				vdsc->format = '?';
+				pt->point.format = '?';
 			}
 
-			vdsc->level = &level_info;
+			pt->point.level = &level_info;
 
 			vt = vjsn_child(vv, "index");
 			AN(vt);
-			vsc_add_pt(vsc,
-			    (char*)vf->fantom.b + atoi(vt->value),
-			    vdsc, vf);
+
+			pt->point.ptr = (volatile void*)
+			    ((volatile char*)vf->fantom.b + atoi(vt->value));
+
+			VTAILQ_INSERT_TAIL(&vsc->pt_list, pt, list);
 		}
 	}
+	VSB_destroy(&vsb);
 }
 
 /*--------------------------------------------------------------------
  */
 
 static int
-vsc_filter_match_pt(struct vsb *vsb, const struct vsc_sf *sf, const
-    struct vsc_pt *pt)
+vsc_filter_match_pt(const struct vsc_sf *sf, const struct vsc_pt *pt)
 {
-	VSB_clear(vsb);
-	if (strcmp(pt->point.section->ident, ""))
-		VSB_printf(vsb, "%s.", pt->point.section->ident);
-	VSB_printf(vsb, "%s", pt->point.desc->name);
-	AZ(VSB_finish(vsb));
-	return (!fnmatch(sf->pattern, VSB_data(vsb), 0));
+	return (!fnmatch(sf->pattern, pt->point.name, 0));
 }
 
 static void
@@ -416,14 +424,11 @@ vsc_filter_pt_list(struct vsm *vd)
 	struct vsc_pt_head tmplist;
 	struct vsc_sf *sf;
 	struct vsc_pt *pt, *pt2;
-	struct vsb *vsb;
 
 	if (VTAILQ_EMPTY(&vsc->sf_list_include) &&
 	    VTAILQ_EMPTY(&vsc->sf_list_exclude))
 		return;
 
-	vsb = VSB_new_auto();
-	AN(vsb);
 	VTAILQ_INIT(&tmplist);
 
 	/* Include filters. Empty include filter list implies one that
@@ -434,7 +439,7 @@ vsc_filter_pt_list(struct vsm *vd)
 			CHECK_OBJ_NOTNULL(sf, VSC_SF_MAGIC);
 			VTAILQ_FOREACH_SAFE(pt, &vsc->pt_list, list, pt2) {
 				CHECK_OBJ_NOTNULL(pt, VSC_PT_MAGIC);
-				if (vsc_filter_match_pt(vsb, sf, pt)) {
+				if (vsc_filter_match_pt(sf, pt)) {
 					VTAILQ_REMOVE(&vsc->pt_list,
 					    pt, list);
 					VTAILQ_INSERT_TAIL(&tmplist,
@@ -451,15 +456,13 @@ vsc_filter_pt_list(struct vsm *vd)
 		CHECK_OBJ_NOTNULL(sf, VSC_SF_MAGIC);
 		VTAILQ_FOREACH_SAFE(pt, &vsc->pt_list, list, pt2) {
 			CHECK_OBJ_NOTNULL(pt, VSC_PT_MAGIC);
-			if (vsc_filter_match_pt(vsb, sf, pt)) {
+			if (vsc_filter_match_pt(sf, pt)) {
 				VTAILQ_REMOVE(&vsc->pt_list, pt, list);
 				VTAILQ_INSERT_TAIL(&tmplist, pt, list);
 			}
 		}
 	}
 	vsc_delete_pt_list(&tmplist);
-
-	VSB_destroy(&vsb);
 }
 
 /*--------------------------------------------------------------------
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 425e0f7..c4a7bd9 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -304,7 +304,7 @@ VSM_Open(struct vsm *vd)
 		    vd->iname, strerror(errno)));
 	}
 	/*
-	 * Force failure of client depends on remapping at same address. 
+	 * Force failure of client depends on remapping at same address.
 	 */
 	ppp = (char*)v + getpagesize() * 1000;
 



More information about the varnish-commit mailing list