Commit 5589514b authored by Alessandro Rubini's avatar Alessandro Rubini

diag-macrocs: introduce pp_diag_allow, used in fsm.c

pp_diag_allow(ppi, thing, level) can be used as a conditional
to mask off diagnostic prints that cannot be individually
written as pp_diag()  (this mainly applies to frame dumping, introduced
in later commits).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 07fc9b14
......@@ -16,7 +16,7 @@ static void pp_fsm_printf(struct pp_instance *ppi, char *fmt, ...)
TimeInternal t;
unsigned long oflags = pp_global_flags;
if (!__PP_DIAG_ALLOW(ppi, pp_dt_fsm, 1))
if (!pp_diag_allow(ppi, fsm, 1))
return;
/* temporarily set NOTIMELOG, as we'll print the time ourselves */
......
......@@ -128,6 +128,9 @@ extern void __pp_diag(struct pp_instance *ppi, enum pp_diag_things th,
PP_HAS_DIAG; /* return 1 if done, 0 if not done */ \
})
#define pp_diag_allow(ppi_, th_, level_) \
(PP_HAS_DIAG && __PP_DIAG_ALLOW(ppi_, pp_dt_ ## th_, level_))
/*
* And this is the parser of the string. Internally it obeys VERB_LOG_MESGS
* to set the value to 0xfffffff0 to be compatible with previous usage.
......
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