Compare commits
No commits in common. "603b5a4cb6165ca6f4ef051700456fbb34790911" and "e0dc93f61d1983687941293fdc1fccf90a766c0d" have entirely different histories.
603b5a4cb6
...
e0dc93f61d
4 changed files with 14 additions and 38 deletions
21
colla.c
21
colla.c
|
|
@ -961,10 +961,6 @@ bool rg__match_here(instream_t r, instream_t t) {
|
||||||
if (rc == '$' && rcn == '\0') {
|
if (rc == '$' && rcn == '\0') {
|
||||||
return istr_peek(&t) == '\0';
|
return istr_peek(&t) == '\0';
|
||||||
}
|
}
|
||||||
// if (rc == '\\') {
|
|
||||||
// istr_skip(&r, 1);
|
|
||||||
// return istr_peek(&r) == istr_peek(&t);
|
|
||||||
// }
|
|
||||||
if (!istr_is_finished(&t) && (rc == '.' || rc == istr_peek(&t))) {
|
if (!istr_is_finished(&t) && (rc == '.' || rc == istr_peek(&t))) {
|
||||||
istr_skip(&r, 1);
|
istr_skip(&r, 1);
|
||||||
istr_skip(&t, 1);
|
istr_skip(&t, 1);
|
||||||
|
|
@ -1479,10 +1475,6 @@ static arena_t arena__make_static(u8 *buf, usize len) {
|
||||||
|
|
||||||
// == HANDLE ====================================
|
// == HANDLE ====================================
|
||||||
|
|
||||||
str_t os_get_last_error_string(void) {
|
|
||||||
return os_get_error_string(os_get_last_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
oshandle_t os_handle_zero(void) {
|
oshandle_t os_handle_zero(void) {
|
||||||
return (oshandle_t){0};
|
return (oshandle_t){0};
|
||||||
}
|
}
|
||||||
|
|
@ -1620,20 +1612,13 @@ void os_log_printv(const char *file, int line, os_log_level_e level, const char
|
||||||
log_event_t ev = {
|
log_event_t ev = {
|
||||||
.level = level,
|
.level = level,
|
||||||
.line = line,
|
.line = line,
|
||||||
// .args = args,
|
.args = args,
|
||||||
.fmt = fmt,
|
.fmt = fmt,
|
||||||
.file = file,
|
.file = file,
|
||||||
// .time = &log_time,
|
.time = &log_time,
|
||||||
};
|
};
|
||||||
|
|
||||||
va_copy(ev.args, args);
|
|
||||||
|
|
||||||
#if COLLA_WIN
|
|
||||||
localtime_s(&log_time, &t);
|
localtime_s(&log_time, &t);
|
||||||
ev.time = &log_time;
|
|
||||||
#else
|
|
||||||
ev.time = localtime(&t);
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i < os__log_cbs_count; ++i) {
|
for (int i = 0; i < os__log_cbs_count; ++i) {
|
||||||
if (os__log_cbs[i].level > level) {
|
if (os__log_cbs[i].level > level) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1818,7 +1803,6 @@ usize os_pad_to_page(usize byte_count) {
|
||||||
|
|
||||||
// == THREAD ====================================
|
// == THREAD ====================================
|
||||||
|
|
||||||
#if !COLLA_NO_ATOMICS
|
|
||||||
void os_barrier_sync(os_barrier_t *b) {
|
void os_barrier_sync(os_barrier_t *b) {
|
||||||
atomic_inc_i64(&b->thread_value);
|
atomic_inc_i64(&b->thread_value);
|
||||||
|
|
||||||
|
|
@ -1859,7 +1843,6 @@ i64range_t os_lane_range(u64 values_count) {
|
||||||
|
|
||||||
return (i64range_t){ thread_first_value, thread_last_value };
|
return (i64range_t){ thread_first_value, thread_last_value };
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !COLLA_NO_CONDITION_VARIABLE
|
#if !COLLA_NO_CONDITION_VARIABLE
|
||||||
|
|
||||||
|
|
|
||||||
6
colla.h
6
colla.h
|
|
@ -331,8 +331,6 @@ for_each (chunk, arr) {
|
||||||
(arr)->items[(arr)->count++] = (item); \
|
(arr)->items[(arr)->count++] = (item); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define darr_pop(arr) if ((arr) && (arr)->count) --(arr)->count
|
|
||||||
|
|
||||||
// STRING TYPES /////////////////////////////////
|
// STRING TYPES /////////////////////////////////
|
||||||
|
|
||||||
#define STR_NONE SIZE_MAX
|
#define STR_NONE SIZE_MAX
|
||||||
|
|
@ -735,7 +733,6 @@ void os_abort(int code);
|
||||||
iptr os_get_last_error(void);
|
iptr os_get_last_error(void);
|
||||||
// NOT thread safe
|
// NOT thread safe
|
||||||
str_t os_get_error_string(iptr error);
|
str_t os_get_error_string(iptr error);
|
||||||
str_t os_get_last_error_string(void);
|
|
||||||
|
|
||||||
// == HANDLE ====================================
|
// == HANDLE ====================================
|
||||||
|
|
||||||
|
|
@ -1053,8 +1050,6 @@ job_t *jq_pop_job(job_queue_t *queue);
|
||||||
|
|
||||||
// == ATOMICS ========================================
|
// == ATOMICS ========================================
|
||||||
|
|
||||||
#if !COLLA_NO_ATOMICS
|
|
||||||
|
|
||||||
i64 atomic_set_i64(i64 *dest, i64 val);
|
i64 atomic_set_i64(i64 *dest, i64 val);
|
||||||
i64 atomic_add_i64(i64 *dest, i64 val);
|
i64 atomic_add_i64(i64 *dest, i64 val);
|
||||||
i64 atomic_and_i64(i64 *dest, i64 val);
|
i64 atomic_and_i64(i64 *dest, i64 val);
|
||||||
|
|
@ -1064,7 +1059,6 @@ i64 atomic_inc_i64(i64 *dest);
|
||||||
i64 atomic_dec_i64(i64 *dest);
|
i64 atomic_dec_i64(i64 *dest);
|
||||||
i64 atomic_or_i64(i64 *dest, i64 val);
|
i64 atomic_or_i64(i64 *dest, i64 val);
|
||||||
i64 atomic_xor_i64(i64 *dest, i64 val);
|
i64 atomic_xor_i64(i64 *dest, i64 val);
|
||||||
#endif
|
|
||||||
|
|
||||||
// PARSERS //////////////////////////////////////
|
// PARSERS //////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@
|
||||||
#define ntohll(x) be64toh(x)
|
#define ntohll(x) be64toh(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void os__log_init(void);
|
|
||||||
|
|
||||||
strview_t os__fg_colours[LOG_COL__COUNT] = {
|
strview_t os__fg_colours[LOG_COL__COUNT] = {
|
||||||
[LOG_COL_BLACK] = cstrv("\x1b[30m"),
|
[LOG_COL_BLACK] = cstrv("\x1b[30m"),
|
||||||
[LOG_COL_BLUE] = cstrv("\x1b[34m"),
|
[LOG_COL_BLUE] = cstrv("\x1b[34m"),
|
||||||
|
|
@ -134,8 +132,6 @@ void os_init(void) {
|
||||||
struct utsname name = {0};
|
struct utsname name = {0};
|
||||||
uname(&name);
|
uname(&name);
|
||||||
lin_data.info.machine_name = str(&lin_data.arena, name.nodename);
|
lin_data.info.machine_name = str(&lin_data.arena, name.nodename);
|
||||||
|
|
||||||
os__log_init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void os_cleanup(void) {
|
void os_cleanup(void) {
|
||||||
|
|
|
||||||
|
|
@ -789,7 +789,7 @@ oshandle_t os_run_cmd_async(arena_t scratch, os_cmd_t *cmd, os_cmd_options_t *op
|
||||||
|
|
||||||
if (options && options->in) {
|
if (options && options->in) {
|
||||||
CreatePipe(&hstdin_read, &hstdin_write, &sa_attr, 0);
|
CreatePipe(&hstdin_read, &hstdin_write, &sa_attr, 0);
|
||||||
options->in->data = (uptr)hstdin_write;
|
options->in->data = (uptr)hstdin_read;
|
||||||
SetHandleInformation(hstdin_write, HANDLE_FLAG_INHERIT, 0);
|
SetHandleInformation(hstdin_write, HANDLE_FLAG_INHERIT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -839,11 +839,17 @@ oshandle_t os_run_cmd_async(arena_t scratch, os_cmd_t *cmd, os_cmd_options_t *op
|
||||||
&proc_info
|
&proc_info
|
||||||
);
|
);
|
||||||
|
|
||||||
#define CLOSE_IF(x) if (x) CloseHandle(x)
|
if (hstdout_write) {
|
||||||
|
CloseHandle(hstdout_write);
|
||||||
|
}
|
||||||
|
|
||||||
CLOSE_IF(hstdout_write);
|
if (hstderr_write) {
|
||||||
CLOSE_IF(hstderr_write);
|
CloseHandle(hstderr_write);
|
||||||
CLOSE_IF(hstdin_read);
|
}
|
||||||
|
|
||||||
|
if (hstdin_read) {
|
||||||
|
CloseHandle(hstdin_read);
|
||||||
|
}
|
||||||
|
|
||||||
if (env) {
|
if (env) {
|
||||||
FreeEnvironmentStringsW(env);
|
FreeEnvironmentStringsW(env);
|
||||||
|
|
@ -852,13 +858,10 @@ oshandle_t os_run_cmd_async(arena_t scratch, os_cmd_t *cmd, os_cmd_options_t *op
|
||||||
|
|
||||||
if (!success && !quiet) {
|
if (!success && !quiet) {
|
||||||
err("couldn't create process (%v): %v", cmd_str, os_get_error_string(os_get_last_error()));
|
err("couldn't create process (%v): %v", cmd_str, os_get_error_string(os_get_last_error()));
|
||||||
CLOSE_IF(hstdout_read);
|
|
||||||
CLOSE_IF(hstderr_read);
|
|
||||||
CLOSE_IF(hstdin_write);
|
|
||||||
return os_handle_zero();
|
return os_handle_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
CLOSE_IF(proc_info.hThread);
|
CloseHandle(proc_info.hThread);
|
||||||
|
|
||||||
return (oshandle_t) {
|
return (oshandle_t) {
|
||||||
.data = (uptr)proc_info.hProcess
|
.data = (uptr)proc_info.hProcess
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue