LF_NODE_WITH_OPT(node) returns true if the node's option may be set and
thus should be considered. Logic is based on logformat node's type:
for now only TAG and FMT nodes can be configured.
const struct logformat_tag *tag; // set if ->type == LOG_FMT_TAG
};
+/* returns true if the node options may be set (according to it's type) */
+#define LF_NODE_WITH_OPT(node) \
+ (node->type == LOG_FMT_EXPR || node->type == LOG_FMT_TAG)
+
enum lf_expr_flags {
LF_FL_NONE = 0x00,
LF_FL_COMPILED = 0x01
px->to_log |= lf->tag->lw;
}
next_node:
- if (lf->type == LOG_FMT_EXPR || lf->type == LOG_FMT_TAG) {
+ if (LF_NODE_WITH_OPT(lf)) {
/* For configurable nodes, apply current node's option
* mask to global node options to keep options common
* to all nodes
/* types that cannot be named such as text or separator are ignored
* when encoding is set
*/
- if (tmp->type != LOG_FMT_EXPR && tmp->type != LOG_FMT_TAG)
+ if (!LF_NODE_WITH_OPT(tmp))
goto next_fmt;
if (!tmp->name)