Skip to content

Commit eb4bedb

Browse files
Add a function to obtain the CborEncoder's current pointer
This is better than mucking with the struct's internals. I plan to change it soon by adding more unions, to support fragmented buffers on constrained OSes like Zephyr. Signed-off-by: Thiago Macieira <[email protected]>
1 parent dde26c8 commit eb4bedb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cbor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ CBOR_API CborError cbor_encoder_create_map(CborEncoder *encoder, CborEncoder *ma
245245
CBOR_API CborError cbor_encoder_close_container(CborEncoder *encoder, const CborEncoder *containerEncoder);
246246
CBOR_API CborError cbor_encoder_close_container_checked(CborEncoder *encoder, const CborEncoder *containerEncoder);
247247

248+
CBOR_INLINE_API uint8_t *_cbor_encoder_get_buffer_pointer(const CborEncoder *encoder)
249+
{
250+
return encoder->data.ptr;
251+
}
252+
248253
CBOR_INLINE_API size_t cbor_encoder_get_buffer_size(const CborEncoder *encoder, const uint8_t *buffer)
249254
{
250255
return (size_t)(encoder->data.ptr - buffer);

0 commit comments

Comments
 (0)