Commit f7d8112c authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

varnishtest: New macro_isdef() function

parent 21ec091a
......@@ -201,6 +201,26 @@ macro_undef(struct vtclog *vl, const char *instance, const char *name)
AZ(pthread_mutex_unlock(&macro_mtx));
}
unsigned
macro_isdef(const char *instance, const char *name)
{
char buf1[256];
struct macro *m;
if (instance != NULL) {
bprintf(buf1, "%s_%s", instance, name);
name = buf1;
}
AZ(pthread_mutex_lock(&macro_mtx));
VTAILQ_FOREACH(m, &macro_list, list)
if (!strcmp(name, m->name))
break;
AZ(pthread_mutex_unlock(&macro_mtx));
return (m != NULL);
}
void
macro_cat(struct vtclog *vl, struct vsb *vsb, const char *b, const char *e)
{
......
......@@ -114,8 +114,8 @@ int exec_file(const char *fn, const char *script, const char *tmpdir,
void macro_undef(struct vtclog *vl, const char *instance, const char *name);
void macro_def(struct vtclog *vl, const char *instance, const char *name,
const char *fmt, ...)
v_printflike_(4, 5);
const char *fmt, ...) v_printflike_(4, 5);
unsigned macro_isdef(const char *instance, const char *name);
void macro_cat(struct vtclog *, struct vsb *, const char *, const char *);
struct vsb *macro_expand(struct vtclog *vl, const char *text);
struct vsb *macro_expandf(struct vtclog *vl, const char *, ...)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment