summaryrefslogtreecommitdiff
path: root/test/example/c-api-relooper-unreachable-if.cpp
diff options
context:
space:
mode:
authorericvergnaud <eric.vergnaud@wanadoo.fr>2024-02-01 19:48:06 +0100
committerGitHub <noreply@github.com>2024-02-01 10:48:06 -0800
commit2b3a2e8c341395e4cb0f76db6ad4f31fb17720cc (patch)
treecca37d0a307f56b351611fb11e604d347c0ba301 /test/example/c-api-relooper-unreachable-if.cpp
parent6c70fcdf246ba5619c75b56e2ffddd8256dfd857 (diff)
downloadbinaryen-2b3a2e8c341395e4cb0f76db6ad4f31fb17720cc.tar.gz
binaryen-2b3a2e8c341395e4cb0f76db6ad4f31fb17720cc.tar.bz2
binaryen-2b3a2e8c341395e4cb0f76db6ad4f31fb17720cc.zip
C API: Use segment names (#6254)
Move from segment indexes to names. This is a breaking change to make the API more capable and consistent. An effort has been made to reduce the burden on C API users where possible (specifically, you can avoid providing names and let Binaryen make them for you, which will basically be numbers that match the indexes from before). Fixes #6247
Diffstat (limited to 'test/example/c-api-relooper-unreachable-if.cpp')
-rw-r--r--test/example/c-api-relooper-unreachable-if.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/example/c-api-relooper-unreachable-if.cpp b/test/example/c-api-relooper-unreachable-if.cpp
index 1c5708835..96c6c1149 100644
--- a/test/example/c-api-relooper-unreachable-if.cpp
+++ b/test/example/c-api-relooper-unreachable-if.cpp
@@ -15,16 +15,18 @@ int main() {
expressions[size_t(NULL)] = BinaryenExpressionRef(NULL);
BinaryenModuleAutoDrop(the_module);
{
- const char* segments[] = {0};
- bool segmentPassive[] = {false};
+ const char* segmentNames[] = {"0"};
+ const char* segmentDatas[] = {0};
+ bool segmentPassives[] = {false};
BinaryenExpressionRef segmentOffsets[] = {0};
BinaryenIndex segmentSizes[] = {0};
BinaryenSetMemory(the_module,
256,
256,
"memory",
- segments,
- segmentPassive,
+ segmentNames,
+ segmentDatas,
+ segmentPassives,
segmentOffsets,
segmentSizes,
0,
@@ -585,16 +587,18 @@ int main() {
}
BinaryenAddFunctionExport(the_module, "main", "main");
{
- const char* segments[] = {0};
+ const char* segmentNames[] = {"0"};
+ const char* segmentDatas[] = {0};
BinaryenExpressionRef segmentOffsets[] = {0};
- bool segmentPassive[] = {false};
+ bool segmentPassives[] = {false};
BinaryenIndex segmentSizes[] = {0};
BinaryenSetMemory(the_module,
1,
1,
NULL,
- segments,
- segmentPassive,
+ segmentNames,
+ segmentDatas,
+ segmentPassives,
segmentOffsets,
segmentSizes,
0,