Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for term serialize (as external term) to buffer #1309

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

bettio
Copy link
Collaborator

@bettio bettio commented Oct 10, 2024

While there was a externalterm_to_term function that was taking a buffer and returning a term, there wasn't the exact opposite, since it was returning a binary.

These new functions can be useful for any NIF or function that manipulates just the buffer and not the whole binary.
This will allow to implement later both support for compressed format or to optimize/cleanup the erlang:term_to_binary NIF.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

@bettio bettio changed the base branch from main to release-0.6 October 10, 2024 22:13
@bettio bettio force-pushed the external-term-serialize branch 2 times, most recently from f2f8b26 to 938dbe8 Compare October 10, 2024 22:21
Make functions for writing a term using external term format to a buffer
accessible, so there is no need to use a binary.

externalterm_serialize_term(_raw) and externalterm_compute_external_size(_raw) functions can be
useful when using external term format in NIFs or port drivers.

Before this change `externalterm_to_binary` was the only available
function, but was forcing using a binary term as output.

Signed-off-by: Davide Bettio <[email protected]>
Copy link
Collaborator

@UncleGrumpy UncleGrumpy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine to me

@bettio bettio changed the title External term serialize Add support for term serialize (as external term) to buffer Oct 11, 2024
@bettio bettio merged commit 69d6c01 into atomvm:release-0.6 Oct 11, 2024
95 of 96 checks passed
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.

2 participants