MINOR: log: expose node typecast in lf_buildctx struct

Store node->typecast setting inside lf_buildctx struct so that encoding
functions may benefit from it.
This commit is contained in:
Aurelien DARRAGON 2024-04-25 18:52:57 +02:00
parent 3f2e8d0ed2
commit 84963fb743

View File

@ -1731,6 +1731,7 @@ int get_log_facility(const char *fac)
struct lf_buildctx { struct lf_buildctx {
int options; /* LOG_OPT_* options */ int options; /* LOG_OPT_* options */
int typecast;/* same as logformat_node->typecast */
int in_text; /* inside variable-length text */ int in_text; /* inside variable-length text */
}; };
@ -1742,11 +1743,15 @@ static inline void lf_buildctx_prepare(struct lf_buildctx *ctx,
const struct logformat_node *node) const struct logformat_node *node)
{ {
ctx->options = g_options; ctx->options = g_options;
ctx->typecast = SMP_T_SAME; /* default */
if (node) { if (node) {
/* per-node options are only considered if not already set /* per-node options are only considered if not already set
* globally * globally
*/ */
ctx->options |= node->options; ctx->options |= node->options;
/* consider node's typecast setting */
ctx->typecast = node->typecast;
} }
} }