Minor Berry fixes (#20799)

This commit is contained in:
s-hadinger 2024-02-24 18:40:16 +01:00 committed by GitHub
parent 4dc827f431
commit 4bc8a41502
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 5 deletions

View File

@ -280,7 +280,7 @@ void be_cb_deinit(bvm *vm) {
for (int32_t slot = 0; slot < BE_MAX_CB; slot++) {
if (be_cb_hooks[slot].vm == vm) {
be_cb_hooks[slot].vm = NULL;
be_cb_hooks[slot].f.type == BE_NIL;
be_cb_hooks[slot].f.type = BE_NIL;
}
}
// remove the vm gen_cb for this vm

View File

@ -12,6 +12,7 @@
#include "be_mapping.h"
#include "be_exec.h"
#include <string.h>
#include <stdlib.h>
typedef intptr_t (*fn_any_callable)(intptr_t p0, intptr_t p1, intptr_t p2, intptr_t p3,
intptr_t p4, intptr_t p5, intptr_t p6, intptr_t p7);
@ -191,13 +192,13 @@ intptr_t be_convert_single_elt(bvm *vm, int idx, const char * arg_type, int *buf
be_pop(vm, 3 + ret);
// berry_log_C("func=%p", func);
return (int32_t) func;
return (intptr_t) func;
} else {
be_raisef(vm, "type_error", "Can't find callback generator: 'cb.make_cb'");
}
} else if (be_iscomptr(vm, idx)) {
// if it's a pointer, just pass it without any change
return (int32_t) be_tocomptr(vm, idx);;
return (intptr_t) be_tocomptr(vm, idx);;
} else {
be_raise(vm, "type_error", "Closure expected for callback type");
}
@ -314,7 +315,7 @@ int be_check_arg_type(bvm *vm, int arg_start, int argc, const char * arg_type, i
p_idx++;
}
for (uint32_t i = 0; i < argc; i++) {
for (int i = 0; i < argc; i++) {
type_short_name[0] = 0; // clear string
// extract individual type
if (arg_type) {

View File

@ -23,6 +23,7 @@
#include "be_mapping.h"
#include "be_exec.h"
#include "be_string.h"
#include "be_module.h"
#include <string.h>
/*********************************************************************************************\
* Takes a pointer to be_const_member_t array and size

View File

@ -23,7 +23,6 @@ typedef const void* be_constptr;
.v.nf = (const void*) &ctype_func_def##_f, \
.type = BE_CTYPE_FUNC \
}
typedef const void* be_constptr;
#define be_const_static_ctype_func(_f) { \
.v.nf = (const void*) &ctype_func_def##_f, \
.type = BE_CTYPE_FUNC | BE_STATIC \