mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 00:08:30 +00:00
Freshen build/bootstrap/cocmd
See https://news.ycombinator.com/item?id=41055121
This commit is contained in:
parent
8621034d42
commit
e18fe1e112
11 changed files with 15 additions and 18 deletions
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/createfileflags.internal.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/sig.internal.h"
|
||||
|
@ -155,11 +156,11 @@ static textwindows void FreeKeystrokeImpl(struct Dll *key) {
|
|||
|
||||
static textwindows struct Keystroke *NewKeystroke(void) {
|
||||
struct Dll *e = dll_first(__keystroke.free);
|
||||
if (!e) // See MIN(freekeys) before ReadConsoleInput()
|
||||
__builtin_trap();
|
||||
struct Keystroke *k = KEYSTROKE_CONTAINER(e);
|
||||
dll_remove(&__keystroke.free, &k->elem);
|
||||
--__keystroke.freekeys;
|
||||
// TODO(jart): What's wrong with GCC 12.3?
|
||||
asm("" : "+r"(k));
|
||||
k->buflen = 0;
|
||||
return k;
|
||||
}
|
||||
|
@ -560,18 +561,15 @@ static textwindows void IngestConsoleInput(void) {
|
|||
return;
|
||||
if (__keystroke.end_of_file)
|
||||
return;
|
||||
if (!GetNumberOfConsoleInputEvents(__keystroke.cin, &n)) {
|
||||
if (!GetNumberOfConsoleInputEvents(__keystroke.cin, &n))
|
||||
goto UnexpectedEof;
|
||||
}
|
||||
if (!n)
|
||||
return;
|
||||
n = MIN(__keystroke.freekeys, MIN(ARRAYLEN(records), n));
|
||||
if (!ReadConsoleInput(__keystroke.cin, records, n, &n)) {
|
||||
if (!ReadConsoleInput(__keystroke.cin, records, n, &n))
|
||||
goto UnexpectedEof;
|
||||
}
|
||||
for (i = 0; i < n && !__keystroke.end_of_file; ++i) {
|
||||
for (i = 0; i < n && !__keystroke.end_of_file; ++i)
|
||||
IngestConsoleInputRecord(records + i);
|
||||
}
|
||||
}
|
||||
UnexpectedEof:
|
||||
STRACE("console read error %d", GetLastError());
|
||||
|
|
|
@ -38,7 +38,7 @@ size_t wcsnrtombs(char *dst, const wchar_t **wcs, size_t wn, size_t n,
|
|||
if (!dst)
|
||||
n = 0;
|
||||
while (ws && wn) {
|
||||
char tmp[MB_LEN_MAX];
|
||||
char tmp[MB_LEN_MAX] = {0};
|
||||
size_t l = wcrtomb(n < MB_LEN_MAX ? tmp : dst, *ws, 0);
|
||||
if (l == -1) {
|
||||
cnt = -1;
|
||||
|
|
|
@ -128,8 +128,8 @@ wontreturn void pthread_exit(void *rc) {
|
|||
// implementation called exit() with a zero argument at thread
|
||||
// termination time." ──Quoth POSIX.1-2017
|
||||
if (orphan) {
|
||||
for (const uintptr_t *p = __fini_array_end; p > __fini_array_start;)
|
||||
((void (*)(void))(*--p))();
|
||||
for (int i = __fini_array_end - __fini_array_start; i--;)
|
||||
((void (*)(void))__fini_array_start[i])();
|
||||
_Exit(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue