.
This commit is contained in:
parent
7026872240
commit
144312744c
2 changed files with 28 additions and 15 deletions
22
colla.c
22
colla.c
|
|
@ -961,6 +961,10 @@ 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);
|
||||||
|
|
@ -1112,7 +1116,6 @@ bool glob__match_here(instream_t *g, instream_t *t);
|
||||||
|
|
||||||
bool glob__match_star(instream_t *g, instream_t *t) {
|
bool glob__match_star(instream_t *g, instream_t *t) {
|
||||||
char c = istr_get(g);
|
char c = istr_get(g);
|
||||||
char n = istr_peek(g);
|
|
||||||
do {
|
do {
|
||||||
if (istr_get(t) == c) {
|
if (istr_get(t) == c) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1475,6 +1478,10 @@ 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};
|
||||||
}
|
}
|
||||||
|
|
@ -1612,13 +1619,20 @@ 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;
|
||||||
|
|
@ -1803,6 +1817,7 @@ 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);
|
||||||
|
|
||||||
|
|
@ -1843,6 +1858,7 @@ 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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_read;
|
options->in->data = (uptr)hstdin_write;
|
||||||
SetHandleInformation(hstdin_write, HANDLE_FLAG_INHERIT, 0);
|
SetHandleInformation(hstdin_write, HANDLE_FLAG_INHERIT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -839,17 +839,11 @@ oshandle_t os_run_cmd_async(arena_t scratch, os_cmd_t *cmd, os_cmd_options_t *op
|
||||||
&proc_info
|
&proc_info
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hstdout_write) {
|
#define CLOSE_IF(x) if (x) CloseHandle(x)
|
||||||
CloseHandle(hstdout_write);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hstderr_write) {
|
CLOSE_IF(hstdout_write);
|
||||||
CloseHandle(hstderr_write);
|
CLOSE_IF(hstderr_write);
|
||||||
}
|
CLOSE_IF(hstdin_read);
|
||||||
|
|
||||||
if (hstdin_read) {
|
|
||||||
CloseHandle(hstdin_read);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (env) {
|
if (env) {
|
||||||
FreeEnvironmentStringsW(env);
|
FreeEnvironmentStringsW(env);
|
||||||
|
|
@ -858,10 +852,13 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(proc_info.hThread);
|
CLOSE_IF(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