1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 17:27:18 +00:00

Fix some formatting and undefined behavior.

This commit is contained in:
Calvin Rose 2020-12-06 14:33:08 -06:00
parent 785757f2f6
commit aa0de01e5f
3 changed files with 25 additions and 25 deletions

View File

@ -775,15 +775,15 @@ void janet_loop1(void) {
/* This is a deadline (for a fiber, not a function call) */
JanetFiberStatus s = janet_fiber_status(to.curr_fiber);
int isFinished = s == (JANET_STATUS_DEAD ||
s == JANET_STATUS_ERROR ||
s == JANET_STATUS_USER0 ||
s == JANET_STATUS_USER1 ||
s == JANET_STATUS_USER2 ||
s == JANET_STATUS_USER3 ||
s == JANET_STATUS_USER4);
if (!isFinished) {
janet_cancel(to.fiber, janet_cstringv("deadline expired"));
}
s == JANET_STATUS_ERROR ||
s == JANET_STATUS_USER0 ||
s == JANET_STATUS_USER1 ||
s == JANET_STATUS_USER2 ||
s == JANET_STATUS_USER3 ||
s == JANET_STATUS_USER4);
if (!isFinished) {
janet_cancel(to.fiber, janet_cstringv("deadline expired"));
}
} else {
/* This is a timeout (for a function call, not a whole fiber) */
if (to.fiber->sched_id == to.sched_id) {

View File

@ -286,7 +286,7 @@ static void marshal_one_def(MarshalState *st, JanetFuncDef *def, int flags) {
#define JANET_FIBER_FLAG_HASCHILD (1 << 29)
#define JANET_FIBER_FLAG_HASENV (1 << 30)
#define JANET_STACKFRAME_HASENV (1 << 31)
#define JANET_STACKFRAME_HASENV (INT32_MIN)
/* Marshal a fiber */
static void marshal_one_fiber(MarshalState *st, JanetFiber *fiber, int flags) {

View File

@ -126,21 +126,21 @@ https://github.com/antirez/linenoise/blob/master/linenoise.c
#define JANET_LINE_MAX 1024
#define JANET_MATCH_MAX 256
#define JANET_HISTORY_MAX 100
JANET_THREAD_LOCAL static int gbl_israwmode = 0;
JANET_THREAD_LOCAL static const char *gbl_prompt = "> ";
JANET_THREAD_LOCAL static int gbl_plen = 2;
JANET_THREAD_LOCAL static char gbl_buf[JANET_LINE_MAX];
JANET_THREAD_LOCAL static int gbl_len = 0;
JANET_THREAD_LOCAL static int gbl_pos = 0;
JANET_THREAD_LOCAL static int gbl_cols = 80;
JANET_THREAD_LOCAL static char *gbl_history[JANET_HISTORY_MAX];
JANET_THREAD_LOCAL static int gbl_history_count = 0;
JANET_THREAD_LOCAL static int gbl_historyi = 0;
JANET_THREAD_LOCAL static int gbl_sigint_flag = 0;
JANET_THREAD_LOCAL static struct termios gbl_termios_start;
JANET_THREAD_LOCAL static JanetByteView gbl_matches[JANET_MATCH_MAX];
JANET_THREAD_LOCAL static int gbl_match_count = 0;
JANET_THREAD_LOCAL static int gbl_lines_below = 0;
static JANET_THREAD_LOCAL int gbl_israwmode = 0;
static JANET_THREAD_LOCAL const char *gbl_prompt = "> ";
static JANET_THREAD_LOCAL int gbl_plen = 2;
static JANET_THREAD_LOCAL char gbl_buf[JANET_LINE_MAX];
static JANET_THREAD_LOCAL int gbl_len = 0;
static JANET_THREAD_LOCAL int gbl_pos = 0;
static JANET_THREAD_LOCAL int gbl_cols = 80;
static JANET_THREAD_LOCAL char *gbl_history[JANET_HISTORY_MAX];
static JANET_THREAD_LOCAL int gbl_history_count = 0;
static JANET_THREAD_LOCAL int gbl_historyi = 0;
static JANET_THREAD_LOCAL int gbl_sigint_flag = 0;
static JANET_THREAD_LOCAL struct termios gbl_termios_start;
static JANET_THREAD_LOCAL JanetByteView gbl_matches[JANET_MATCH_MAX];
static JANET_THREAD_LOCAL int gbl_match_count = 0;
static JANET_THREAD_LOCAL int gbl_lines_below = 0;
/* Unsupported terminal list from linenoise */
static const char *badterms[] = {