diff --git a/include/haproxy/tools-t.h b/include/haproxy/tools-t.h index b6d674d8b..a63e0f6d2 100644 --- a/include/haproxy/tools-t.h +++ b/include/haproxy/tools-t.h @@ -174,11 +174,11 @@ struct cbor_encode_ctx { * The function needs to return the position of the last written byte * on success and NULL on failure. The function cannot write past */ - char *(*e_byte_fct)(struct cbor_encode_ctx *ctx, + char *(*e_fct_byte)(struct cbor_encode_ctx *ctx, char *start, char *stop, uint8_t byte); - /* to pass some context to the encode_byte fct */ - void *e_byte_fct_ctx; + /* to provide some user-context to the encode_fct_* funcs */ + void *e_fct_ctx; }; #endif /* _HAPROXY_TOOLS_T_H */ diff --git a/src/log.c b/src/log.c index 2e8e1b281..68399a1e0 100644 --- a/src/log.c +++ b/src/log.c @@ -1774,7 +1774,7 @@ static char *_encode_byte_hex(char *start, char *stop, unsigned char byte) static char *_lf_cbor_encode_byte(struct cbor_encode_ctx *cbor_ctx, char *start, char *stop, unsigned char byte) { - struct lf_buildctx *ctx = cbor_ctx->e_byte_fct_ctx; + struct lf_buildctx *ctx = cbor_ctx->e_fct_ctx; if (ctx->options & LOG_OPT_BIN) { /* raw output */ @@ -1825,8 +1825,8 @@ static inline void lf_buildctx_prepare(struct lf_buildctx *ctx, if (ctx->options & LOG_OPT_ENCODE_CBOR) { /* prepare cbor-specific encode ctx */ - ctx->encode.cbor.e_byte_fct = _lf_cbor_encode_byte; - ctx->encode.cbor.e_byte_fct_ctx = ctx; + ctx->encode.cbor.e_fct_byte = _lf_cbor_encode_byte; + ctx->encode.cbor.e_fct_ctx = ctx; } } } diff --git a/src/tools.c b/src/tools.c index 19d48d62e..61e0eaf6f 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2109,7 +2109,7 @@ char *cbor_encode_uint64_prefix(struct cbor_encode_ctx *ctx, } } - start = ctx->e_byte_fct(ctx, start, stop, prefix); + start = ctx->e_fct_byte(ctx, start, stop, prefix); if (start == NULL) return NULL; @@ -2117,7 +2117,7 @@ char *cbor_encode_uint64_prefix(struct cbor_encode_ctx *ctx, while (nb_bytes) { uint8_t cur_byte = (value >> ((nb_bytes - 1) * 8)) & 0xFFU; - start = ctx->e_byte_fct(ctx, start, stop, cur_byte); + start = ctx->e_fct_byte(ctx, start, stop, cur_byte); if (start == NULL) return NULL; @@ -2181,7 +2181,7 @@ char *cbor_encode_bytes_prefix(struct cbor_encode_ctx *ctx, /* write actual bytes if provided */ while (bytes && it < len) { - start = ctx->e_byte_fct(ctx, start, stop, bytes[it]); + start = ctx->e_fct_byte(ctx, start, stop, bytes[it]); if (start == NULL) return NULL; it++;