[master] ac92267 Remove the 'type' argument from VSM_Get()
Poul-Henning Kamp
phk at FreeBSD.org
Fri Jun 9 07:58:06 CEST 2017
commit ac9226747b4f37a048a42b9ca764e6816ee0b32d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Jun 9 05:57:02 2017 +0000
Remove the 'type' argument from VSM_Get()
diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index 465f2d6..f9177d0 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -411,7 +411,7 @@ n_arg_sock(const char *n_arg)
return (-1);
}
- if (!VSM_Get(vsm, &vt, "Arg", "-T", "")) {
+ if (!VSM_Get(vsm, &vt, "Arg", "-T")) {
fprintf(stderr, "No -T arg in shared memory\n");
VSM_Delete(vsm);
return (-1);
@@ -420,7 +420,7 @@ n_arg_sock(const char *n_arg)
AN(vt.b);
T_start = T_arg = strdup(vt.b);
- if (VSM_Get(vsm, &vt, "Arg", "-S", "")) {
+ if (VSM_Get(vsm, &vt, "Arg", "-S")) {
AZ(VSM_Map(vsm, &vt));
AN(vt.b);
S_arg = strdup(vt.b);
diff --git a/bin/varnishd/mgt/mgt_cli.c b/bin/varnishd/mgt/mgt_cli.c
index 1eb3ce8..3694263 100644
--- a/bin/varnishd/mgt/mgt_cli.c
+++ b/bin/varnishd/mgt/mgt_cli.c
@@ -503,7 +503,7 @@ mgt_cli_secret(const char *S_arg)
char buf[BUFSIZ];
/* Save in shmem */
- mgt_SHM_static_alloc(S_arg, strlen(S_arg) + 1L, "Arg", "-S", "");
+ mgt_SHM_static_alloc(S_arg, strlen(S_arg) + 1L, "Arg", "", "-S");
VJ_master(JAIL_MASTER_FILE);
fd = open(S_arg, O_RDONLY);
@@ -573,7 +573,7 @@ mgt_cli_telnet(const char *T_arg)
if (VSB_len(vsb) == 0)
ARGV_ERR("-T %s could not be listened on.\n", T_arg);
/* Save in shmem */
- mgt_SHM_static_alloc(VSB_data(vsb), VSB_len(vsb) + 1, "Arg", "-T", "");
+ mgt_SHM_static_alloc(VSB_data(vsb), VSB_len(vsb) + 1, "Arg", "", "-T");
VSB_destroy(&vsb);
}
diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h
index d556b4c..3345371 100644
--- a/include/vapi/vsm.h
+++ b/include/vapi/vsm.h
@@ -196,11 +196,11 @@ const struct vsm_valid *VSM_StillValid(const struct vsm *vd,
*/
int VSM_Get(const struct vsm *vd, struct VSM_fantom *vf,
- const char *class, const char *type, const char *ident);
+ const char *class, const char *ident);
/*
* Find a chunk, produce fantom for it.
* Returns zero on failure.
- * class is mandatory, type and ident optional.
+ * class is mandatory, ident optional.
*/
#endif /* VAPI_VSM_H_INCLUDED */
diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c
index b193e44..b393fe8 100644
--- a/lib/libvarnishapi/vsl_cursor.c
+++ b/lib/libvarnishapi/vsl_cursor.c
@@ -247,7 +247,7 @@ VSL_CursorVSM(struct VSL_data *vsl, struct vsm *vsm, unsigned options)
CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC);
- if (!VSM_Get(vsm, &vf, VSL_CLASS, "", "")) {
+ if (!VSM_Get(vsm, &vf, VSL_CLASS, NULL)) {
(void)vsl_diag(vsl,
"No VSL chunk found (child not started ?)");
return (NULL);
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 1e31533..ad03d0c 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -208,7 +208,7 @@ VSM_Name(const struct vsm *vd)
struct VSM_fantom vt;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
- if (VSM_Get(vd, &vt, "Arg", "-i", ""))
+ if (VSM_Get(vd, &vt, "Arg", "-i"))
return (vt.b);
return ("");
}
@@ -481,15 +481,13 @@ VSM_StillValid(const struct vsm *vd, struct VSM_fantom *vf)
int
VSM_Get(const struct vsm *vd, struct VSM_fantom *vf,
- const char *class, const char *type, const char *ident)
+ const char *class, const char *ident)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
VSM_FOREACH(vf, vd) {
if (strcmp(vf->class, class))
continue;
- if (type != NULL && strcmp(vf->type, type))
- continue;
if (ident != NULL && strcmp(vf->ident, ident))
continue;
return (1);
More information about the varnish-commit
mailing list