Fix issues reported by klocwork (#1060)

Fix issues reported by klocwork, fix host_tool compile error,
and update build script of benchmark jetstream
This commit is contained in:
Wenyong Huang
2022-03-24 17:34:22 +08:00
committed by GitHub
parent 7262aebf77
commit 5264ce4118
7 changed files with 31 additions and 13 deletions

View File

@ -15,6 +15,10 @@ void print_mutability(wasm_mutability_t mut) {
}
void print_limits(const wasm_limits_t* limits) {
if (!limits) {
printf("unknown limits");
return;
}
printf("%ud", limits->min);
if (limits->max < wasm_limits_max_default) printf(" %ud", limits->max);
}
@ -43,6 +47,10 @@ void print_valtypes(const wasm_valtype_vec_t* types) {
}
void print_externtype(const wasm_externtype_t* type) {
if (!type) {
printf("unknown extern type");
return;
}
switch (wasm_externtype_kind(type)) {
case WASM_EXTERN_FUNC: {
const wasm_functype_t* functype =
@ -78,6 +86,10 @@ void print_externtype(const wasm_externtype_t* type) {
}
void print_name(const wasm_name_t* name) {
if (!name) {
printf("unknown name");
return;
}
printf("\"%.*s\"", (int)name->size, name->data);
}