Merge commit 'dbf937541ebc5a8bfdbdce9721260dd1ad4408c3'

This commit is contained in:
Benjamin Vedder 2023-02-16 15:49:10 +01:00
commit 4fd68c4c10
3 changed files with 26 additions and 15 deletions

View File

@ -235,6 +235,7 @@ static bool event_internal(lbm_event_type_t event_type, lbm_uint parameter, lbm_
event.buf_len = buf_len;
lbm_events[lbm_events_head] = event;
lbm_events_head = (lbm_events_head + 1) % lbm_events_max;
lbm_events_full = lbm_events_head == lbm_events_tail;
mutex_unlock(&lbm_events_mutex);
return true;
}
@ -3261,8 +3262,6 @@ static void process_events(void) {
case LBM_EVENT_FOR_HANDLER:
if (lbm_event_handler_pid >= 0) {
lbm_find_receiver_and_send(lbm_event_handler_pid, event_val);
} else {
}
break;
}

View File

@ -583,15 +583,29 @@ static lbm_value fundamental_add(lbm_value *args, lbm_uint nargs, eval_context_t
static lbm_value fundamental_sub(lbm_value *args, lbm_uint nargs, eval_context_t *ctx) {
(void) ctx;
lbm_uint res = nargs == 0 ? lbm_enc_u(0) : args[0];
if (nargs == 1) {
res = negate(res);
} else {
for (lbm_uint i = 1; i < nargs; i ++) {
res = sub2(res, args[i]);
if (lbm_type_of(res) == LBM_TYPE_SYMBOL)
break;
}
lbm_uint res;
switch (nargs) {
case 0:
res = lbm_enc_u(0);
break;
case 1:
res = negate(args[0]);
break;
case 2:
res = sub2(args[0], args[1]);
break;
default:
res = args[0];
for (lbm_uint i = 1; i < nargs; i ++) {
res = sub2(res, args[i]);
if (lbm_type_of(res) == LBM_TYPE_SYMBOL)
break;
}
break;
}
return res;
}

View File

@ -204,8 +204,7 @@ static bool extract_dword(lbm_flat_value_t *v, uint64_t *r) {
return false;
}
#define UNFLATTEN_MALFORMED -3
#define UNFLATTEN_OUT_OF_MEMORY -2
#define UNFLATTEN_MALFORMED -2
#define UNFLATTEN_GC_RETRY -1
#define UNFLATTEN_OK 0
@ -375,8 +374,7 @@ bool lbm_unflatten_value(lbm_flat_value_t *v, lbm_value *res) {
}
if (r == UNFLATTEN_MALFORMED) {
*res = ENC_SYM_EERROR;
} else if (r == UNFLATTEN_OUT_OF_MEMORY ||
r == UNFLATTEN_GC_RETRY) {
} else if (r == UNFLATTEN_GC_RETRY) {
*res = ENC_SYM_MERROR;
} else {
b = true;