* The function needs to return the position of the last written byte
* on success and NULL on failure. The function cannot write past <stop>
*/
- 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 */
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 */
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;
}
}
}
}
}
- start = ctx->e_byte_fct(ctx, start, stop, prefix);
+ start = ctx->e_fct_byte(ctx, start, stop, prefix);
if (start == NULL)
return NULL;
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;
/* 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++;