Skip to content

Use typed data API#31

Open
nobu wants to merge 2 commits into
cabo:masterfrom
nobu:typed_data
Open

Use typed data API#31
nobu wants to merge 2 commits into
cabo:masterfrom
nobu:typed_data

Conversation

@nobu
Copy link
Copy Markdown

@nobu nobu commented Jun 1, 2026

  • Use typed data for wrapped CBOR objects
    Prefer TypedData for Buffer, Packer, and Unpacker objects so the extension builds with Ruby 4.1 where the old Data_* access macros are no longer available. Keep MessagePack_Buffer_wrap as a wrap operation because it exposes an existing embedded buffer.

  • Use Data_Make_Struct for data allocation
    Allocate data with Data_Make_Struct so Ruby owns the memory as soon as the object is created. This avoids leaking the ALLOC_N buffer if Data_Wrap_Struct raises while allocating the Ruby object.

nobu added 2 commits June 1, 2026 19:35
Allocate data with Data_Make_Struct so Ruby owns the memory as soon as
the object is created. This avoids leaking the ALLOC_N buffer if
Data_Wrap_Struct raises while allocating the Ruby object.
Prefer TypedData for Buffer, Packer, and Unpacker objects so the
extension builds with Ruby 4.1 where the old Data_* access macros are
no longer available. Keep MessagePack_Buffer_wrap as a wrap operation
because it exposes an existing embedded buffer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant