mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Remove bool from public headers
This commit is contained in:
parent
dffee606cf
commit
1351d3cede
55 changed files with 105 additions and 98 deletions
|
@ -19,6 +19,7 @@
|
||||||
#include "dsp/tty/tty.h"
|
#include "dsp/tty/tty.h"
|
||||||
#include "libc/mem/arraylist2.internal.h"
|
#include "libc/mem/arraylist2.internal.h"
|
||||||
#include "libc/mem/gc.internal.h"
|
#include "libc/mem/gc.internal.h"
|
||||||
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/x/x.h"
|
#include "libc/x/x.h"
|
||||||
|
|
||||||
/* TODO(jart): DELETE */
|
/* TODO(jart): DELETE */
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "libc/calls/struct/sigval.h"
|
#include "libc/calls/struct/sigval.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
#include "libc/stdbool.h"
|
||||||
|
|
||||||
#define kSigactionMinRva 8 /* >SIG_{ERR,DFL,IGN,...} */
|
#define kSigactionMinRva 8 /* >SIG_{ERR,DFL,IGN,...} */
|
||||||
|
|
||||||
|
@ -46,6 +47,12 @@ int _park_norestart(uint32_t, uint64_t);
|
||||||
int _park_restartable(uint32_t, uint64_t);
|
int _park_restartable(uint32_t, uint64_t);
|
||||||
int sys_openat_metal(int, const char *, int, unsigned);
|
int sys_openat_metal(int, const char *, int, unsigned);
|
||||||
|
|
||||||
|
#ifdef __x86_64__
|
||||||
|
bool __iswsl1(void);
|
||||||
|
#else
|
||||||
|
#define __iswsl1() false
|
||||||
|
#endif
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||||
#endif /* COSMOPOLITAN_LIBC_CALLS_INTERNAL_H_ */
|
#endif /* COSMOPOLITAN_LIBC_CALLS_INTERNAL_H_ */
|
||||||
|
|
|
@ -119,12 +119,6 @@ COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
extern const int __hostos;
|
extern const int __hostos;
|
||||||
|
|
||||||
#ifdef __x86_64__
|
|
||||||
bool __iswsl1(void);
|
|
||||||
#else
|
|
||||||
#define __iswsl1() false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||||
#endif /* _COSMO_SOURCE */
|
#endif /* _COSMO_SOURCE */
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "libc/dns/hoststxt.h"
|
#include "libc/dns/hoststxt.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
#include "libc/mem/arraylist.internal.h"
|
#include "libc/mem/arraylist.internal.h"
|
||||||
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/sock/sock.h"
|
#include "libc/sock/sock.h"
|
||||||
#include "libc/stdio/stdio.h"
|
#include "libc/stdio/stdio.h"
|
||||||
|
|
|
@ -12,8 +12,8 @@ COSMOPOLITAN_C_START_
|
||||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
||||||
bool IsElfSymbolContent(const Elf64_Sym *);
|
bool32 IsElfSymbolContent(const Elf64_Sym *);
|
||||||
bool IsElf64Binary(const Elf64_Ehdr *, size_t);
|
bool32 IsElf64Binary(const Elf64_Ehdr *, size_t);
|
||||||
char *GetElfStringTable(const Elf64_Ehdr *, size_t, const char *);
|
char *GetElfStringTable(const Elf64_Ehdr *, size_t, const char *);
|
||||||
Elf64_Sym *GetElfSymbols(const Elf64_Ehdr *, size_t, int, Elf64_Xword *);
|
Elf64_Sym *GetElfSymbols(const Elf64_Ehdr *, size_t, int, Elf64_Xword *);
|
||||||
Elf64_Shdr *GetElfSymbolTable(const Elf64_Ehdr *, size_t, int, Elf64_Xword *);
|
Elf64_Shdr *GetElfSymbolTable(const Elf64_Ehdr *, size_t, int, Elf64_Xword *);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
* @param mapsize is the number of bytes past `elf` we can access
|
* @param mapsize is the number of bytes past `elf` we can access
|
||||||
* @return true if elf header looks legit
|
* @return true if elf header looks legit
|
||||||
*/
|
*/
|
||||||
bool IsElf64Binary(const Elf64_Ehdr *elf, size_t mapsize) {
|
bool32 IsElf64Binary(const Elf64_Ehdr *elf, size_t mapsize) {
|
||||||
if (mapsize < sizeof(Elf64_Ehdr)) return false;
|
if (mapsize < sizeof(Elf64_Ehdr)) return false;
|
||||||
if (READ32LE(elf->e_ident) != READ32LE(ELFMAG)) return false;
|
if (READ32LE(elf->e_ident) != READ32LE(ELFMAG)) return false;
|
||||||
return elf->e_ident[EI_CLASS] != ELFCLASS32;
|
return elf->e_ident[EI_CLASS] != ELFCLASS32;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "libc/elf/def.h"
|
#include "libc/elf/def.h"
|
||||||
#include "libc/elf/elf.h"
|
#include "libc/elf/elf.h"
|
||||||
|
|
||||||
bool IsElfSymbolContent(const Elf64_Sym *sym) {
|
bool32 IsElfSymbolContent(const Elf64_Sym *sym) {
|
||||||
return sym->st_size > 0 && (ELF64_ST_TYPE(sym->st_info) == STT_FUNC ||
|
return sym->st_size > 0 && (ELF64_ST_TYPE(sym->st_info) == STT_FUNC ||
|
||||||
ELF64_ST_TYPE(sym->st_info) == STT_OBJECT);
|
ELF64_ST_TYPE(sym->st_info) == STT_OBJECT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @param z ensures it starts with zero
|
* @param z ensures it starts with zero
|
||||||
* @return pointer to nul byte
|
* @return pointer to nul byte
|
||||||
*/
|
*/
|
||||||
char *FormatOctal64(char p[hasatleast 24], uint64_t x, bool z) {
|
char *FormatOctal64(char p[hasatleast 24], uint64_t x, bool32 z) {
|
||||||
char t;
|
char t;
|
||||||
size_t i, a, b;
|
size_t i, a, b;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
|
@ -33,8 +33,8 @@ char *FormatInt64(char[hasatleast 21], int64_t);
|
||||||
char *FormatUint64(char[hasatleast 21], uint64_t);
|
char *FormatUint64(char[hasatleast 21], uint64_t);
|
||||||
char *FormatInt64Thousands(char[hasatleast 27], int64_t);
|
char *FormatInt64Thousands(char[hasatleast 27], int64_t);
|
||||||
char *FormatUint64Thousands(char[hasatleast 27], uint64_t);
|
char *FormatUint64Thousands(char[hasatleast 27], uint64_t);
|
||||||
char *FormatOctal32(char[hasatleast 13], uint32_t, bool);
|
char *FormatOctal32(char[hasatleast 13], uint32_t, bool32);
|
||||||
char *FormatOctal64(char[hasatleast 24], uint64_t, bool);
|
char *FormatOctal64(char[hasatleast 24], uint64_t, bool32);
|
||||||
char *FormatBinary64(char[hasatleast 67], uint64_t, char);
|
char *FormatBinary64(char[hasatleast 67], uint64_t, char);
|
||||||
char *FormatHex64(char[hasatleast 19], uint64_t, char);
|
char *FormatHex64(char[hasatleast 19], uint64_t, char);
|
||||||
char *FormatFlex64(char[hasatleast 24], int64_t, char);
|
char *FormatFlex64(char[hasatleast 24], int64_t, char);
|
||||||
|
|
|
@ -7,7 +7,7 @@ COSMOPOLITAN_C_START_
|
||||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(__x86__)
|
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(__x86__)
|
||||||
#define _cmpxchg(IFTHING, ISEQUALTOME, REPLACEITWITHME) \
|
#define _cmpxchg(IFTHING, ISEQUALTOME, REPLACEITWITHME) \
|
||||||
({ \
|
({ \
|
||||||
bool DidIt; \
|
bool32 DidIt; \
|
||||||
autotype(IFTHING) IfThing = (IFTHING); \
|
autotype(IFTHING) IfThing = (IFTHING); \
|
||||||
typeof(*IfThing) IsEqualToMe = (ISEQUALTOME); \
|
typeof(*IfThing) IsEqualToMe = (ISEQUALTOME); \
|
||||||
typeof(*IfThing) ReplaceItWithMe = (REPLACEITWITHME); \
|
typeof(*IfThing) ReplaceItWithMe = (REPLACEITWITHME); \
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @param z ensures it starts with zero
|
* @param z ensures it starts with zero
|
||||||
* @return pointer to nul byte
|
* @return pointer to nul byte
|
||||||
*/
|
*/
|
||||||
char *FormatOctal32(char p[hasatleast 13], uint32_t x, bool z) {
|
char *FormatOctal32(char p[hasatleast 13], uint32_t x, bool32 z) {
|
||||||
char t;
|
char t;
|
||||||
size_t i, a, b;
|
size_t i, a, b;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/nt/version.h"
|
#include "libc/nt/version.h"
|
||||||
|
|
||||||
bool(IsAtLeastWindows10)(void) {
|
bool32(IsAtLeastWindows10)(void) {
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
return IsAtLeastWindows10();
|
return IsAtLeastWindows10();
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
bool IsCygwin(void) {
|
bool32 IsCygwin(void) {
|
||||||
return IsGenuineBlink() && !strcmp(GetCpuidOs(), "Cygwin");
|
return IsGenuineBlink() && !strcmp(GetCpuidOs(), "Cygwin");
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ static textwindows bool IsBeingDebugged(void) {
|
||||||
* Determines if gdb, strace, windbg, etc. is controlling process.
|
* Determines if gdb, strace, windbg, etc. is controlling process.
|
||||||
* @return non-zero if attached, otherwise 0
|
* @return non-zero if attached, otherwise 0
|
||||||
*/
|
*/
|
||||||
int IsDebuggerPresent(bool force) {
|
bool32 IsDebuggerPresent(bool32 force) {
|
||||||
/* asan runtime depends on this function */
|
/* asan runtime depends on this function */
|
||||||
ssize_t got;
|
ssize_t got;
|
||||||
int e, fd, res;
|
int e, fd, res;
|
||||||
|
|
|
@ -20,6 +20,6 @@
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
bool IsGenuineBlink(void) {
|
bool32 IsGenuineBlink(void) {
|
||||||
return X86_HAVE(HYPERVISOR) && !strcmp(GetCpuidEmulator(), "GenuineBlink");
|
return X86_HAVE(HYPERVISOR) && !strcmp(GetCpuidEmulator(), "GenuineBlink");
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
#include "libc/log/log.h"
|
#include "libc/log/log.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
|
|
||||||
bool g_isrunningundermake;
|
bool32 g_isrunningundermake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if current process was spawned by GNU Make.
|
* Returns true if current process was spawned by GNU Make.
|
||||||
*/
|
*/
|
||||||
bool IsRunningUnderMake(void) {
|
bool32 IsRunningUnderMake(void) {
|
||||||
return g_isrunningundermake;
|
return g_isrunningundermake;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,4 +25,4 @@
|
||||||
* server is a good idea since it'll ask the C runtime to not pull
|
* server is a good idea since it'll ask the C runtime to not pull
|
||||||
* magical stunts like attaching GDB to the process on crash.
|
* magical stunts like attaching GDB to the process on crash.
|
||||||
*/
|
*/
|
||||||
bool __isworker;
|
bool32 __isworker;
|
||||||
|
|
|
@ -204,7 +204,7 @@ privileged static bool kismapped(int x) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
privileged bool kisdangerous(const void *p) {
|
privileged bool32 kisdangerous(const void *p) {
|
||||||
int frame;
|
int frame;
|
||||||
if (kisimagepointer(p)) return false;
|
if (kisimagepointer(p)) return false;
|
||||||
if (kiskernelpointer(p)) return false;
|
if (kiskernelpointer(p)) return false;
|
||||||
|
|
|
@ -21,7 +21,7 @@ size_t ksnprintf(char *, size_t, const char *, ...);
|
||||||
void kvprintf(const char *, va_list);
|
void kvprintf(const char *, va_list);
|
||||||
size_t kvsnprintf(char *, size_t, const char *, va_list);
|
size_t kvsnprintf(char *, size_t, const char *, va_list);
|
||||||
|
|
||||||
bool kisdangerous(const void *);
|
bool32 kisdangerous(const void *);
|
||||||
|
|
||||||
void klog(const char *, size_t);
|
void klog(const char *, size_t);
|
||||||
void _klog_serial(const char *, size_t);
|
void _klog_serial(const char *, size_t);
|
||||||
|
@ -33,13 +33,13 @@ void uvprintf(const char *, va_list);
|
||||||
#ifndef TINY
|
#ifndef TINY
|
||||||
#define KINFOF(FMT, ...) \
|
#define KINFOF(FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
uprintf("\r\e[35m%s:%d: " FMT "\e[0m\n", \
|
uprintf("\r\e[35m%s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
|
||||||
__FILE__, __LINE__, ## __VA_ARGS__); \
|
##__VA_ARGS__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define KWARNF(FMT, ...) \
|
#define KWARNF(FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
uprintf("\r\e[94;49mwarn: %s:%d: " FMT "\e[0m\n", \
|
uprintf("\r\e[94;49mwarn: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
|
||||||
__FILE__, __LINE__, ## __VA_ARGS__); \
|
##__VA_ARGS__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define KINFOF(FMT, ...) ((void)0)
|
#define KINFOF(FMT, ...) ((void)0)
|
||||||
|
@ -47,8 +47,8 @@ void uvprintf(const char *, va_list);
|
||||||
#endif
|
#endif
|
||||||
#define KDIEF(FMT, ...) \
|
#define KDIEF(FMT, ...) \
|
||||||
do { \
|
do { \
|
||||||
kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", \
|
kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
|
||||||
__FILE__, __LINE__, ## __VA_ARGS__); \
|
##__VA_ARGS__); \
|
||||||
for (;;) asm volatile("cli\n\thlt"); \
|
for (;;) asm volatile("cli\n\thlt"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#ifndef _COSMO_H
|
#ifndef _COSMO_H
|
||||||
#define _COSMO_H
|
#define _COSMO_H
|
||||||
#include "libc/stdbool.h"
|
|
||||||
|
|
||||||
#ifdef _COSMO_SOURCE
|
#ifdef _COSMO_SOURCE
|
||||||
#define COSMO_ALREADY_DEFINED
|
#define COSMO_ALREADY_DEFINED
|
||||||
|
@ -24,7 +23,7 @@
|
||||||
* includes core runtime services, third party libraries we've curated,
|
* includes core runtime services, third party libraries we've curated,
|
||||||
* as well as internal libraries we made that are good enough to share.
|
* as well as internal libraries we made that are good enough to share.
|
||||||
*
|
*
|
||||||
* @see tool/script/cosmocc
|
* @see tool/cosmocc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_LOG_COUNTBRANCH_H_
|
#ifndef COSMOPOLITAN_LIBC_LOG_COUNTBRANCH_H_
|
||||||
#define COSMOPOLITAN_LIBC_LOG_COUNTBRANCH_H_
|
#define COSMOPOLITAN_LIBC_LOG_COUNTBRANCH_H_
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
#include "libc/stdbool.h"
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
extern bool __nocolor;
|
extern bool __nocolor;
|
||||||
extern bool g_isrunningundermake;
|
extern bool32 g_isrunningundermake;
|
||||||
|
|
||||||
void __start_fatal(const char *, int);
|
void __start_fatal(const char *, int);
|
||||||
void __restore_tty(void);
|
void __restore_tty(void);
|
||||||
|
|
|
@ -39,12 +39,11 @@ int __watch(void *, size_t);
|
||||||
void __die(void) relegated wontreturn; /* print backtrace and abort() */
|
void __die(void) relegated wontreturn; /* print backtrace and abort() */
|
||||||
void _meminfo(int); /* shows malloc statistics &c. */
|
void _meminfo(int); /* shows malloc statistics &c. */
|
||||||
void _memsummary(int); /* light version of same thing */
|
void _memsummary(int); /* light version of same thing */
|
||||||
bool IsTerminalInarticulate(void) nosideeffect;
|
|
||||||
const char *commandvenv(const char *, const char *);
|
const char *commandvenv(const char *, const char *);
|
||||||
const char *GetAddr2linePath(void);
|
const char *GetAddr2linePath(void);
|
||||||
const char *GetGdbPath(void);
|
const char *GetGdbPath(void);
|
||||||
bool32 IsDebuggerPresent(bool);
|
bool32 IsDebuggerPresent(bool32);
|
||||||
bool IsRunningUnderMake(void);
|
bool32 IsRunningUnderMake(void);
|
||||||
char *GetSymbolByAddr(int64_t);
|
char *GetSymbolByAddr(int64_t);
|
||||||
void PrintGarbage(void);
|
void PrintGarbage(void);
|
||||||
void PrintGarbageNumeric(FILE *);
|
void PrintGarbageNumeric(FILE *);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_ALG_ARRAYLIST_H_
|
#ifndef COSMOPOLITAN_LIBC_ALG_ARRAYLIST_H_
|
||||||
#define COSMOPOLITAN_LIBC_ALG_ARRAYLIST_H_
|
#define COSMOPOLITAN_LIBC_ALG_ARRAYLIST_H_
|
||||||
#include "libc/intrin/bits.h"
|
#include "libc/intrin/bits.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/internal.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_ALG_ARRAYLIST2_H_
|
#ifndef COSMOPOLITAN_LIBC_ALG_ARRAYLIST2_H_
|
||||||
#define COSMOPOLITAN_LIBC_ALG_ARRAYLIST2_H_
|
#define COSMOPOLITAN_LIBC_ALG_ARRAYLIST2_H_
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/internal.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_ALG_CRITBIT0_H_
|
#ifndef COSMOPOLITAN_LIBC_ALG_CRITBIT0_H_
|
||||||
#define COSMOPOLITAN_LIBC_ALG_CRITBIT0_H_
|
#define COSMOPOLITAN_LIBC_ALG_CRITBIT0_H_
|
||||||
|
#include "libc/stdbool.h"
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||||
|
|
|
@ -10,6 +10,7 @@ struct CritbitNode {
|
||||||
};
|
};
|
||||||
|
|
||||||
int __putenv(char *, bool);
|
int __putenv(char *, bool);
|
||||||
|
bool __grow(void *, size_t *, size_t, size_t) paramsnonnull((1, 2)) libcesque;
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||||
|
|
|
@ -57,10 +57,6 @@ size_t malloc_footprint_limit(void);
|
||||||
size_t malloc_set_footprint_limit(size_t);
|
size_t malloc_set_footprint_limit(size_t);
|
||||||
void malloc_inspect_all(void (*)(void *, void *, size_t, void *), void *);
|
void malloc_inspect_all(void (*)(void *, void *, size_t, void *), void *);
|
||||||
|
|
||||||
#ifdef _COSMO_SOURCE
|
|
||||||
bool __grow(void *, size_t *, size_t, size_t) paramsnonnull((1, 2)) libcesque;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||||
#endif /* COSMOPOLITAN_LIBC_MEM_MEM_H_ */
|
#endif /* COSMOPOLITAN_LIBC_MEM_MEM_H_ */
|
||||||
|
|
|
@ -35,8 +35,8 @@ COSMOPOLITAN_C_START_
|
||||||
*/
|
*/
|
||||||
#define rdpid() \
|
#define rdpid() \
|
||||||
({ \
|
({ \
|
||||||
bool Ok; \
|
|
||||||
long Msr; \
|
long Msr; \
|
||||||
|
bool32 Ok; \
|
||||||
Ok = false; \
|
Ok = false; \
|
||||||
if (X86_HAVE(RDPID)) { \
|
if (X86_HAVE(RDPID)) { \
|
||||||
asm volatile("rdpid\t%0" : "=r"(Msr) : /* no inputs */ : "memory"); \
|
asm volatile("rdpid\t%0" : "=r"(Msr) : /* no inputs */ : "memory"); \
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
int __threaded;
|
int __threaded;
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
bool __tls_enabled;
|
char __tls_enabled;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned __tls_index;
|
unsigned __tls_index;
|
||||||
|
|
|
@ -176,7 +176,7 @@ typedef enum {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t Resolution;
|
uint32_t Resolution;
|
||||||
uint32_t Accuracy;
|
uint32_t Accuracy;
|
||||||
bool SetsToZero;
|
bool32 SetsToZero;
|
||||||
} EFI_TIME_CAPABILITIES;
|
} EFI_TIME_CAPABILITIES;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -231,7 +231,7 @@ typedef struct {
|
||||||
int32_t Attribute;
|
int32_t Attribute;
|
||||||
int32_t CursorColumn;
|
int32_t CursorColumn;
|
||||||
int32_t CursorRow;
|
int32_t CursorRow;
|
||||||
bool CursorVisible;
|
bool32 CursorVisible;
|
||||||
} EFI_SIMPLE_TEXT_OUTPUT_MODE;
|
} EFI_SIMPLE_TEXT_OUTPUT_MODE;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -359,10 +359,10 @@ typedef EFI_STATUS(EFIAPI *EFI_UPDATE_CAPSULE)(
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)(
|
typedef EFI_STATUS(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)(
|
||||||
EFI_CAPSULE_HEADER **CapsuleHeaderArray, uintptr_t CapsuleCount,
|
EFI_CAPSULE_HEADER **CapsuleHeaderArray, uintptr_t CapsuleCount,
|
||||||
uint64_t *out_MaximumCapsuleSize, EFI_RESET_TYPE *out_ResetType);
|
uint64_t *out_MaximumCapsuleSize, EFI_RESET_TYPE *out_ResetType);
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_GET_WAKEUP_TIME)(bool *out_Enabled,
|
typedef EFI_STATUS(EFIAPI *EFI_GET_WAKEUP_TIME)(bool32 *out_Enabled,
|
||||||
bool *out_Pending,
|
bool32 *out_Pending,
|
||||||
EFI_TIME *out_Time);
|
EFI_TIME *out_Time);
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_SET_WAKEUP_TIME)(bool Enable,
|
typedef EFI_STATUS(EFIAPI *EFI_SET_WAKEUP_TIME)(bool32 Enable,
|
||||||
EFI_TIME *opt_Time);
|
EFI_TIME *opt_Time);
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_SET_WATCHDOG_TIMER)(uintptr_t Timeout,
|
typedef EFI_STATUS(EFIAPI *EFI_SET_WATCHDOG_TIMER)(uintptr_t Timeout,
|
||||||
uint64_t WatchdogCode,
|
uint64_t WatchdogCode,
|
||||||
|
@ -390,12 +390,12 @@ typedef EFI_STATUS(EFIAPI *EFI_CONVERT_POINTER)(uintptr_t DebugDisposition,
|
||||||
void **inout_Address);
|
void **inout_Address);
|
||||||
|
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_INPUT_RESET)(
|
typedef EFI_STATUS(EFIAPI *EFI_INPUT_RESET)(
|
||||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, bool ExtendedVerification);
|
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, bool32 ExtendedVerification);
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_INPUT_READ_KEY)(
|
typedef EFI_STATUS(EFIAPI *EFI_INPUT_READ_KEY)(
|
||||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, EFI_INPUT_KEY *out_Key);
|
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, EFI_INPUT_KEY *out_Key);
|
||||||
|
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_TEXT_RESET)(
|
typedef EFI_STATUS(EFIAPI *EFI_TEXT_RESET)(
|
||||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, bool ExtendedVerification);
|
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, bool32 ExtendedVerification);
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_TEXT_STRING)(
|
typedef EFI_STATUS(EFIAPI *EFI_TEXT_STRING)(
|
||||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, char16_t *String);
|
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, char16_t *String);
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_TEXT_TEST_STRING)(
|
typedef EFI_STATUS(EFIAPI *EFI_TEXT_TEST_STRING)(
|
||||||
|
@ -412,7 +412,7 @@ typedef EFI_STATUS(EFIAPI *EFI_TEXT_CLEAR_SCREEN)(
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION)(
|
typedef EFI_STATUS(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION)(
|
||||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, uint64_t Column, uint64_t Row);
|
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, uint64_t Column, uint64_t Row);
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_TEXT_ENABLE_CURSOR)(
|
typedef EFI_STATUS(EFIAPI *EFI_TEXT_ENABLE_CURSOR)(
|
||||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, bool Visible);
|
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, bool32 Visible);
|
||||||
|
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(
|
typedef EFI_STATUS(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(
|
||||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *This, uint32_t ModeNumber,
|
EFI_GRAPHICS_OUTPUT_PROTOCOL *This, uint32_t ModeNumber,
|
||||||
|
@ -430,7 +430,7 @@ typedef EFI_STATUS(EFIAPI *EFI_HANDLE_PROTOCOL)(EFI_HANDLE Handle,
|
||||||
EFI_GUID *Protocol,
|
EFI_GUID *Protocol,
|
||||||
void *out_Interface);
|
void *out_Interface);
|
||||||
|
|
||||||
typedef EFI_STATUS(EFIAPI *EFI_IMAGE_LOAD)(bool BootPolicy,
|
typedef EFI_STATUS(EFIAPI *EFI_IMAGE_LOAD)(bool32 BootPolicy,
|
||||||
EFI_HANDLE ParentImageHandle,
|
EFI_HANDLE ParentImageHandle,
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
void *opt_SourceBuffer,
|
void *opt_SourceBuffer,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
bool IsAtLeastWindows10(void) pureconst;
|
bool32 IsAtLeastWindows10(void) pureconst;
|
||||||
bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation);
|
bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation);
|
||||||
|
|
||||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(__x86_64__)
|
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(__x86_64__)
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* @assume stack memory isn't stored beneath %rsp (-mno-red-zone)
|
* @assume stack memory isn't stored beneath %rsp (-mno-red-zone)
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
optimizesize bool _isheap(void *p) {
|
optimizesize bool32 _isheap(void *p) {
|
||||||
intptr_t x, y;
|
intptr_t x, y;
|
||||||
x = kAutomapStart;
|
x = kAutomapStart;
|
||||||
y = x + kAutomapSize;
|
y = x + kAutomapSize;
|
||||||
|
|
|
@ -81,7 +81,7 @@ extern const char kNtSystemDirectory[];
|
||||||
extern const char kNtWindowsDirectory[];
|
extern const char kNtWindowsDirectory[];
|
||||||
extern size_t __virtualmax;
|
extern size_t __virtualmax;
|
||||||
extern size_t __stackmax;
|
extern size_t __stackmax;
|
||||||
extern bool __isworker;
|
extern bool32 __isworker;
|
||||||
/* utilities */
|
/* utilities */
|
||||||
void _intsort(int *, size_t);
|
void _intsort(int *, size_t);
|
||||||
void _longsort(long *, size_t);
|
void _longsort(long *, size_t);
|
||||||
|
@ -111,14 +111,14 @@ void CheckForMemoryLeaks(void);
|
||||||
void CheckForFileLeaks(void);
|
void CheckForFileLeaks(void);
|
||||||
void __enable_threads(void);
|
void __enable_threads(void);
|
||||||
void __oom_hook(size_t);
|
void __oom_hook(size_t);
|
||||||
bool _isheap(void *);
|
bool32 _isheap(void *);
|
||||||
/* code morphing */
|
/* code morphing */
|
||||||
void __morph_begin(void);
|
void __morph_begin(void);
|
||||||
void __morph_end(void);
|
void __morph_end(void);
|
||||||
/* portability */
|
/* portability */
|
||||||
int NtGetVersion(void) pureconst;
|
int NtGetVersion(void) pureconst;
|
||||||
bool IsGenuineBlink(void);
|
bool32 IsGenuineBlink(void);
|
||||||
bool IsCygwin(void);
|
bool32 IsCygwin(void);
|
||||||
const char *GetCpuidOs(void);
|
const char *GetCpuidOs(void);
|
||||||
const char *GetCpuidEmulator(void);
|
const char *GetCpuidEmulator(void);
|
||||||
void GetCpuidBrand(char[13], uint32_t);
|
void GetCpuidBrand(char[13], uint32_t);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "libc/fmt/conv.h"
|
#include "libc/fmt/conv.h"
|
||||||
#include "libc/fmt/fmt.h"
|
#include "libc/fmt/fmt.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
|
#include "libc/mem/internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* @param s is a NUL-terminated string
|
* @param s is a NUL-terminated string
|
||||||
* @param suffix is also NUL-terminated
|
* @param suffix is also NUL-terminated
|
||||||
*/
|
*/
|
||||||
bool endswith(const char *s, const char *suffix) {
|
bool32 endswith(const char *s, const char *suffix) {
|
||||||
size_t n, m;
|
size_t n, m;
|
||||||
n = strlen(s);
|
n = strlen(s);
|
||||||
m = strlen(suffix);
|
m = strlen(suffix);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* @param s is a NUL-terminated string
|
* @param s is a NUL-terminated string
|
||||||
* @param suffix is also NUL-terminated
|
* @param suffix is also NUL-terminated
|
||||||
*/
|
*/
|
||||||
bool endswith16(const char16_t *s, const char16_t *suffix) {
|
bool32 endswith16(const char16_t *s, const char16_t *suffix) {
|
||||||
size_t n, m;
|
size_t n, m;
|
||||||
n = strlen16(s);
|
n = strlen16(s);
|
||||||
m = strlen16(suffix);
|
m = strlen16(suffix);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
/**
|
/**
|
||||||
* Returns true if buffer is most likely plaintext.
|
* Returns true if buffer is most likely plaintext.
|
||||||
*/
|
*/
|
||||||
bool istext(const void *data, size_t size) {
|
bool32 istext(const void *data, size_t size) {
|
||||||
const unsigned char *p, *pe;
|
const unsigned char *p, *pe;
|
||||||
for (p = data, pe = p + size; p < pe; ++p) {
|
for (p = data, pe = p + size; p < pe; ++p) {
|
||||||
if (*p <= 3) {
|
if (*p <= 3) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ static const char kUtf8Dispatch[] = {
|
||||||
*
|
*
|
||||||
* @param size if -1 implies strlen
|
* @param size if -1 implies strlen
|
||||||
*/
|
*/
|
||||||
bool isutf8(const void *data, size_t size) {
|
bool32 isutf8(const void *data, size_t size) {
|
||||||
long c;
|
long c;
|
||||||
const char *p, *e;
|
const char *p, *e;
|
||||||
if (size == -1) size = data ? strlen(data) : 0;
|
if (size == -1) size = data ? strlen(data) : 0;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_STR_SLICE_H_
|
#ifndef COSMOPOLITAN_LIBC_STR_SLICE_H_
|
||||||
#define COSMOPOLITAN_LIBC_STR_SLICE_H_
|
#define COSMOPOLITAN_LIBC_STR_SLICE_H_
|
||||||
|
#include "libc/stdbool.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
@ -18,7 +19,6 @@ COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
int CompareSlices(const char *, size_t, const char *, size_t);
|
int CompareSlices(const char *, size_t, const char *, size_t);
|
||||||
int CompareSlicesCase(const char *, size_t, const char *, size_t);
|
int CompareSlicesCase(const char *, size_t, const char *, size_t);
|
||||||
bool StartsWithIgnoreCase(const char *, const char *);
|
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* @param s is a NUL-terminated string
|
* @param s is a NUL-terminated string
|
||||||
* @param prefix is also NUL-terminated
|
* @param prefix is also NUL-terminated
|
||||||
*/
|
*/
|
||||||
bool startswith(const char *s, const char *prefix) {
|
bool32 startswith(const char *s, const char *prefix) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!*prefix) return true;
|
if (!*prefix) return true;
|
||||||
if (!*s) return false;
|
if (!*s) return false;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* @param s is a NUL-terminated string
|
* @param s is a NUL-terminated string
|
||||||
* @param prefix is also NUL-terminated
|
* @param prefix is also NUL-terminated
|
||||||
*/
|
*/
|
||||||
bool startswith16(const char16_t *s, const char16_t *prefix) {
|
bool32 startswith16(const char16_t *s, const char16_t *prefix) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!*prefix) return true;
|
if (!*prefix) return true;
|
||||||
if (!*s) return false;
|
if (!*s) return false;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
/**
|
/**
|
||||||
* Checks if string starts with prefix, case insensitively.
|
* Checks if string starts with prefix, case insensitively.
|
||||||
*/
|
*/
|
||||||
bool startswithi(const char *s, const char *prefix) {
|
bool32 startswithi(const char *s, const char *prefix) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!*prefix) return true;
|
if (!*prefix) return true;
|
||||||
if (!*s) return false;
|
if (!*s) return false;
|
||||||
|
|
|
@ -178,11 +178,11 @@ uint64_t tpenc(uint32_t) pureconst;
|
||||||
char *chomp(char *) libcesque;
|
char *chomp(char *) libcesque;
|
||||||
wchar_t *wchomp(wchar_t *) libcesque;
|
wchar_t *wchomp(wchar_t *) libcesque;
|
||||||
uint64_t __fnv(const void *, size_t) strlenesque;
|
uint64_t __fnv(const void *, size_t) strlenesque;
|
||||||
bool startswith(const char *, const char *) strlenesque;
|
bool32 startswith(const char *, const char *) strlenesque;
|
||||||
bool startswithi(const char *, const char *) strlenesque;
|
bool32 startswithi(const char *, const char *) strlenesque;
|
||||||
bool endswith(const char *, const char *) strlenesque;
|
bool32 endswith(const char *, const char *) strlenesque;
|
||||||
bool istext(const void *, size_t) libcesque;
|
bool32 istext(const void *, size_t) libcesque;
|
||||||
bool isutf8(const void *, size_t) libcesque;
|
bool32 isutf8(const void *, size_t) libcesque;
|
||||||
char *strsignal_r(int, char[21]) returnsnonnull libcesque __wur;
|
char *strsignal_r(int, char[21]) returnsnonnull libcesque __wur;
|
||||||
int strerror_wr(int, uint32_t, char *, size_t)
|
int strerror_wr(int, uint32_t, char *, size_t)
|
||||||
dontthrow nocallback;
|
dontthrow nocallback;
|
||||||
|
@ -207,12 +207,12 @@ char16_t *strcat16(char16_t *, const char16_t *) memcpyesque;
|
||||||
char16_t *strcpy16(char16_t *, const char16_t *) memcpyesque;
|
char16_t *strcpy16(char16_t *, const char16_t *) memcpyesque;
|
||||||
char16_t *strncat16(char16_t *, const char16_t *, size_t) memcpyesque;
|
char16_t *strncat16(char16_t *, const char16_t *, size_t) memcpyesque;
|
||||||
char16_t *memset16(char16_t *, char16_t, size_t) memcpyesque;
|
char16_t *memset16(char16_t *, char16_t, size_t) memcpyesque;
|
||||||
bool startswith16(const char16_t *, const char16_t *) strlenesque;
|
bool32 startswith16(const char16_t *, const char16_t *) strlenesque;
|
||||||
bool endswith16(const char16_t *, const char16_t *) strlenesque;
|
bool32 endswith16(const char16_t *, const char16_t *) strlenesque;
|
||||||
axdx_t tprecode8to16(char16_t *, size_t, const char *);
|
axdx_t tprecode8to16(char16_t *, size_t, const char *);
|
||||||
axdx_t tprecode16to8(char *, size_t, const char16_t *);
|
axdx_t tprecode16to8(char *, size_t, const char16_t *);
|
||||||
bool wcsstartswith(const wchar_t *, const wchar_t *) strlenesque;
|
bool32 wcsstartswith(const wchar_t *, const wchar_t *) strlenesque;
|
||||||
bool wcsendswith(const wchar_t *, const wchar_t *) strlenesque;
|
bool32 wcsendswith(const wchar_t *, const wchar_t *) strlenesque;
|
||||||
char *__join_paths(char *, size_t, const char *, const char *) __wur;
|
char *__join_paths(char *, size_t, const char *, const char *) __wur;
|
||||||
#endif /* _COSMO_SOURCE */
|
#endif /* _COSMO_SOURCE */
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* @param s is a NUL-terminated string
|
* @param s is a NUL-terminated string
|
||||||
* @param suffix is also NUL-terminated
|
* @param suffix is also NUL-terminated
|
||||||
*/
|
*/
|
||||||
bool wcsendswith(const wchar_t *s, const wchar_t *suffix) {
|
bool32 wcsendswith(const wchar_t *s, const wchar_t *suffix) {
|
||||||
size_t n, m;
|
size_t n, m;
|
||||||
n = wcslen(s);
|
n = wcslen(s);
|
||||||
m = wcslen(suffix);
|
m = wcslen(suffix);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* @param s is a NUL-terminated string
|
* @param s is a NUL-terminated string
|
||||||
* @param prefix is also NUL-terminated
|
* @param prefix is also NUL-terminated
|
||||||
*/
|
*/
|
||||||
bool _wcsstartswith(const wchar_t *s, const wchar_t *prefix) {
|
bool32 wcsstartswith(const wchar_t *s, const wchar_t *prefix) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!*prefix) return true;
|
if (!*prefix) return true;
|
||||||
if (!*s) return false;
|
if (!*s) return false;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_TESTLIB_H_
|
#ifndef COSMOPOLITAN_LIBC_TESTLIB_H_
|
||||||
#define COSMOPOLITAN_LIBC_TESTLIB_H_
|
#define COSMOPOLITAN_LIBC_TESTLIB_H_
|
||||||
|
#include "libc/stdbool.h"
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef COSMOPOLITAN_LIBC_CALLS_SEMAPHORE_H_
|
#ifndef COSMOPOLITAN_LIBC_CALLS_SEMAPHORE_H_
|
||||||
#define COSMOPOLITAN_LIBC_CALLS_SEMAPHORE_H_
|
#define COSMOPOLITAN_LIBC_CALLS_SEMAPHORE_H_
|
||||||
#include "libc/calls/struct/timespec.h"
|
#include "libc/calls/struct/timespec.h"
|
||||||
#include "libc/stdbool.h"
|
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
|
@ -20,8 +19,8 @@ typedef struct {
|
||||||
int64_t sem_dev; /* named only */
|
int64_t sem_dev; /* named only */
|
||||||
int64_t sem_ino; /* named only */
|
int64_t sem_ino; /* named only */
|
||||||
int sem_pid; /* unnamed only */
|
int sem_pid; /* unnamed only */
|
||||||
bool sem_lazydelete; /* named only */
|
char sem_lazydelete; /* named only */
|
||||||
bool sem_pshared;
|
char sem_pshared;
|
||||||
int *sem_kernel;
|
int *sem_kernel;
|
||||||
};
|
};
|
||||||
void *sem_space[32];
|
void *sem_space[32];
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
COSMOPOLITAN_C_START_
|
COSMOPOLITAN_C_START_
|
||||||
|
|
||||||
struct CosmoFtrace { /* 16 */
|
struct CosmoFtrace { /* 16 */
|
||||||
bool ft_once; /* 0 */
|
char ft_once; /* 0 */
|
||||||
bool ft_noreentry; /* 1 */
|
char ft_noreentry; /* 1 */
|
||||||
int ft_skew; /* 4 */
|
int ft_skew; /* 4 */
|
||||||
int64_t ft_lastaddr; /* 8 */
|
int64_t ft_lastaddr; /* 8 */
|
||||||
};
|
};
|
||||||
|
@ -48,7 +48,7 @@ char *_mktls(struct CosmoTib **);
|
||||||
void __bootstrap_tls(struct CosmoTib *, char *);
|
void __bootstrap_tls(struct CosmoTib *, char *);
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
extern bool __tls_enabled;
|
extern char __tls_enabled;
|
||||||
#define __tls_enabled_set(x) __tls_enabled = x
|
#define __tls_enabled_set(x) __tls_enabled = x
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
#define __tls_enabled true
|
#define __tls_enabled true
|
||||||
|
|
|
@ -24,7 +24,7 @@ forceinline uint32_t __magicu_div(uint32_t x, struct magicu d) {
|
||||||
/**
|
/**
|
||||||
* Checks if 𝑑 contains a valid initialized divisor.
|
* Checks if 𝑑 contains a valid initialized divisor.
|
||||||
*/
|
*/
|
||||||
static inline bool __magicu_valid(struct magicu d) {
|
static inline bool32 __magicu_valid(struct magicu d) {
|
||||||
if (!d.M && !d.s) return false; /* uninitialized */
|
if (!d.M && !d.s) return false; /* uninitialized */
|
||||||
if (d.s & ~(64 | 63)) return false; /* corrupted */
|
if (d.s & ~(64 | 63)) return false; /* corrupted */
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/struct/sigaction.h"
|
#include "libc/calls/struct/sigaction.h"
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/pledge.h"
|
#include "libc/calls/pledge.h"
|
||||||
#include "libc/calls/struct/rusage.h"
|
#include "libc/calls/struct/rusage.h"
|
||||||
#include "libc/calls/struct/sigaction.h"
|
#include "libc/calls/struct/sigaction.h"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "libc/intrin/pushpop.internal.h"
|
#include "libc/intrin/pushpop.internal.h"
|
||||||
#include "libc/limits.h"
|
#include "libc/limits.h"
|
||||||
#include "libc/macros.internal.h"
|
#include "libc/macros.internal.h"
|
||||||
|
#include "libc/mem/internal.h"
|
||||||
#include "libc/mem/mem.h"
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/nt/enum/version.h"
|
#include "libc/nt/enum/version.h"
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
|
#include "libc/calls/internal.h"
|
||||||
#include "libc/calls/struct/sigaction.h"
|
#include "libc/calls/struct/sigaction.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
#include "libc/errno.h"
|
#include "libc/errno.h"
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "libc/log/check.h"
|
#include "libc/log/check.h"
|
||||||
#include "libc/mem/arraylist2.internal.h"
|
#include "libc/mem/arraylist2.internal.h"
|
||||||
#include "libc/mem/gc.h"
|
#include "libc/mem/gc.h"
|
||||||
|
#include "libc/mem/mem.h"
|
||||||
#include "libc/runtime/memtrack.internal.h"
|
#include "libc/runtime/memtrack.internal.h"
|
||||||
#include "libc/stdalign.internal.h"
|
#include "libc/stdalign.internal.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
|
@ -242,9 +242,6 @@ CPPFLAGS_X86_64="$CPPFLAGS -mno-red-zone"
|
||||||
CFLAGS_X86_64="$CFLAGS -mno-tls-direct-seg-refs"
|
CFLAGS_X86_64="$CFLAGS -mno-tls-direct-seg-refs"
|
||||||
LDFLAGS_X86_64="$LDFLAGS -L$BIN/../x86_64-linux-cosmo/lib -Wl,-T,$BIN/../x86_64-linux-cosmo/lib/ape.lds -Wl,-z,common-page-size=4096 -Wl,-z,max-page-size=16384"
|
LDFLAGS_X86_64="$LDFLAGS -L$BIN/../x86_64-linux-cosmo/lib -Wl,-T,$BIN/../x86_64-linux-cosmo/lib/ape.lds -Wl,-z,common-page-size=4096 -Wl,-z,max-page-size=16384"
|
||||||
LDLIBS_X86_64="-lcosmo"
|
LDLIBS_X86_64="-lcosmo"
|
||||||
if [ $MCOSMO -eq 1 ]; then
|
|
||||||
CPPFLAGS_X86_64="${CPPFLAGS_X86_64} -D_COSMO_SOURCE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CRT_AARCH64="$BIN/../aarch64-linux-cosmo/lib/crt.o"
|
CRT_AARCH64="$BIN/../aarch64-linux-cosmo/lib/crt.o"
|
||||||
CPPFLAGS_AARCH64="$CPPFLAGS"
|
CPPFLAGS_AARCH64="$CPPFLAGS"
|
||||||
|
@ -262,6 +259,11 @@ if [ x"$PROG" != x"${PROG%++}" ]; then
|
||||||
LDLIBS_AARCH64="-lcxx ${LDLIBS_AARCH64}"
|
LDLIBS_AARCH64="-lcxx ${LDLIBS_AARCH64}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $MCOSMO -eq 1 ]; then
|
||||||
|
CPPFLAGS_X86_64="${CPPFLAGS_X86_64} -D_COSMO_SOURCE"
|
||||||
|
CPPFLAGS_AARCH64="${CPPFLAGS_AARCH64} -D_COSMO_SOURCE"
|
||||||
|
fi
|
||||||
|
|
||||||
log_original
|
log_original
|
||||||
|
|
||||||
if [ $INTENT = cpp ]; then
|
if [ $INTENT = cpp ]; then
|
||||||
|
|
Loading…
Reference in a new issue