Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
9d1986f9
Commit
9d1986f9
authored
Aug 24, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify VIN_n_Arg() to return the directory directly.
parent
879c9b37
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
15 deletions
+13
-15
mgt_main.c
bin/varnishd/mgt/mgt_main.c
+2
-2
vin.h
include/vin.h
+1
-1
vrt.h
include/vrt.h
+1
-0
vin.c
lib/libvarnish/vin.c
+5
-8
vsm.c
lib/libvarnishapi/vsm.c
+4
-4
No files found.
bin/varnishd/mgt/mgt_main.c
View file @
9d1986f9
...
...
@@ -782,8 +782,8 @@ main(int argc, char * const *argv)
VJ_master
(
JAIL_MASTER_LOW
);
}
if
(
VIN_n_Arg
(
n_arg
,
&
workdir
)
!=
0
)
ARGV_ERR
(
"Invalid instance (-n) name: %s
\n
"
,
VAS_errtxt
(
errno
)
);
workdir
=
VIN_n_Arg
(
n_arg
);
AN
(
workdir
);
if
(
i_arg
==
NULL
||
*
i_arg
==
'\0'
)
i_arg
=
mgt_HostName
();
...
...
include/vin.h
View file @
9d1986f9
...
...
@@ -34,5 +34,5 @@
#define VIN_H_INCLUDED
/* This function lives in both libvarnish and libvarnishapi */
int
VIN_n_Arg
(
const
char
*
n_arg
,
char
**
dir
);
char
*
VIN_n_Arg
(
const
char
*
n_arg
);
#endif
include/vrt.h
View file @
9d1986f9
...
...
@@ -54,6 +54,7 @@
* binary/load-time compatible, increment MAJOR version
*
* NEXT (2021-09-15)
* VIN_n_Arg() no directly returns the directory name.
* VSB_new() and VSB_delete() removed
* VCL_STRINGLIST, vrt_magic_string_end removed
* VRT_String(), VRT_StringList(), VRT_CollectString() removed
...
...
lib/libvarnish/vin.c
View file @
9d1986f9
...
...
@@ -42,12 +42,11 @@
#include "vin.h"
#include "vsb.h"
int
VIN_n_Arg
(
const
char
*
n_arg
,
char
**
dir
)
char
*
VIN_n_Arg
(
const
char
*
n_arg
)
{
struct
vsb
*
vsb
;
AN
(
dir
);
char
*
retval
;
vsb
=
VSB_new_auto
();
AN
(
vsb
);
...
...
@@ -63,9 +62,7 @@ VIN_n_Arg(const char *n_arg, char **dir)
}
AZ
(
VSB_finish
(
vsb
));
*
dir
=
strdup
(
VSB_data
(
vsb
));
retval
=
strdup
(
VSB_data
(
vsb
));
VSB_destroy
(
&
vsb
);
if
(
*
dir
==
NULL
)
return
(
-
1
);
return
(
0
);
return
(
retval
);
}
lib/libvarnishapi/vsm.c
View file @
9d1986f9
...
...
@@ -387,12 +387,12 @@ VSM_Arg(struct vsm *vd, char flag, const char *arg)
}
break
;
case
'n'
:
if
(
VIN_n_Arg
(
arg
,
&
p
))
if
(
vd
->
wdname
!=
NULL
)
free
(
vd
->
wdname
);
vd
->
wdname
=
VIN_n_Arg
(
arg
);
if
(
vd
->
wdname
==
NULL
)
return
(
vsm_diag
(
vd
,
"Invalid instance name: %s"
,
strerror
(
errno
)));
AN
(
p
);
REPLACE
(
vd
->
wdname
,
p
);
free
(
p
);
break
;
default:
return
(
vsm_diag
(
vd
,
"Unknown VSM_Arg('%c')"
,
flag
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment