Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Commit 5f67d3a

Browse files
committed
Slight reshuffling of some lines of code.
1 parent c44bd67 commit 5f67d3a

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

lib/libvarnish/vcli_serve.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,27 @@ VCLS_func_help_json(struct cli *cli, const char * const *av, void *priv)
212212
*/
213213

214214
static void
215-
cls_dispatch(struct cli *cli, const struct cli_proto *cp,
216-
char * const * av, int ac)
215+
cls_dispatch(struct cli *cli, struct VCLS *cs, char * const * av, int ac)
217216
{
218217
int json = 0;
218+
struct cli_proto *cp;
219219

220220
AN(av);
221221
assert(ac >= 0);
222222

223+
VTAILQ_FOREACH(cp, &cs->funcs, list) {
224+
if (cp->auth > cli->auth)
225+
continue;
226+
if (!strcmp(cp->desc->request, av[1]))
227+
break;
228+
}
229+
230+
if (cp == NULL && cs->wildcard && cs->wildcard->auth <= cli->auth)
231+
cp = cs->wildcard;
232+
233+
if (cp == NULL)
234+
return;
235+
223236
VSB_clear(cli->sb);
224237

225238
if (ac > 1 && !strcmp(av[2], "-j"))
@@ -263,7 +276,6 @@ static int
263276
cls_exec(struct VCLS_fd *cfd, char * const *av)
264277
{
265278
struct VCLS *cs;
266-
struct cli_proto *clp;
267279
struct cli *cli;
268280
int na;
269281
ssize_t len;
@@ -313,17 +325,7 @@ cls_exec(struct VCLS_fd *cfd, char * const *av)
313325
for (na = 0; av[na + 1] != NULL; na++)
314326
continue;
315327

316-
VTAILQ_FOREACH(clp, &cs->funcs, list) {
317-
if (clp->auth > cli->auth)
318-
continue;
319-
if (!strcmp(clp->desc->request, av[1])) {
320-
cls_dispatch(cli, clp, av, na);
321-
break;
322-
}
323-
}
324-
if (clp == NULL &&
325-
cs->wildcard && cs->wildcard->auth <= cli->auth)
326-
cls_dispatch(cli, cs->wildcard, av, na);
328+
cls_dispatch(cli, cs, av, na);
327329

328330
} while (0);
329331

0 commit comments

Comments
 (0)