Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/contribute/plugin/best_practice.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Security is a vital part of any software development process. It involves severa
```c
WasmEdge_Result Add(void *, const WasmEdge_CallingFrameContext *,
const WasmEdge_Value *In, WasmEdge_Value *Out) {
if (In[0].Type != WasmEdge_ValType_I32 || In[1].Type != WasmEdge_ValType_I32) {
return WasmEdge_Result_Error;
if (!WasmEdge_ValTypeIsI32(In[0].Type) || !WasmEdge_ValTypeIsI32(In[1].Type)) {
return WasmEdge_Result_Fail;
}
// Rest of the function...
}
Expand All @@ -93,7 +93,7 @@ Security is a vital part of any software development process. It involves severa
int32_t Val1 = WasmEdge_ValueGetI32(In[0]);
int32_t Val2 = WasmEdge_ValueGetI32(In[1]);
if (Val1 == INT32_MIN || Val2 == INT32_MIN) {
return WasmEdge_Result_Error;
return WasmEdge_Result_Fail;
}
// Rest of the function...
}
Expand Down
2 changes: 1 addition & 1 deletion docs/embed/c/reference/0.12.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2788,7 +2788,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
2 changes: 1 addition & 1 deletion docs/embed/c/reference/0.13.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2784,7 +2784,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
2 changes: 1 addition & 1 deletion docs/embed/c/reference/0.14.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -3058,7 +3058,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
2 changes: 1 addition & 1 deletion docs/embed/c/reference/0.15.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -3147,7 +3147,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
2 changes: 1 addition & 1 deletion docs/embed/c/reference/0.16.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -3196,7 +3196,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
2 changes: 1 addition & 1 deletion docs/embed/c/reference/0.17.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -3281,7 +3281,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
2 changes: 1 addition & 1 deletion docs/embed/c/reference/latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -3312,7 +3312,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
14 changes: 7 additions & 7 deletions docs/embed/c/reference/upgrade_to_0.12.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ When developers didn't use the VM context to load the plug-ins, they can use the
/* Assume that wasi_crypto plug-in is installed in the default plug-in path. */
WasmEdge_PluginLoadWithDefaultPaths();

WasmEdge_ModuleInstance *WasiCryptoCommonCxt =
WasmEdge_ModuleInstanceContext *WasiCryptoCommonCxt =
WasmEdge_ModuleInstanceCreateWasiCryptoCommon();

WasmEdge_ModuleInstanceDelete(WasiCryptoCommonCxt);
Expand All @@ -146,7 +146,7 @@ WasmEdge_String ModuleName =
WasmEdge_StringWrap(CryptoMName, strlen(CryptoMName));
const WasmEdge_PluginContext *PluginCxt = WasmEdge_PluginFind(PluginName);

WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, ModuleName);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down Expand Up @@ -177,18 +177,18 @@ WasmEdge_VMContext *VMCxt = WasmEdge_VMCreate(Conf, NULL);
WasmEdge_ConfigureDelete(Conf);

/* Get the WASI module instance. */
WasmEdge_ModuleInstance *WASIModInst =
WasmEdge_ModuleInstanceContext *WASIModInst =
WasmEdge_VMGetImportModuleContext(VMCxt, WasmEdge_HostRegistration_Wasi);
/* Get the WASI-crypto-common module instance. */
WasmEdge_ModuleInstance *WASICryptoCommonModInst =
WasmEdge_ModuleInstanceContext *WASICryptoCommonModInst =
WasmEdge_VMGetImportModuleContext(
VMCxt, WasmEdge_HostRegistration_WasiCrypto_Common);

/* Get the registered module instance by name. */
WasmEdge_StoreContext *StoreCxt = WasmEdge_VMGetStoreContext(VMCxt);
WasmEdge_String ModName =
WasmEdge_StringCreateByCString("wasi_ephemeral_crypto_kx");
const WasmEdge_ModuleInstance *WASICryptoKxModInst =
const WasmEdge_ModuleInstanceContext *WASICryptoKxModInst =
WasmEdge_StoreFindModule(StoreCxt, ModName);
WasmEdge_StringDelete(ModName);

Expand All @@ -209,12 +209,12 @@ WasmEdge_VMContext *VMCxt = WasmEdge_VMCreate(Conf, NULL);
WasmEdge_ConfigureDelete(Conf);

/* Get the WASI module instance. */
WasmEdge_ModuleInstance *WASIModInst =
WasmEdge_ModuleInstanceContext *WASIModInst =
WasmEdge_VMGetImportModuleContext(VMCxt, WasmEdge_HostRegistration_Wasi);
/* Get the registered WASI-crypto-common module instance by name. */
WasmEdge_String ModName =
WasmEdge_StringCreateByCString("wasi_ephemeral_crypto_common");
const WasmEdge_ModuleInstance *WASICryptoKxModInst =
const WasmEdge_ModuleInstanceContext *WASICryptoKxModInst =
WasmEdge_VMGetImportModuleContext(VMCxt, ModName);
WasmEdge_StringDelete(ModName);

Expand Down
2 changes: 1 addition & 1 deletion docs/embed/use-case/plugin/c_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Security is a vital part of any software development process. It involves severa
```c
WasmEdge_Result Add(void *, const WasmEdge_CallingFrameContext *,
const WasmEdge_Value *In, WasmEdge_Value *Out) {
if (In[0].Type != WasmEdge_ValType_I32 || In[1].Type != WasmEdge_ValType_I32) {
return WasmEdge_Result_Error;
if (!WasmEdge_ValTypeIsI32(In[0].Type) || !WasmEdge_ValTypeIsI32(In[1].Type)) {
return WasmEdge_Result_Fail;
}
// Rest of the function...
}
Expand All @@ -93,7 +93,7 @@ Security is a vital part of any software development process. It involves severa
int32_t Val1 = WasmEdge_ValueGetI32(In[0]);
int32_t Val2 = WasmEdge_ValueGetI32(In[1]);
if (Val1 == INT32_MIN || Val2 == INT32_MIN) {
return WasmEdge_Result_Error;
return WasmEdge_Result_Fail;
}
// Rest of the function...
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2788,7 +2788,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2784,7 +2784,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3058,7 +3058,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3147,7 +3147,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3196,7 +3196,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3281,7 +3281,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3194,7 +3194,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ When developers didn't use the VM context to load the plug-ins, they can use the
/* Assume that wasi_crypto plug-in is installed in the default plug-in path. */
WasmEdge_PluginLoadWithDefaultPaths();

WasmEdge_ModuleInstance *WasiCryptoCommonCxt =
WasmEdge_ModuleInstanceContext *WasiCryptoCommonCxt =
WasmEdge_ModuleInstanceCreateWasiCryptoCommon();

WasmEdge_ModuleInstanceDelete(WasiCryptoCommonCxt);
Expand All @@ -146,7 +146,7 @@ WasmEdge_String ModuleName =
WasmEdge_StringWrap(CryptoMName, strlen(CryptoMName));
const WasmEdge_PluginContext *PluginCxt = WasmEdge_PluginFind(PluginName);

WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, ModuleName);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down Expand Up @@ -177,18 +177,18 @@ WasmEdge_VMContext *VMCxt = WasmEdge_VMCreate(Conf, NULL);
WasmEdge_ConfigureDelete(Conf);

/* Get the WASI module instance. */
WasmEdge_ModuleInstance *WASIModInst =
WasmEdge_ModuleInstanceContext *WASIModInst =
WasmEdge_VMGetImportModuleContext(VMCxt, WasmEdge_HostRegistration_Wasi);
/* Get the WASI-crypto-common module instance. */
WasmEdge_ModuleInstance *WASICryptoCommonModInst =
WasmEdge_ModuleInstanceContext *WASICryptoCommonModInst =
WasmEdge_VMGetImportModuleContext(
VMCxt, WasmEdge_HostRegistration_WasiCrypto_Common);

/* Get the registered module instance by name. */
WasmEdge_StoreContext *StoreCxt = WasmEdge_VMGetStoreContext(VMCxt);
WasmEdge_String ModName =
WasmEdge_StringCreateByCString("wasi_ephemeral_crypto_kx");
const WasmEdge_ModuleInstance *WASICryptoKxModInst =
const WasmEdge_ModuleInstanceContext *WASICryptoKxModInst =
WasmEdge_StoreFindModule(StoreCxt, ModName);
WasmEdge_StringDelete(ModName);

Expand All @@ -209,12 +209,12 @@ WasmEdge_VMContext *VMCxt = WasmEdge_VMCreate(Conf, NULL);
WasmEdge_ConfigureDelete(Conf);

/* Get the WASI module instance. */
WasmEdge_ModuleInstance *WASIModInst =
WasmEdge_ModuleInstanceContext *WASIModInst =
WasmEdge_VMGetImportModuleContext(VMCxt, WasmEdge_HostRegistration_Wasi);
/* Get the registered WASI-crypto-common module instance by name. */
WasmEdge_String ModName =
WasmEdge_StringCreateByCString("wasi_ephemeral_crypto_common");
const WasmEdge_ModuleInstance *WASICryptoKxModInst =
const WasmEdge_ModuleInstanceContext *WASICryptoKxModInst =
WasmEdge_VMGetImportModuleContext(VMCxt, ModName);
WasmEdge_StringDelete(ModName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ for (uint32_t I = 0; I < ModuleLen; I++) {
const char ModuleName[] = "wasi_ephemeral_crypto_common";
WasmEdge_String NameString =
WasmEdge_StringWrap(ModuleName, strlen(ModuleName));
WasmEdge_ModuleInstance *ModCxt =
WasmEdge_ModuleInstanceContext *ModCxt =
WasmEdge_PluginCreateModule(PluginCxt, NameString);

WasmEdge_ModuleInstanceDelete(ModCxt);
Expand Down
Loading