From f032b5570b4cd87c6bb4abb54c0b98e69c939955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C5=8Dshin?= Date: Sat, 1 Jun 2024 13:30:43 -0700 Subject: [PATCH] Run clang-format (#1197) --- ape/macros.internal.h | 41 +- dsp/core/core.h | 4 +- dsp/core/dct.c | 4 +- dsp/core/gamma.c | 2 +- dsp/mpeg/buffer.h | 3 +- dsp/mpeg/demux.h | 4 +- dsp/tty/altbuf.c | 8 +- dsp/tty/savecursor.c | 8 +- dsp/tty/setbgfg16.c | 8 +- examples/env.c | 4 +- examples/hiredis.c | 4 +- examples/parsefloat.c | 52 +- examples/unbourne.c | 27 +- examples/walk.c | 2 +- libc/calls/cp.internal.h | 6 +- libc/calls/dup.c | 2 +- libc/calls/dup2.c | 2 +- libc/calls/ioctl.c | 2 +- libc/calls/isapemagic.c | 2 +- libc/calls/linkat.c | 2 +- libc/calls/mkdirat.c | 2 +- libc/calls/openat-metal.c | 2 +- libc/calls/renameat.c | 2 +- libc/calls/ttyname.c | 2 +- libc/calls/unlinkat.c | 2 +- libc/elf/tinyelf.internal.h | 29 +- libc/fmt/internal.h | 15 +- libc/intrin/dll.h | 9 +- libc/intrin/float16.c | 2 +- libc/intrin/kprintf.h | 3 +- libc/intrin/mman.greg.c | 2 +- libc/intrin/repmovsb.h | 3 +- libc/intrin/repstosb.h | 3 +- libc/intrin/safemacros.internal.h | 3 +- libc/intrin/stackchkfail.c | 2 +- libc/intrin/strlen.c | 2 +- libc/irq/acpi-fadt.c | 4 +- libc/irq/acpi-xsdt.c | 2 +- libc/iso646.internal.h | 14 +- libc/isystem/cxxabi.h | 2 +- libc/isystem/ftw.h | 2 +- libc/isystem/sys/param.h | 4 +- libc/isystem/sys/signal.h | 2 +- libc/isystem/tgmath.h | 446 +++++++++--------- libc/log/appendresourcereport.c | 2 +- libc/log/countbranch.h | 3 +- libc/log/gdb.h | 3 +- libc/log/libfatal.internal.h | 51 +- libc/log/log.h | 69 ++- libc/log/watch.c | 2 +- libc/macros.internal.h | 6 +- libc/nexgen32e/rdtscp.h | 5 +- libc/nt/enum/consolemodeflags.h | 26 +- libc/nt/enum/consoleselectionflags.h | 8 +- libc/nt/enum/creationdisposition.h | 8 +- libc/nt/enum/ctrlevent.h | 8 +- libc/nt/enum/exceptionhandleractions.h | 4 +- libc/nt/enum/fileinformationclass.h | 76 +-- libc/nt/enum/filesharemode.h | 6 +- libc/nt/enum/fillattribute.h | 12 +- libc/nt/enum/fsinformationclass.h | 18 +- libc/nt/enum/kwaitreason.h | 54 +-- libc/nt/enum/processaccess.h | 24 +- libc/nt/enum/procthreadattributes.h | 2 +- libc/nt/enum/securityinformation.h | 26 +- libc/nt/enum/startf.h | 24 +- libc/nt/enum/systeminformationclass.h | 28 +- libc/nt/enum/threadaccess.h | 24 +- libc/nt/enum/tokeninformationclass.h | 34 +- libc/nt/struct/ntexceptionrecord.h | 1 - libc/runtime/getinterpreterexecutablename.c | 4 +- libc/runtime/pc.internal.h | 6 +- libc/runtime/zipos-fcntl.c | 3 +- libc/runtime/zipos-mmap.c | 2 +- libc/runtime/zipos-notat.c | 2 +- libc/sock/epoll.c | 2 +- libc/sock/gethostips.c | 2 +- libc/stdio/vcscanf.c | 7 +- libc/str/iswpunct.c | 140 +++--- libc/str/locale.h | 2 +- libc/str/lz4cpy.c | 2 +- libc/str/tpdecodecb.internal.h | 15 +- libc/str/wctype.c | 2 +- libc/sysv/consts/fileno.h | 2 +- libc/sysv/consts/icmp6.h | 63 ++- libc/sysv/consts/iff.h | 1 - libc/sysv/consts/ip.h | 1 - libc/sysv/consts/ipv6.h | 1 - libc/sysv/consts/limits.h | 1 - libc/sysv/consts/lio.h | 8 +- libc/sysv/consts/lock.h | 1 - libc/sysv/consts/mcast.h | 16 +- libc/sysv/consts/modem.h | 1 - libc/sysv/consts/mount.h | 1 - libc/sysv/consts/pf.h | 1 - libc/sysv/consts/poll.h | 1 - libc/sysv/consts/posix.h | 1 - libc/sysv/consts/pty.h | 1 - libc/sysv/consts/read.h | 22 +- libc/sysv/consts/reboot.h | 1 - libc/sysv/consts/rlim.h | 1 - libc/sysv/consts/sa.h | 1 - libc/sysv/consts/sched.h | 1 - libc/sysv/consts/scm.h | 1 - libc/sysv/consts/sf.h | 1 - libc/sysv/consts/sicode.h | 1 - libc/sysv/consts/st.h | 1 - libc/sysv/consts/tcp.h | 1 - libc/sysv/consts/utime.h | 1 - libc/sysv/consts/w.h | 1 - libc/testlib/ezbench.h | 174 +++---- libc/testlib/testlib.h | 108 +++-- libc/thread/sem_open.c | 2 +- libc/thread/thread.h | 3 +- net/http/findcontenttype.c | 2 +- net/http/isnocompressext.c | 2 +- net/turfwar/blackhole.c | 2 +- test/dsp/core/illumination_test.c | 2 +- test/libc/calls/sigtimedwait_test.c | 2 +- test/libc/fmt/zleb64_test.c | 2 +- test/libc/intrin/describegidlist_test.c | 4 +- test/libc/intrin/lockipc_test.c | 2 +- test/libc/mem/prog/sock.c | 2 +- test/libc/mem/qsort_test.c | 1 - test/libc/nexgen32e/strsak32_test.c | 2 +- test/libc/proc/handkill_test.c | 2 +- test/libc/proc/sched_getaffinity_test.c | 2 +- test/libc/stdio/crypt_test.c | 2 +- test/libc/stdio/devrand_test.c | 2 +- test/libc/stdio/dumphexc_test.c | 2 +- test/libc/stdio/fgetln_test.c | 1 - test/libc/stdio/iconv_test.c | 4 +- test/libc/stdio/joinstrlist_test.c | 2 +- test/libc/stdio/rand_test.c | 2 +- test/libc/stdio/vappendf_test.c | 2 +- test/libc/str/blake2_test.c | 2 +- test/libc/thread/pthread_atfork_test.c | 1 - test/libc/thread/pthread_rwlock_rdlock_test.c | 1 - test/libc/tinymath/measureentropy_test.c | 2 +- test/libc/x/utf16to8_test.c | 2 +- test/libc/x/utf8to16_test.c | 2 +- test/libc/x/utf8to32_test.c | 2 +- test/net/http/decodelatin1_test.c | 2 +- test/net/http/encodehttpheadervalue_test.c | 2 +- test/net/http/escapehtml_test.c | 2 +- test/net/http/escapejsstringliteral_test.c | 4 +- test/net/http/escapeurlparam_test.c | 2 +- test/net/http/indentlines_test.c | 2 +- test/net/http/tokenbucket_test.c | 2 +- test/net/http/underlong_test.c | 2 +- test/tool/args/args_test.c | 2 +- test/tool/build/lib/interner_test.c | 4 +- test/tool/build/lib/stripcomponents_test.c | 2 +- test/tool/viz/lib/fun_test.c | 2 +- test/tool/viz/lib/halfblit_test.c | 2 +- tool/args/args.c | 11 +- tool/build/ar.c | 2 +- tool/build/lib/asmdown.h | 2 +- tool/build/lib/interner.c | 2 +- tool/build/lib/javadown.c | 2 +- tool/build/lib/javadown.h | 2 +- tool/build/reboot.c | 2 +- tool/decode/lib/disassemblehex.c | 2 +- tool/decode/lib/disassemblehex.h | 2 + tool/decode/lib/elfidnames.c | 2 +- tool/decode/lib/ntfileflagnames.c | 2 +- tool/decode/lib/peidnames.c | 2 +- tool/decode/lib/titlegen.c | 2 +- tool/decode/lib/zipnames.c | 2 +- tool/decode/pe2.c | 1 - tool/net/ljson.c | 2 +- tool/plinko/lib/error.c | 2 +- tool/plinko/lib/gc.h | 6 +- tool/plinko/lib/histo.c | 2 +- tool/plinko/lib/index.h | 6 +- tool/plinko/lib/plinko.h | 6 +- tool/plinko/lib/print.c | 2 +- tool/viz/lib/formatstringtable-code.c | 2 +- tool/viz/lib/glyphs.c | 3 +- tool/viz/lib/halfblit.c | 2 +- tool/viz/lib/stringbuilder.c | 5 +- tool/viz/life.c | 8 +- tool/viz/maxmind.c | 8 +- 183 files changed, 1074 insertions(+), 983 deletions(-) diff --git a/ape/macros.internal.h b/ape/macros.internal.h index 19733f0f7..bdf71b500 100644 --- a/ape/macros.internal.h +++ b/ape/macros.internal.h @@ -132,7 +132,7 @@ #define SHSTUB2(SYM, X) \ HIDDEN(SYM##_bcs0 = BCD_LEFT(X)); \ HIDDEN(SYM##_bcs1 = BCD_RIGHT(X)) -#define BCD_SMEAR(X) ((X) + (X) * 10000) +#define BCD_SMEAR(X) ((X) + (X)*10000) #define BCD_LEFT(X) \ (((X)) < 10000 ? BCD_RIGHT(BCD_SMEAR(X)) | 0x10 \ : (X) < 100000 ? BCD_RIGHT(BCD_SMEAR((X) / 10)) \ @@ -140,23 +140,16 @@ : (X) < 10000000 ? BCD_RIGHT(BCD_SMEAR((X) / 1000)) \ : (X) < 100000000 ? BCD_RIGHT(BCD_SMEAR((X) / 10000)) \ : 0xffffffffffffffff) -#define BCD_RIGHT(X) \ - (((X)) < 10000 ? 0x20202020 \ - : (X) < 100000 ? 0x20202030 + \ - (X) % 10 \ - : (X) < 1000000 ? 0x20203030 + \ - ((X) / 10) % 10 + \ - (X) % 10 * 0x100 \ - : (X) < 10000000 ? 0x20303030 + \ - ((X) / 100) % 10 + \ - ((X) / 10) % 10 * 0x100 + \ - (X) % 10 * 0x10000 \ - : (X) < 100000000 ? 0x30303030 + \ - ((X) / 1000) % 10 + \ - ((X) / 100) % 10 * 0x100 + \ - ((X) / 10) % 10 * 0x10000 + \ - (X) % 10 * 0x1000000 \ - : 0xffffffffffffffff) +#define BCD_RIGHT(X) \ + (((X)) < 10000 ? 0x20202020 \ + : (X) < 100000 ? 0x20202030 + (X) % 10 \ + : (X) < 1000000 ? 0x20203030 + ((X) / 10) % 10 + (X) % 10 * 0x100 \ + : (X) < 10000000 ? 0x20303030 + ((X) / 100) % 10 + \ + ((X) / 10) % 10 * 0x100 + (X) % 10 * 0x10000 \ + : (X) < 100000000 \ + ? 0x30303030 + ((X) / 1000) % 10 + ((X) / 100) % 10 * 0x100 + \ + ((X) / 10) % 10 * 0x10000 + (X) % 10 * 0x1000000 \ + : 0xffffffffffffffff) /** * Laying out the GDT entries for a TSS for bare metal operation. @@ -165,15 +158,11 @@ HIDDEN(SYM##_desc_ent0 = TSSDESC_ENT0(BASE, LIM)); \ HIDDEN(SYM##_desc_ent1 = TSSDESC_ENT1(BASE)); \ ASSERT((LIM) >= 0 && (LIM) <= 0xffff, "bare metal TSS is suspiciously fat") -#define TSSDESC_ENT0(BASE, LIM) \ - (((LIM) << 0 & 0x000000000000ffff) | \ - ((BASE) << 16 & 0x000000ffffff0000) | \ - 0x89 << 40 | \ - ((LIM) >> 16 << 48 & 0x000f000000000000) | \ - 0x2 << 52 | \ +#define TSSDESC_ENT0(BASE, LIM) \ + (((LIM) << 0 & 0x000000000000ffff) | ((BASE) << 16 & 0x000000ffffff0000) | \ + 0x89 << 40 | ((LIM) >> 16 << 48 & 0x000f000000000000) | 0x2 << 52 | \ ((BASE) >> 24 << 56 & 0xff00000000000000)) -#define TSSDESC_ENT1(BASE) \ - ((BASE) >> 32 << 0 & 0x00000000ffffffff) +#define TSSDESC_ENT1(BASE) ((BASE) >> 32 << 0 & 0x00000000ffffffff) #endif /* __ASSEMBLER__ */ #endif /* APE_MACROS_H_ */ diff --git a/dsp/core/core.h b/dsp/core/core.h index eadf040f9..d054201cb 100644 --- a/dsp/core/core.h +++ b/dsp/core/core.h @@ -9,8 +9,8 @@ int mulaw(int); int unmulaw(int); void *double2byte(long, const void *, double, double) vallocesque; void *byte2double(long, const void *, double, double) vallocesque; -void *dct(float[restrict hasatleast 8][8], unsigned, - float, float, float, float, float); +void *dct(float[restrict hasatleast 8][8], unsigned, float, float, float, float, + float); void *dctjpeg(float[restrict hasatleast 8][8], unsigned); double det3(const double[3][3]) nosideeffect; void *inv3(double[restrict 3][3], const double[restrict 3][3], double); diff --git a/dsp/core/dct.c b/dsp/core/dct.c index cae19d596..68d5c3bdc 100644 --- a/dsp/core/dct.c +++ b/dsp/core/dct.c @@ -65,8 +65,8 @@ * * @cost ~100ns */ -void *dct(float M[restrict hasatleast 8][8], unsigned stride, - float c0, float c1, float c2, float c3, float c4) { +void *dct(float M[restrict hasatleast 8][8], unsigned stride, float c0, + float c1, float c2, float c3, float c4) { unsigned y, x; for (y = 0; y < stride * 8; y += stride) { DCT(M[y][0], M[y][1], M[y][2], M[y][3], M[y][4], M[y][5], M[y][6], M[y][7], diff --git a/dsp/core/gamma.c b/dsp/core/gamma.c index bcbf1273b..ab33737fd 100644 --- a/dsp/core/gamma.c +++ b/dsp/core/gamma.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "dsp/core/core.h" #include "dsp/core/gamma.h" +#include "dsp/core/core.h" #include "libc/math.h" double rgb2stdpc(double x, double g) { diff --git a/dsp/mpeg/buffer.h b/dsp/mpeg/buffer.h index 5ab5faaa6..e841535fb 100644 --- a/dsp/mpeg/buffer.h +++ b/dsp/mpeg/buffer.h @@ -64,7 +64,8 @@ forceinline bool plm_buffer_has(plm_buffer_t *b, size_t bits) { } forceinline int plm_buffer_read(plm_buffer_t *self, int count) { - if (!plm_buffer_has(self, count)) return 0; + if (!plm_buffer_has(self, count)) + return 0; int value = 0; while (count) { int current_byte = self->bytes[self->bit_index >> 3]; diff --git a/dsp/mpeg/demux.h b/dsp/mpeg/demux.h index 0cc24e2eb..f36de4d3a 100644 --- a/dsp/mpeg/demux.h +++ b/dsp/mpeg/demux.h @@ -3,8 +3,8 @@ #include "dsp/mpeg/mpeg.h" COSMOPOLITAN_C_START_ -#define START_PACK 0xBA -#define START_END 0xB9 +#define START_PACK 0xBA +#define START_END 0xB9 #define START_SYSTEM 0xBB typedef struct plm_demux_t { diff --git a/dsp/tty/altbuf.c b/dsp/tty/altbuf.c index 42dc045eb..9efb96366 100644 --- a/dsp/tty/altbuf.c +++ b/dsp/tty/altbuf.c @@ -24,9 +24,13 @@ * The alternate buffer trick lets one restore the console exactly as it * was, once the program is done running. */ -int ttyenablealtbuf(int ttyfd) { return ttysend(ttyfd, "\e[?1049h"); } +int ttyenablealtbuf(int ttyfd) { + return ttysend(ttyfd, "\e[?1049h"); +} /** * Asks teletypewriter to restore blinking box thing. */ -int ttydisablealtbuf(int ttyfd) { return ttysend(ttyfd, "\e[?1049l"); } +int ttydisablealtbuf(int ttyfd) { + return ttysend(ttyfd, "\e[?1049l"); +} diff --git a/dsp/tty/savecursor.c b/dsp/tty/savecursor.c index 75979413f..30e240a41 100644 --- a/dsp/tty/savecursor.c +++ b/dsp/tty/savecursor.c @@ -21,9 +21,13 @@ /** * Asks teletypewriter to push current position. */ -int ttysavecursor(int ttyfd) { return ttysend(ttyfd, "\e[s"); } +int ttysavecursor(int ttyfd) { + return ttysend(ttyfd, "\e[s"); +} /** * Asks teletypewriter to pop previous position. */ -int ttyrestorecursor(int ttyfd) { return ttysend(ttyfd, "\e[u"); } +int ttyrestorecursor(int ttyfd) { + return ttysend(ttyfd, "\e[u"); +} diff --git a/dsp/tty/setbgfg16.c b/dsp/tty/setbgfg16.c index c0ef4e34f..0c0eb90b1 100644 --- a/dsp/tty/setbgfg16.c +++ b/dsp/tty/setbgfg16.c @@ -39,8 +39,12 @@ static char *setansibgfg(char *p, unsigned bg, unsigned fg) { return p; } -char *setbg16_(char *p, struct TtyRgb bg) { return setansibgfg(p, bg.xt, -1u); } -char *setfg16_(char *p, struct TtyRgb fg) { return setansibgfg(p, -1u, fg.xt); } +char *setbg16_(char *p, struct TtyRgb bg) { + return setansibgfg(p, bg.xt, -1u); +} +char *setfg16_(char *p, struct TtyRgb fg) { + return setansibgfg(p, -1u, fg.xt); +} char *setbgfg16_(char *p, struct TtyRgb bg, struct TtyRgb fg) { return setansibgfg(p, bg.xt, fg.xt); } diff --git a/examples/env.c b/examples/env.c index f3395ab36..5e607ddad 100644 --- a/examples/env.c +++ b/examples/env.c @@ -1,9 +1,9 @@ -#include "libc/stdio/stdio.h" #include "libc/runtime/runtime.h" +#include "libc/stdio/stdio.h" int main(int argc, char* argv[]) { fprintf(stderr, "%s (%s)\n", argv[0], GetProgramExecutableName()); - for (char **p = environ; *p; ++p) { + for (char** p = environ; *p; ++p) { printf("%s\n", *p); } return 0; diff --git a/examples/hiredis.c b/examples/hiredis.c index 749cc61db..727e23ce6 100644 --- a/examples/hiredis.c +++ b/examples/hiredis.c @@ -7,11 +7,11 @@ │ • http://creativecommons.org/publicdomain/zero/1.0/ │ ╚─────────────────────────────────────────────────────────────────*/ #endif -#include "libc/runtime/runtime.h" +#include "third_party/hiredis/hiredis.h" #include "libc/fmt/conv.h" +#include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "third_party/hiredis/hiredis.h" /** * @fileoverview Demo of using hiredis to connect to a Redis server diff --git a/examples/parsefloat.c b/examples/parsefloat.c index ea0fb87d1..c9f049aef 100644 --- a/examples/parsefloat.c +++ b/examples/parsefloat.c @@ -1,31 +1,31 @@ #include -#define PARSE_AND_PRINT(type, scan_fmt, print_fmt, str) \ - do { \ - type val; int ret; \ - ret = sscanf(str, scan_fmt, &val); \ - printf("\"%s\" => " print_fmt " = %d\n", str, val, ret); \ +#define PARSE_AND_PRINT(type, scan_fmt, print_fmt, str) \ + do { \ + type val; \ + int ret; \ + ret = sscanf(str, scan_fmt, &val); \ + printf("\"%s\" => " print_fmt " = %d\n", str, val, ret); \ } while (0) -int main() -{ - PARSE_AND_PRINT(float, "%f", "%f", "0.3715"); - PARSE_AND_PRINT(float, "%f", "%f", ".3715"); - PARSE_AND_PRINT(float, "%f", "%f", "3715"); - PARSE_AND_PRINT(float, "%f", "%f", "111.11"); - PARSE_AND_PRINT(float, "%f", "%f", "-2.22"); - PARSE_AND_PRINT(float, "%f", "%f", "Nan"); - PARSE_AND_PRINT(float, "%f", "%f", "nAn(2)"); - PARSE_AND_PRINT(float, "%f", "%f", "-NAN(_asdfZXCV1234_)"); - PARSE_AND_PRINT(float, "%f", "%f", "-nan"); - PARSE_AND_PRINT(float, "%f", "%f", "+nan"); - PARSE_AND_PRINT(float, "%f", "%f", "inF"); - PARSE_AND_PRINT(float, "%f", "%f", "iNfINiTy"); - PARSE_AND_PRINT(float, "%f", "%f", "+inf"); - PARSE_AND_PRINT(float, "%f", "%f", "-inf"); - PARSE_AND_PRINT(float, "%f", "%f", "0X1.BC70A3D70A3D7P+6"); - PARSE_AND_PRINT(float, "%f", "%f", "1.18973e+4932zzz"); - PARSE_AND_PRINT(float, "%f", "%.10f", " -0.0000000123junk"); - PARSE_AND_PRINT(float, "%f", "%f", "junk"); - return 0; +int main() { + PARSE_AND_PRINT(float, "%f", "%f", "0.3715"); + PARSE_AND_PRINT(float, "%f", "%f", ".3715"); + PARSE_AND_PRINT(float, "%f", "%f", "3715"); + PARSE_AND_PRINT(float, "%f", "%f", "111.11"); + PARSE_AND_PRINT(float, "%f", "%f", "-2.22"); + PARSE_AND_PRINT(float, "%f", "%f", "Nan"); + PARSE_AND_PRINT(float, "%f", "%f", "nAn(2)"); + PARSE_AND_PRINT(float, "%f", "%f", "-NAN(_asdfZXCV1234_)"); + PARSE_AND_PRINT(float, "%f", "%f", "-nan"); + PARSE_AND_PRINT(float, "%f", "%f", "+nan"); + PARSE_AND_PRINT(float, "%f", "%f", "inF"); + PARSE_AND_PRINT(float, "%f", "%f", "iNfINiTy"); + PARSE_AND_PRINT(float, "%f", "%f", "+inf"); + PARSE_AND_PRINT(float, "%f", "%f", "-inf"); + PARSE_AND_PRINT(float, "%f", "%f", "0X1.BC70A3D70A3D7P+6"); + PARSE_AND_PRINT(float, "%f", "%f", "1.18973e+4932zzz"); + PARSE_AND_PRINT(float, "%f", "%.10f", " -0.0000000123junk"); + PARSE_AND_PRINT(float, "%f", "%f", "junk"); + return 0; } diff --git a/examples/unbourne.c b/examples/unbourne.c index 034ad8aff..ebaf1fcbb 100644 --- a/examples/unbourne.c +++ b/examples/unbourne.c @@ -2601,7 +2601,8 @@ static int shlex() { case 'y': case 'z': p = buf; - while (buf++, is_in_name(*buf)); + while (buf++, is_in_name(*buf)) + ; yylval.name = stalloc(buf - p + 1); *(char *)mempcpy(yylval.name, p, buf - p) = 0; value = ARITH_VAR; @@ -7757,7 +7758,8 @@ static int ulimitcmd(int argc, char **argv) { what = optc; } } - for (l = limits; l->option != what; l++); + for (l = limits; l->option != what; l++) + ; set = *argptr ? 1 : 0; if (set) { char *p = *argptr; @@ -7986,7 +7988,8 @@ static void setparam(char **argv) { char **newparam; char **ap; int nparam; - for (nparam = 0; argv[nparam]; nparam++); + for (nparam = 0; argv[nparam]; nparam++) + ; ap = newparam = ckmalloc((nparam + 1) * sizeof *ap); while (*argv) { *ap++ = savestr(*argv++); @@ -8664,7 +8667,8 @@ static void parsefname(void) { if (heredoclist == NULL) heredoclist = here; else { - for (p = heredoclist; p->next; p = p->next); + for (p = heredoclist; p->next; p = p->next) + ; p->next = here; } } else if (n->type == NTOFD || n->type == NFROMFD) { @@ -8788,7 +8792,8 @@ static int xxreadtoken(void) { case '\t': continue; case '#': - while ((c = pgetc()) != '\n' && c != PEOF); + while ((c = pgetc()) != '\n' && c != PEOF) + ; pungetc(); continue; case '\n': @@ -8912,7 +8917,7 @@ static int readtoken1(int firstc, char const *syntax, char *eofmark, quotef = 0; bqlist = NULL; STARTSTACKSTR(out); -loop: { /* for each line, until end of word */ +loop : { /* for each line, until end of word */ CHECKEND(); /* set c to PEOF if at end of here document */ for (;;) { /* until end of line or end of word */ CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ @@ -9064,7 +9069,7 @@ endword: * is called, c is set to the first character of the next input line. If * we are at the end of the here document, this routine sets the c to PEOF. */ -checkend: { +checkend : { if (realeofmark(eofmark)) { int markloc; char *p; @@ -9107,7 +9112,7 @@ checkend: { * specifying the fd to be redirected. The variable "c" contains the * first character of the redirection operator. */ -parseredir: { +parseredir : { char fd = *out; union node *np; np = (union node *)stalloc(sizeof(struct nfile)); @@ -9164,7 +9169,7 @@ parseredir: { * Parse a substitution. At this point, we have read the dollar sign * and nothing else. */ -parsesub: { +parsesub : { int subtype; int typeloc; char *p; @@ -9282,7 +9287,7 @@ parsesub: { * list of commands (passed by reference), and savelen is the number of * characters on the top of the stack which must be preserved. */ -parsebackq: { +parsebackq : { struct nodelist **nlpp; union node *n; char *str; @@ -9377,7 +9382,7 @@ parsebackq: { /* * Parse an arithmetic expansion (indicate start of one and set state) */ -parsearith: { +parsearith : { synstack_push(&synstack, synstack->prev ?: alloca(sizeof(*synstack)), ARISYNTAX); synstack->dblquote = 1; diff --git a/examples/walk.c b/examples/walk.c index b41f6d981..56f4ec049 100644 --- a/examples/walk.c +++ b/examples/walk.c @@ -9,11 +9,11 @@ #endif #include "libc/errno.h" #include "libc/runtime/runtime.h" +#include "libc/stdio/ftw.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/sysv/consts/exit.h" #include "libc/sysv/consts/s.h" -#include "libc/stdio/ftw.h" /** * @fileoverview Directory walker example. diff --git a/libc/calls/cp.internal.h b/libc/calls/cp.internal.h index d727fbdd0..ca75f030a 100644 --- a/libc/calls/cp.internal.h +++ b/libc/calls/cp.internal.h @@ -10,12 +10,12 @@ void end_cancelation_point(int); #define END_CANCELATION_POINT (void)0 #else #define BEGIN_CANCELATION_POINT \ - do { \ - int _Cp; \ + do { \ + int _Cp; \ _Cp = begin_cancelation_point() #define END_CANCELATION_POINT \ end_cancelation_point(_Cp); \ - } \ + } \ while (0) #endif diff --git a/libc/calls/dup.c b/libc/calls/dup.c index af23647e9..caab149ee 100644 --- a/libc/calls/dup.c +++ b/libc/calls/dup.c @@ -23,8 +23,8 @@ #include "libc/dce.h" #include "libc/intrin/strace.internal.h" #include "libc/intrin/weaken.h" -#include "libc/sysv/errfuns.h" #include "libc/runtime/zipos.internal.h" +#include "libc/sysv/errfuns.h" /** * Duplicates file descriptor. diff --git a/libc/calls/dup2.c b/libc/calls/dup2.c index 72d0f3e38..34d42dd12 100644 --- a/libc/calls/dup2.c +++ b/libc/calls/dup2.c @@ -76,7 +76,7 @@ int dup2(int oldfd, int newfd) { rc = oldfd; } else #endif - if (!IsWindows()) { + if (!IsWindows()) { if (__isfdkind(oldfd, kFdZip) || __isfdkind(newfd, kFdZip)) { if (__vforked) { return enotsup(); diff --git a/libc/calls/ioctl.c b/libc/calls/ioctl.c index 21434d00e..87ea17031 100644 --- a/libc/calls/ioctl.c +++ b/libc/calls/ioctl.c @@ -66,7 +66,7 @@ static struct HostAdapterInfoNode { struct sockaddr netmask; struct sockaddr broadcast; short flags; -} * __hostInfo; +} *__hostInfo; static int ioctl_default(int fd, unsigned long request, void *arg) { int rc; diff --git a/libc/calls/isapemagic.c b/libc/calls/isapemagic.c index fa4f8b75e..a1ca56460 100644 --- a/libc/calls/isapemagic.c +++ b/libc/calls/isapemagic.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/serialize.h" #include "libc/proc/execve.internal.h" +#include "libc/serialize.h" /** * Returns true if executable image is supported by APE Loader. diff --git a/libc/calls/linkat.c b/libc/calls/linkat.c index d2a780d0b..1b87e3093 100644 --- a/libc/calls/linkat.c +++ b/libc/calls/linkat.c @@ -24,8 +24,8 @@ #include "libc/intrin/describeflags.internal.h" #include "libc/intrin/strace.internal.h" #include "libc/intrin/weaken.h" -#include "libc/sysv/errfuns.h" #include "libc/runtime/zipos.internal.h" +#include "libc/sysv/errfuns.h" /** * Creates hard filesystem link. diff --git a/libc/calls/mkdirat.c b/libc/calls/mkdirat.c index fbc1d51c3..d23facbf7 100644 --- a/libc/calls/mkdirat.c +++ b/libc/calls/mkdirat.c @@ -24,9 +24,9 @@ #include "libc/intrin/describeflags.internal.h" #include "libc/intrin/strace.internal.h" #include "libc/intrin/weaken.h" +#include "libc/runtime/zipos.internal.h" #include "libc/sysv/consts/at.h" #include "libc/sysv/errfuns.h" -#include "libc/runtime/zipos.internal.h" /** * Creates directory a.k.a. folder. diff --git a/libc/calls/openat-metal.c b/libc/calls/openat-metal.c index 92baca705..34d4d799d 100644 --- a/libc/calls/openat-metal.c +++ b/libc/calls/openat-metal.c @@ -27,13 +27,13 @@ #include "libc/mem/mem.h" #include "libc/runtime/pc.internal.h" #include "libc/runtime/runtime.h" +#include "libc/runtime/zipos.internal.h" #include "libc/str/str.h" #include "libc/sysv/consts/at.h" #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/prot.h" #include "libc/sysv/errfuns.h" -#include "libc/runtime/zipos.internal.h" #ifdef __x86_64__ diff --git a/libc/calls/renameat.c b/libc/calls/renameat.c index d00c82941..02106a4e8 100644 --- a/libc/calls/renameat.c +++ b/libc/calls/renameat.c @@ -24,9 +24,9 @@ #include "libc/intrin/describeflags.internal.h" #include "libc/intrin/strace.internal.h" #include "libc/intrin/weaken.h" +#include "libc/runtime/zipos.internal.h" #include "libc/sysv/consts/at.h" #include "libc/sysv/errfuns.h" -#include "libc/runtime/zipos.internal.h" /** * Renames files relative to directories. diff --git a/libc/calls/ttyname.c b/libc/calls/ttyname.c index 9a2ff2a5a..31b1fc202 100644 --- a/libc/calls/ttyname.c +++ b/libc/calls/ttyname.c @@ -17,10 +17,10 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/stdio/sysparam.h" #include "libc/errno.h" #include "libc/log/log.h" #include "libc/paths.h" +#include "libc/stdio/sysparam.h" /** * Returns name of terminal. diff --git a/libc/calls/unlinkat.c b/libc/calls/unlinkat.c index a1fe186eb..939c77091 100644 --- a/libc/calls/unlinkat.c +++ b/libc/calls/unlinkat.c @@ -26,9 +26,9 @@ #include "libc/intrin/describeflags.internal.h" #include "libc/intrin/strace.internal.h" #include "libc/intrin/weaken.h" +#include "libc/runtime/zipos.internal.h" #include "libc/sysv/consts/s.h" #include "libc/sysv/errfuns.h" -#include "libc/runtime/zipos.internal.h" /** * Deletes inode and maybe the file too. diff --git a/libc/elf/tinyelf.internal.h b/libc/elf/tinyelf.internal.h index ca00d3ce7..c4e20ef87 100644 --- a/libc/elf/tinyelf.internal.h +++ b/libc/elf/tinyelf.internal.h @@ -5,9 +5,9 @@ #include "libc/elf/struct/phdr.h" #include "libc/elf/struct/shdr.h" #include "libc/elf/struct/sym.h" -#include "libc/serialize.h" #include "libc/limits.h" #include "libc/log/libfatal.internal.h" +#include "libc/serialize.h" COSMOPOLITAN_C_START_ #define GetStr(tab, rva) ((char *)(tab) + (rva)) @@ -30,7 +30,8 @@ static inline char *GetStrtab(const Elf64_Ehdr *e, size_t *n) { if (shdr->sh_type == SHT_STRTAB) { name = GetSectionName(e, GetShdr(e, i)); if (name && READ64LE(name) == READ64LE(".strtab")) { - if (n) *n = shdr->sh_size; + if (n) + *n = shdr->sh_size; return GetSection(e, shdr); } } @@ -44,7 +45,8 @@ static inline Elf64_Sym *GetSymtab(const Elf64_Ehdr *e, Elf64_Xword *n) { for (i = e->e_shnum; i-- > 0;) { shdr = GetShdr(e, i); if (shdr->sh_type == SHT_SYMTAB) { - if (n) *n = shdr->sh_size / sizeof(Elf64_Sym); + if (n) + *n = shdr->sh_size / sizeof(Elf64_Sym); return GetSection(e, shdr); } } @@ -60,14 +62,19 @@ static inline void GetImageRange(const Elf64_Ehdr *elf, intptr_t *x, end = 0; for (i = 0; i < elf->e_phnum; ++i) { phdr = GetPhdr(elf, i); - if (phdr->p_type != PT_LOAD) continue; + if (phdr->p_type != PT_LOAD) + continue; pstart = phdr->p_vaddr; pend = phdr->p_vaddr + phdr->p_memsz; - if (pstart < start) start = pstart; - if (pend > end) end = pend; + if (pstart < start) + start = pstart; + if (pend > end) + end = pend; } - if (x) *x = start; - if (y) *y = end; + if (x) + *x = start; + if (y) + *y = end; } static inline bool GetElfSymbolValue(const Elf64_Ehdr *ehdr, const char *name, @@ -75,8 +82,10 @@ static inline bool GetElfSymbolValue(const Elf64_Ehdr *ehdr, const char *name, Elf64_Xword i, n; const char *stab; const Elf64_Sym *st; - if (!(stab = GetStrtab(ehdr, 0))) return false; - if (!(st = GetSymtab(ehdr, &n))) return false; + if (!(stab = GetStrtab(ehdr, 0))) + return false; + if (!(st = GetSymtab(ehdr, &n))) + return false; for (i = 0; i < n; ++i) { if (!__strcmp(GetStr(stab, st[i].st_name), name)) { *res = st[i].st_value; diff --git a/libc/fmt/internal.h b/libc/fmt/internal.h index 7ea0ca33a..b05b1085b 100644 --- a/libc/fmt/internal.h +++ b/libc/fmt/internal.h @@ -3,13 +3,16 @@ #include "libc/errno.h" #include "libc/str/str.h" -#define CONSUME_SPACES(t, s, c) \ - if (endptr) *endptr = (t *)(s); \ - while (c == ' ' || c == '\t') c = *++s +#define CONSUME_SPACES(t, s, c) \ + if (endptr) \ + *endptr = (t *)(s); \ + while (c == ' ' || c == '\t') \ + c = *++s -#define GET_SIGN(s, c, d) \ - d = c == '-' ? -1 : 1; \ - if (c == '-' || c == '+') c = *++s +#define GET_SIGN(s, c, d) \ + d = c == '-' ? -1 : 1; \ + if (c == '-' || c == '+') \ + c = *++s #define GET_RADIX(s, c, r) \ if (!r) { \ diff --git a/libc/intrin/dll.h b/libc/intrin/dll.h index 65b701471..3b056a5d3 100644 --- a/libc/intrin/dll.h +++ b/libc/intrin/dll.h @@ -33,19 +33,22 @@ static inline struct Dll *dll_last(struct Dll *list) { static inline struct Dll *dll_first(struct Dll *list) { struct Dll *first = 0; - if (list) first = list->next; + if (list) + first = list->next; return first; } static inline struct Dll *dll_next(struct Dll *list, struct Dll *e) { struct Dll *next = 0; - if (e != list) next = e->next; + if (e != list) + next = e->next; return next; } static inline struct Dll *dll_prev(struct Dll *list, struct Dll *e) { struct Dll *prev = 0; - if (e != list->next) prev = e->prev; + if (e != list->next) + prev = e->prev; return prev; } diff --git a/libc/intrin/float16.c b/libc/intrin/float16.c index 476a2f6c9..7da05312d 100644 --- a/libc/intrin/float16.c +++ b/libc/intrin/float16.c @@ -22,7 +22,7 @@ */ #define asint(x) ((union pun){x}).i -#define isnan(x) (((x) & 0x7fff) > 0x7c00) +#define isnan(x) (((x)&0x7fff) > 0x7c00) union pun { _Float16 f; diff --git a/libc/intrin/kprintf.h b/libc/intrin/kprintf.h index ea654acb2..d2844eb95 100644 --- a/libc/intrin/kprintf.h +++ b/libc/intrin/kprintf.h @@ -49,7 +49,8 @@ void uvprintf(const char *, va_list) libcesque; do { \ kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \ ##__VA_ARGS__); \ - for (;;) asm volatile("cli\n\thlt"); \ + for (;;) \ + asm volatile("cli\n\thlt"); \ } while (0) COSMOPOLITAN_C_END_ diff --git a/libc/intrin/mman.greg.c b/libc/intrin/mman.greg.c index cb9274a1b..d30a3e311 100644 --- a/libc/intrin/mman.greg.c +++ b/libc/intrin/mman.greg.c @@ -45,7 +45,7 @@ #ifdef __x86_64__ #define INVERT(x) (BANE + PHYSICAL((uintptr_t)(x))) -#define NOPAGE ((uint64_t) - 1) +#define NOPAGE ((uint64_t)-1) #define APE_STACK_VADDR \ ({ \ diff --git a/libc/intrin/repmovsb.h b/libc/intrin/repmovsb.h index 02a167524..cfa8f4019 100644 --- a/libc/intrin/repmovsb.h +++ b/libc/intrin/repmovsb.h @@ -5,7 +5,8 @@ forceinline void repmovsb(void **dest, const void **src, size_t cx) { char *di = (char *)*dest; const char *si = (const char *)*src; - while (cx) *di++ = *si++, cx--; + while (cx) + *di++ = *si++, cx--; *dest = di, *src = si; } diff --git a/libc/intrin/repstosb.h b/libc/intrin/repstosb.h index d0b75a05f..4b5983563 100644 --- a/libc/intrin/repstosb.h +++ b/libc/intrin/repstosb.h @@ -4,7 +4,8 @@ forceinline void *repstosb(void *dest, unsigned char al, size_t cx) { unsigned char *di = (unsigned char *)dest; - while (cx) *di++ = al, cx--; + while (cx) + *di++ = al, cx--; return di; } diff --git a/libc/intrin/safemacros.internal.h b/libc/intrin/safemacros.internal.h index 87b39dadd..443843f37 100644 --- a/libc/intrin/safemacros.internal.h +++ b/libc/intrin/safemacros.internal.h @@ -48,7 +48,8 @@ COSMOPOLITAN_C_START_ ({ \ autotype(a) FirstNonNullA = (a); \ autotype(a) FirstNonNullB = (b); \ - if (!FirstNonNullA && !FirstNonNullB) abort(); \ + if (!FirstNonNullA && !FirstNonNullB) \ + abort(); \ FirstNonNullA ? FirstNonNullA : FirstNonNullB; \ }) diff --git a/libc/intrin/stackchkfail.c b/libc/intrin/stackchkfail.c index 914e16482..b58f32c4f 100644 --- a/libc/intrin/stackchkfail.c +++ b/libc/intrin/stackchkfail.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/errno.h" #include "libc/intrin/kprintf.h" #include "libc/runtime/internal.h" -#include "libc/errno.h" #include "libc/runtime/runtime.h" __attribute__((__weak__)) void __stack_chk_fail(void) { diff --git a/libc/intrin/strlen.c b/libc/intrin/strlen.c index aabf2bfe4..b194e208d 100644 --- a/libc/intrin/strlen.c +++ b/libc/intrin/strlen.c @@ -31,7 +31,7 @@ static __vex size_t __strlen(const char *s) { m = __builtin_ia32_pmovmskb128(*++p == z); return (const char *)p + __builtin_ctzl(m) - s; #else -#define ONES ((word) - 1 / 255) +#define ONES ((word)-1 / 255) #define BANE (ONES * (255 / 2 + 1)) typedef unsigned long mayalias word; word w; diff --git a/libc/irq/acpi-fadt.c b/libc/irq/acpi-fadt.c index cab665855..f29fbaf48 100644 --- a/libc/irq/acpi-fadt.c +++ b/libc/irq/acpi-fadt.c @@ -62,8 +62,8 @@ textstartup void _AcpiFadtInit(void) { _Static_assert(offsetof(AcpiTableFadt, Dsdt) == 40); _Static_assert(offsetof(AcpiTableFadt, BootFlags) == 109); _Static_assert(offsetof(AcpiTableFadt, XDsdt) == 140); - if (length >= offsetof(AcpiTableFadt, BootFlags) + sizeof(fadt->BootFlags)) - { + if (length >= + offsetof(AcpiTableFadt, BootFlags) + sizeof(fadt->BootFlags)) { _AcpiBootFlags = flags = fadt->BootFlags; KINFOF("FADT: boot flags %#x", (unsigned)flags); } diff --git a/libc/irq/acpi-xsdt.c b/libc/irq/acpi-xsdt.c index eb91724f2..e37f92a3d 100644 --- a/libc/irq/acpi-xsdt.c +++ b/libc/irq/acpi-xsdt.c @@ -26,7 +26,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" #include "libc/intrin/atomic.h" -#include "libc/serialize.h" #include "libc/intrin/directmap.internal.h" #include "libc/intrin/kprintf.h" #include "libc/irq/acpi.internal.h" @@ -34,6 +33,7 @@ #include "libc/macros.internal.h" #include "libc/nt/efi.h" #include "libc/runtime/pc.internal.h" +#include "libc/serialize.h" #include "libc/str/str.h" #include "libc/sysv/consts/map.h" #include "libc/sysv/consts/prot.h" diff --git a/libc/iso646.internal.h b/libc/iso646.internal.h index e96f85389..e2933b161 100644 --- a/libc/iso646.internal.h +++ b/libc/iso646.internal.h @@ -2,16 +2,16 @@ #define COSMOPOLITAN_LIBC_ISO646_H_ #ifndef __cplusplus -#define and && +#define and && #define and_eq &= #define bitand & -#define bitor | -#define compl ~ -#define not ! +#define bitor | +#define compl ~ +#define not ! #define not_eq != -#define or || -#define or_eq |= -#define xor ^ +#define or || +#define or_eq |= +#define xor ^ #define xor_eq ^= #endif /* __cplusplus */ diff --git a/libc/isystem/cxxabi.h b/libc/isystem/cxxabi.h index 79cae3499..b707b2d89 100644 --- a/libc/isystem/cxxabi.h +++ b/libc/isystem/cxxabi.h @@ -1,5 +1,5 @@ #ifndef COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ -#include "third_party/libcxxabi/include/cxxabi.h" #include "libc/cxxabi.h" +#include "third_party/libcxxabi/include/cxxabi.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_CXXABI_H_ */ diff --git a/libc/isystem/ftw.h b/libc/isystem/ftw.h index 611afc397..e00ae2b0f 100644 --- a/libc/isystem/ftw.h +++ b/libc/isystem/ftw.h @@ -1,6 +1,6 @@ #ifndef _FTW_H #define _FTW_H #include "libc/calls/weirdtypes.h" -#include "libc/sysv/consts/s.h" #include "libc/stdio/ftw.h" +#include "libc/sysv/consts/s.h" #endif /* _FTW_H */ diff --git a/libc/isystem/sys/param.h b/libc/isystem/sys/param.h index 8fbbcc0b8..d7691a360 100644 --- a/libc/isystem/sys/param.h +++ b/libc/isystem/sys/param.h @@ -1,12 +1,12 @@ #ifndef COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_ #define COSMOPOLITAN_LIBC_ISYSTEM_SYS_PARAM_H_ -#include "libc/intrin/newbie.h" #include "libc/calls/calls.h" #include "libc/calls/struct/rlimit.h" #include "libc/calls/struct/rusage.h" -#include "libc/stdio/sysparam.h" #include "libc/calls/weirdtypes.h" +#include "libc/intrin/newbie.h" #include "libc/limits.h" +#include "libc/stdio/sysparam.h" #include "libc/sysv/consts/endian.h" #include "libc/sysv/consts/prio.h" #include "libc/sysv/consts/rlim.h" diff --git a/libc/isystem/sys/signal.h b/libc/isystem/sys/signal.h index 5982f049a..ab2de67e2 100644 --- a/libc/isystem/sys/signal.h +++ b/libc/isystem/sys/signal.h @@ -3,6 +3,6 @@ #include "libc/calls/calls.h" #include "libc/calls/struct/sigaction.h" #include "libc/calls/struct/siginfo.h" -#include "libc/sysv/consts/sig.h" #include "libc/sysv/consts/sicode.h" +#include "libc/sysv/consts/sig.h" #endif /* COSMOPOLITAN_LIBC_ISYSTEM_SYS_SIGNAL_H_ */ diff --git a/libc/isystem/tgmath.h b/libc/isystem/tgmath.h index a62b88a59..28d124486 100644 --- a/libc/isystem/tgmath.h +++ b/libc/isystem/tgmath.h @@ -7,324 +7,316 @@ /* from https://en.cppreference.com/w/c/numeric/tgmath */ -#define fabs(x) \ - _Generic((x), float \ - : fabsf, default \ - : fabs, long double \ - : fabsl, complex float \ - : cabsf, complex double \ - : cabs, complex long double \ - : cabsl)(x) +#define fabs(x) \ + _Generic((x), \ + float: fabsf, \ + default: fabs, \ + long double: fabsl, \ + complex float: cabsf, \ + complex double: cabs, \ + complex long double: cabsl)(x) -#define exp(x) \ - _Generic((x), float \ - : expf, default \ - : exp, long double \ - : expl, complex float \ - : cexpf, complex double \ - : cexp, complex long double \ - : cexpl)(x) +#define exp(x) \ + _Generic((x), \ + float: expf, \ + default: exp, \ + long double: expl, \ + complex float: cexpf, \ + complex double: cexp, \ + complex long double: cexpl)(x) -#define log(x) \ - _Generic((x), float \ - : logf, default \ - : log, long double \ - : logl, complex float \ - : clogf, complex double \ - : clog, complex long double \ - : clogl)(x) +#define log(x) \ + _Generic((x), \ + float: logf, \ + default: log, \ + long double: logl, \ + complex float: clogf, \ + complex double: clog, \ + complex long double: clogl)(x) -#define pow(x, y) \ - _Generic((x), float \ - : powf, default \ - : pow, long double \ - : powl, complex float \ - : cpowf, complex double \ - : cpow, complex long double \ - : cpowl)(x, y) +#define pow(x, y) \ + _Generic((x), \ + float: powf, \ + default: pow, \ + long double: powl, \ + complex float: cpowf, \ + complex double: cpow, \ + complex long double: cpowl)(x, y) -#define sqrt(x) \ - _Generic((x), float \ - : sqrtf, default \ - : sqrt, long double \ - : sqrtl, complex float \ - : csqrtf, complex double \ - : csqrt, complex long double \ - : csqrtl)(x) +#define sqrt(x) \ + _Generic((x), \ + float: sqrtf, \ + default: sqrt, \ + long double: sqrtl, \ + complex float: csqrtf, \ + complex double: csqrt, \ + complex long double: csqrtl)(x) -#define sin(x) \ - _Generic((x), float \ - : sinf, default \ - : sin, long double \ - : sinl, complex float \ - : csinf, complex double \ - : csin, complex long double \ - : csinl)(x) +#define sin(x) \ + _Generic((x), \ + float: sinf, \ + default: sin, \ + long double: sinl, \ + complex float: csinf, \ + complex double: csin, \ + complex long double: csinl)(x) -#define cos(x) \ - _Generic((x), float \ - : cosf, default \ - : cos, long double \ - : cosl, complex float \ - : ccosf, complex double \ - : ccos, complex long double \ - : ccosl)(x) +#define cos(x) \ + _Generic((x), \ + float: cosf, \ + default: cos, \ + long double: cosl, \ + complex float: ccosf, \ + complex double: ccos, \ + complex long double: ccosl)(x) -#define tan(x) \ - _Generic((x), float \ - : tanf, default \ - : tan, long double \ - : tanl, complex float \ - : ctanf, complex double \ - : ctan, complex long double \ - : ctanl)(x) +#define tan(x) \ + _Generic((x), \ + float: tanf, \ + default: tan, \ + long double: tanl, \ + complex float: ctanf, \ + complex double: ctan, \ + complex long double: ctanl)(x) -#define asin(x) \ - _Generic((x), float \ - : asinf, default \ - : asin, long double \ - : asinl, complex float \ - : casinf, complex double \ - : casin, complex long double \ - : casinl)(x) +#define asin(x) \ + _Generic((x), \ + float: asinf, \ + default: asin, \ + long double: asinl, \ + complex float: casinf, \ + complex double: casin, \ + complex long double: casinl)(x) -#define acos(x) \ - _Generic((x), float \ - : acosf, default \ - : acos, long double \ - : acosl, complex float \ - : cacosf, complex double \ - : cacos, complex long double \ - : cacosl)(x) +#define acos(x) \ + _Generic((x), \ + float: acosf, \ + default: acos, \ + long double: acosl, \ + complex float: cacosf, \ + complex double: cacos, \ + complex long double: cacosl)(x) -#define atan(x) \ - _Generic((x), float \ - : atanf, default \ - : atan, long double \ - : atanl, complex float \ - : catanf, complex double \ - : catan, complex long double \ - : catanl)(x) +#define atan(x) \ + _Generic((x), \ + float: atanf, \ + default: atan, \ + long double: atanl, \ + complex float: catanf, \ + complex double: catan, \ + complex long double: catanl)(x) -#define sinh(x) \ - _Generic((x), float \ - : sinhf, default \ - : sinh, long double \ - : sinhl, complex float \ - : csinhf, complex double \ - : csinh, complex long double \ - : csinhl)(x) +#define sinh(x) \ + _Generic((x), \ + float: sinhf, \ + default: sinh, \ + long double: sinhl, \ + complex float: csinhf, \ + complex double: csinh, \ + complex long double: csinhl)(x) -#define cosh(x) \ - _Generic((x), float \ - : coshf, default \ - : cosh, long double \ - : coshl, complex float \ - : ccoshf, complex double \ - : ccosh, complex long double \ - : ccoshl)(x) +#define cosh(x) \ + _Generic((x), \ + float: coshf, \ + default: cosh, \ + long double: coshl, \ + complex float: ccoshf, \ + complex double: ccosh, \ + complex long double: ccoshl)(x) -#define tanh(x) \ - _Generic((x), float \ - : tanhf, default \ - : tanh, long double \ - : tanhl, complex float \ - : ctanhf, complex double \ - : ctanh, complex long double \ - : ctanhl)(x) +#define tanh(x) \ + _Generic((x), \ + float: tanhf, \ + default: tanh, \ + long double: tanhl, \ + complex float: ctanhf, \ + complex double: ctanh, \ + complex long double: ctanhl)(x) -#define asinh(x) \ - _Generic((x), float \ - : asinhf, default \ - : asinh, long double \ - : asinhl, complex float \ - : casinhf, complex double \ - : casinh, complex long double \ - : casinhl)(x) +#define asinh(x) \ + _Generic((x), \ + float: asinhf, \ + default: asinh, \ + long double: asinhl, \ + complex float: casinhf, \ + complex double: casinh, \ + complex long double: casinhl)(x) -#define acosh(x) \ - _Generic((x), float \ - : acoshf, default \ - : acosh, long double \ - : acoshl, complex float \ - : cacoshf, complex double \ - : cacosh, complex long double \ - : cacoshl)(x) +#define acosh(x) \ + _Generic((x), \ + float: acoshf, \ + default: acosh, \ + long double: acoshl, \ + complex float: cacoshf, \ + complex double: cacosh, \ + complex long double: cacoshl)(x) -#define atanh(x) \ - _Generic((x), float \ - : atanhf, default \ - : atanh, long double \ - : atanhl, complex float \ - : catanhf, complex double \ - : catanh, complex long double \ - : catanhl)(x) +#define atanh(x) \ + _Generic((x), \ + float: atanhf, \ + default: atanh, \ + long double: atanhl, \ + complex float: catanhf, \ + complex double: catanh, \ + complex long double: catanhl)(x) #define atan2(x, y) \ - _Generic((x), float : atan2f, default : atan2, long double : atan2l)(x, y) + _Generic((x), float: atan2f, default: atan2, long double: atan2l)(x, y) #define cbrt(x) \ - _Generic((x), float : cbrtf, default : cbrt, long double : cbrtl)(x) + _Generic((x), float: cbrtf, default: cbrt, long double: cbrtl)(x) #define ceil(x) \ - _Generic((x), float : ceilf, default : ceil, long double : ceill)(x) + _Generic((x), float: ceilf, default: ceil, long double: ceill)(x) -#define copysign(x, y) \ - _Generic((x), float \ - : copysignf, default \ - : copysign, long double \ - : copysignl)(x, y) +#define copysign(x, y) \ + _Generic((x), float: copysignf, default: copysign, long double: copysignl)( \ + x, y) -#define erf(x) _Generic((x), float : erff, default : erf, long double : erfl)(x) +#define erf(x) _Generic((x), float: erff, default: erf, long double: erfl)(x) #define erfc(x) \ - _Generic((x), float : erfcf, default : erfc, long double : erfcl)(x) + _Generic((x), float: erfcf, default: erfc, long double: erfcl)(x) #define exp2(x) \ - _Generic((x), float : exp2f, default : exp2, long double : exp2l)(x) + _Generic((x), float: exp2f, default: exp2, long double: exp2l)(x) #define expm1(x) \ - _Generic((x), float : expm1f, default : expm1, long double : expm1l)(x) + _Generic((x), float: expm1f, default: expm1, long double: expm1l)(x) #define fdim(x, y) \ - _Generic((x), float : fdimf, default : fdim, long double : fdiml)(x, y) + _Generic((x), float: fdimf, default: fdim, long double: fdiml)(x, y) #define floor(x) \ - _Generic((x), float : floorf, default : floor, long double : floorl)(x) + _Generic((x), float: floorf, default: floor, long double: floorl)(x) #define fma(x, y, z) \ - _Generic((x), float : fmaf, default : fma, long double : fmal)(x, y, z) + _Generic((x), float: fmaf, default: fma, long double: fmal)(x, y, z) #define fmax(x, y) \ - _Generic((x), float : fmaxf, default : fmax, long double : fmaxl)(x, y) + _Generic((x), float: fmaxf, default: fmax, long double: fmaxl)(x, y) #define fmin(x, y) \ - _Generic((x), float : fminf, default : fmin, long double : fminl)(x, y) + _Generic((x), float: fminf, default: fmin, long double: fminl)(x, y) #define fmod(x, y) \ - _Generic((x), float : fmodf, default : fmod, long double : fmodl)(x, y) + _Generic((x), float: fmodf, default: fmod, long double: fmodl)(x, y) #define frexp(x, y) \ - _Generic((x), float : frexpf, default : frexp, long double : frexpl)(x, y) + _Generic((x), float: frexpf, default: frexp, long double: frexpl)(x, y) #define hypot(x, y) \ - _Generic((x), float : hypotf, default : hypot, long double : hypotl)(x, y) + _Generic((x), float: hypotf, default: hypot, long double: hypotl)(x, y) #define ilogb(x) \ - _Generic((x), float : ilogbf, default : ilogb, long double : ilogbl)(x) + _Generic((x), float: ilogbf, default: ilogb, long double: ilogbl)(x) #define ldexp(x, y) \ - _Generic((x), float : ldexpf, default : ldexp, long double : ldexpl)(x, y) + _Generic((x), float: ldexpf, default: ldexp, long double: ldexpl)(x, y) #define lgamma(x) \ - _Generic((x), float : lgammaf, default : lgamma, long double : lgammal)(x) + _Generic((x), float: lgammaf, default: lgamma, long double: lgammal)(x) #define llrint(x) \ - _Generic((x), float : llrintf, default : llrint, long double : llrintl)(x) + _Generic((x), float: llrintf, default: llrint, long double: llrintl)(x) #define llround(x) \ - _Generic((x), float : llroundf, default : llround, long double : llroundl)(x) + _Generic((x), float: llroundf, default: llround, long double: llroundl)(x) #define log10(x) \ - _Generic((x), float : log10f, default : log10, long double : log10l)(x) + _Generic((x), float: log10f, default: log10, long double: log10l)(x) #define log1p(x) \ - _Generic((x), float : log1pf, default : log1p, long double : log1pl)(x) + _Generic((x), float: log1pf, default: log1p, long double: log1pl)(x) #define log2(x) \ - _Generic((x), float : log2f, default : log2, long double : log2l)(x) + _Generic((x), float: log2f, default: log2, long double: log2l)(x) #define logb(x) \ - _Generic((x), float : logbf, default : logb, long double : logbl)(x) + _Generic((x), float: logbf, default: logb, long double: logbl)(x) #define lrint(x) \ - _Generic((x), float : lrintf, default : lrint, long double : lrintl)(x) + _Generic((x), float: lrintf, default: lrint, long double: lrintl)(x) #define lround(x) \ - _Generic((x), float : lroundf, default : lround, long double : lroundl)(x) + _Generic((x), float: lroundf, default: lround, long double: lroundl)(x) -#define nearbyint(x) \ - _Generic((x), float \ - : nearbyintf, default \ - : nearbyint, long double \ - : nearbyintl)(x) +#define nearbyint(x) \ + _Generic((x), \ + float: nearbyintf, \ + default: nearbyint, \ + long double: nearbyintl)(x) -#define nextafter(x, y) \ - _Generic((x), float \ - : nextafterf, default \ - : nextafter, long double \ - : nextafterl)(x, y) +#define nextafter(x, y) \ + _Generic((x), \ + float: nextafterf, \ + default: nextafter, \ + long double: nextafterl)(x, y) -#define nexttoward(x, y) \ - _Generic((x), float \ - : nexttowardf, default \ - : nexttoward, long double \ - : nexttowardl)(x, y) +#define nexttoward(x, y) \ + _Generic((x), \ + float: nexttowardf, \ + default: nexttoward, \ + long double: nexttowardl)(x, y) -#define remainder(x, y) \ - _Generic((x), float \ - : remainderf, default \ - : remainder, long double \ - : remainderl)(x, y) +#define remainder(x, y) \ + _Generic((x), \ + float: remainderf, \ + default: remainder, \ + long double: remainderl)(x, y) -#define remquo(x, y, z) \ - _Generic((x), float \ - : remquof, default \ - : remquo, long double \ - : remquol)(x, y, z) +#define remquo(x, y, z) \ + _Generic((x), float: remquof, default: remquo, long double: remquol)(x, y, z) #define rint(x) \ - _Generic((x), float : rintf, default : rint, long double : rintl)(x) + _Generic((x), float: rintf, default: rint, long double: rintl)(x) #define round(x) \ - _Generic((x), float : roundf, default : round, long double : roundl)(x) + _Generic((x), float: roundf, default: round, long double: roundl)(x) -#define scalbln(x, y) \ - _Generic((x), float \ - : scalblnf, default \ - : scalbln, long double \ - : scalblnl)(x, y) +#define scalbln(x, y) \ + _Generic((x), float: scalblnf, default: scalbln, long double: scalblnl)(x, y) #define scalbn(x, y) \ - _Generic((x), float : scalbnf, default : scalbn, long double : scalbnl)(x, y) + _Generic((x), float: scalbnf, default: scalbn, long double: scalbnl)(x, y) #define tgamma(x) \ - _Generic((x), float : tgammaf, default : tgamma, long double : tgammal)(x) + _Generic((x), float: tgammaf, default: tgamma, long double: tgammal)(x) #define trunc(x) \ - _Generic((x), float : truncf, default : trunc, long double : truncl)(x) + _Generic((x), float: truncf, default: trunc, long double: truncl)(x) -#define carg(x) \ - _Generic((x), complex float \ - : cargf, default \ - : carg, complex long double \ - : cargl)(x) +#define carg(x) \ + _Generic((x), \ + complex float: cargf, \ + default: carg, \ + complex long double: cargl)(x) -#define conj(x) \ - _Generic((x), complex float \ - : conjf, default \ - : conj, complex long double \ - : conjl)(x) +#define conj(x) \ + _Generic((x), \ + complex float: conjf, \ + default: conj, \ + complex long double: conjl)(x) #undef creal -#define creal(x) \ - _Generic((x), complex float \ - : crealf, default \ - : creal, complex long double \ - : creall)(x) +#define creal(x) \ + _Generic((x), \ + complex float: crealf, \ + default: creal, \ + complex long double: creall)(x) #undef cimag -#define cimag(x) \ - _Generic((x), complex float \ - : cimagf, default \ - : cimag, complex long double \ - : cimagl)(x) +#define cimag(x) \ + _Generic((x), \ + complex float: cimagf, \ + default: cimag, \ + complex long double: cimagl)(x) -#define cproj(x) \ - _Generic((x), complex float \ - : cprojf, default \ - : cproj, complex long double \ - : cprojl)(x) +#define cproj(x) \ + _Generic((x), \ + complex float: cprojf, \ + default: cproj, \ + complex long double: cprojl)(x) #endif /* C11 */ #endif /* _TGMATH_H */ diff --git a/libc/log/appendresourcereport.c b/libc/log/appendresourcereport.c index cf9dca0e5..ed6b839d4 100644 --- a/libc/log/appendresourcereport.c +++ b/libc/log/appendresourcereport.c @@ -18,10 +18,10 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/struct/rusage.h" #include "libc/fmt/itoa.h" -#include "libc/serialize.h" #include "libc/log/log.h" #include "libc/math.h" #include "libc/runtime/clktck.h" +#include "libc/serialize.h" #include "libc/stdio/append.h" struct State { diff --git a/libc/log/countbranch.h b/libc/log/countbranch.h index 467d65e62..403a0c98e 100644 --- a/libc/log/countbranch.h +++ b/libc/log/countbranch.h @@ -36,7 +36,8 @@ COSMOPOLITAN_C_START_ : "=r"(Info)); \ Cond = (x); \ ++Info->total; \ - if (Cond) ++Info->taken; \ + if (Cond) \ + ++Info->taken; \ Cond; \ }) diff --git a/libc/log/gdb.h b/libc/log/gdb.h index a66eedf8d..26e252a7c 100644 --- a/libc/log/gdb.h +++ b/libc/log/gdb.h @@ -31,7 +31,8 @@ int AttachDebugger(intptr_t); while ((Rc = __inline_wait4(Pid, NULL, WNOHANG, NULL)) == 0) { \ if (g_gdbsync) { \ g_gdbsync = 0; \ - if (Rc > 0) Pid = 0; \ + if (Rc > 0) \ + Pid = 0; \ break; \ } else { \ sched_yield(); \ diff --git a/libc/log/libfatal.internal.h b/libc/log/libfatal.internal.h index fd0fee8c3..4c55269c4 100644 --- a/libc/log/libfatal.internal.h +++ b/libc/log/libfatal.internal.h @@ -5,13 +5,15 @@ COSMOPOLITAN_C_START_ forceinline unsigned long __strlen(const char *s) { unsigned long n = 0; - while (*s++) ++n; + while (*s++) + ++n; return n; } forceinline int __strcmp(const char *l, const char *r) { size_t i = 0; - while (l[i] == r[i] && r[i]) ++i; + while (l[i] == r[i] && r[i]) + ++i; return (l[i] & 255) - (r[i] & 255); } @@ -86,12 +88,14 @@ forceinline char *__uintcpy(char p[hasatleast 21], uint64_t x) { } forceinline char *__intcpy(char p[hasatleast 21], int64_t x) { - if (x < 0) *p++ = '-', x = -(uint64_t)x; + if (x < 0) + *p++ = '-', x = -(uint64_t)x; return __uintcpy(p, x); } forceinline char *__fixcpy(char p[hasatleast 17], uint64_t x, uint8_t k) { - while (k > 0) *p++ = "0123456789abcdef"[(x >> (k -= 4)) & 15]; + while (k > 0) + *p++ = "0123456789abcdef"[(x >> (k -= 4)) & 15]; *p = '\0'; return p; } @@ -114,11 +118,15 @@ forceinline char *__strstr(const char *haystack, const char *needle) { size_t i; for (;;) { for (i = 0;; ++i) { - if (!needle[i]) return (/*unconst*/ char *)haystack; - if (!haystack[i]) break; - if (needle[i] != haystack[i]) break; + if (!needle[i]) + return (/*unconst*/ char *)haystack; + if (!haystack[i]) + break; + if (needle[i] != haystack[i]) + break; } - if (!*haystack++) break; + if (!*haystack++) + break; } return 0; } @@ -128,35 +136,44 @@ forceinline char16_t *__strstr16(const char16_t *haystack, size_t i; for (;;) { for (i = 0;; ++i) { - if (!needle[i]) return (/*unconst*/ char16_t *)haystack; - if (!haystack[i]) break; - if (needle[i] != haystack[i]) break; + if (!needle[i]) + return (/*unconst*/ char16_t *)haystack; + if (!haystack[i]) + break; + if (needle[i] != haystack[i]) + break; } - if (!*haystack++) break; + if (!*haystack++) + break; } return 0; } forceinline const char *__strchr(const char *s, unsigned char c) { for (;; ++s) { - if ((*s & 255) == c) return s; - if (!*s) return 0; + if ((*s & 255) == c) + return s; + if (!*s) + return 0; } } forceinline unsigned long __atoul(const char *p) { int c; unsigned long x = 0; - while ('0' <= (c = *p++) && c <= '9') x *= 10, x += c - '0'; + while ('0' <= (c = *p++) && c <= '9') + x *= 10, x += c - '0'; return x; } forceinline long __atol(const char *p) { int s = *p; unsigned long x; - if (s == '-' || s == '+') ++p; + if (s == '-' || s == '+') + ++p; x = __atoul(p); - if (s == '-') x = -x; + if (s == '-') + x = -x; return x; } diff --git a/libc/log/log.h b/libc/log/log.h index 8e88377e2..d8e62f7ea 100644 --- a/libc/log/log.h +++ b/libc/log/log.h @@ -61,22 +61,26 @@ extern unsigned __log_level; /* log level for runtime check */ // log a message with the specified log level (not checking if LOGGABLE) #define LOGF(LEVEL, FMT, ...) \ do { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ flogf(LEVEL, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ } while (0) // report an error without backtrace and debugger invocation #define FATALF(FMT, ...) \ do { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ flogf(kLogError, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ _log_exit(1); \ } while (0) #define DIEF(FMT, ...) \ do { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ ffatalf(kLogFatal, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ __builtin_unreachable(); \ } while (0) @@ -105,51 +109,62 @@ extern unsigned __log_level; /* log level for runtime check */ #define VERBOSEF(FMT, ...) \ do { \ if (LOGGABLE(kLogVerbose)) { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ fverbosef(kLogVerbose, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ } \ } while (0) #define DEBUGF(FMT, ...) \ do { \ if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ fdebugf(kLogDebug, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ } \ } while (0) #define NOISEF(FMT, ...) \ do { \ if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ fnoisef(kLogNoise, __FILE__, __LINE__, NULL, FMT, ##__VA_ARGS__); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ } \ } while (0) #define FLOGF(F, FMT, ...) \ do { \ if (LOGGABLE(kLogInfo)) { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ flogf(kLogInfo, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ } \ } while (0) #define FWARNF(F, FMT, ...) \ do { \ if (LOGGABLE(kLogWarn)) { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ flogf(kLogWarn, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ } \ } while (0) #define FFATALF(F, FMT, ...) \ do { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ flogf(kLogError, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ _log_exit(1); \ } while (0) @@ -157,18 +172,22 @@ extern unsigned __log_level; /* log level for runtime check */ #define FDEBUGF(F, FMT, ...) \ do { \ if (_LOG_UNLIKELY(LOGGABLE(kLogDebug))) { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ fdebugf(kLogDebug, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ } \ } while (0) #define FNOISEF(F, FMT, ...) \ do { \ if (_LOG_UNLIKELY(LOGGABLE(kLogNoise))) { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ fnoisef(kLogNoise, __FILE__, __LINE__, F, FMT, ##__VA_ARGS__); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ } \ } while (0) @@ -177,9 +196,11 @@ extern unsigned __log_level; /* log level for runtime check */ int e = _log_get_errno(); \ autotype(FORM) Ax = (FORM); \ if (_LOG_UNLIKELY(Ax == (typeof(Ax))(-1)) && LOGGABLE(kLogWarn)) { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ _log_errno(__FILE__, __LINE__, #FORM); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ _log_set_errno(e); \ } \ Ax; \ @@ -190,9 +211,11 @@ extern unsigned __log_level; /* log level for runtime check */ int e = _log_get_errno(); \ autotype(FORM) Ax = (FORM); \ if (Ax == NULL && LOGGABLE(kLogWarn)) { \ - if (!_LOG_TINY) _log_untrace(); \ + if (!_LOG_TINY) \ + _log_untrace(); \ _log_errno(__FILE__, __LINE__, #FORM); \ - if (!_LOG_TINY) _log_retrace(); \ + if (!_LOG_TINY) \ + _log_retrace(); \ _log_set_errno(e); \ } \ Ax; \ diff --git a/libc/log/watch.c b/libc/log/watch.c index a3d4105ef..1cc96f767 100644 --- a/libc/log/watch.c +++ b/libc/log/watch.c @@ -16,12 +16,12 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/serialize.h" #include "libc/intrin/kprintf.h" #include "libc/log/backtrace.internal.h" #include "libc/log/log.h" #include "libc/runtime/runtime.h" #include "libc/runtime/symbols.internal.h" +#include "libc/serialize.h" #include "libc/sysv/errfuns.h" #ifdef __x86_64__ diff --git a/libc/macros.internal.h b/libc/macros.internal.h index ae6313384..396f2b749 100644 --- a/libc/macros.internal.h +++ b/libc/macros.internal.h @@ -21,8 +21,8 @@ #define TRUE 1 #define FALSE 0 -#define IS2POW(X) (!((X) & ((X) - 1))) -#define ROUNDUP(X, K) (((X) + (K) - 1) & -(K)) +#define IS2POW(X) (!((X) & ((X)-1))) +#define ROUNDUP(X, K) (((X) + (K)-1) & -(K)) #define ROUNDDOWN(X, K) ((X) & -(K)) #ifndef __ASSEMBLER__ #define ABS(X) ((X) >= 0 ? (X) : -(X)) @@ -40,7 +40,7 @@ #define STRINGIFY(A) __STRINGIFY(A) #define EQUIVALENT(X, Y) (__builtin_constant_p((X) == (Y)) && ((X) == (Y))) #define TYPE_BIT(type) (sizeof(type) * CHAR_BIT) -#define TYPE_SIGNED(type) (((type) - 1) < 0) +#define TYPE_SIGNED(type) (((type)-1) < 0) #define TYPE_INTEGRAL(type) (((type)0.5) != 0.5) #define ARRAYLEN(A) \ diff --git a/libc/nexgen32e/rdtscp.h b/libc/nexgen32e/rdtscp.h index 5bebc8735..ae7d5cf2d 100644 --- a/libc/nexgen32e/rdtscp.h +++ b/libc/nexgen32e/rdtscp.h @@ -5,7 +5,7 @@ #include "libc/nexgen32e/x86feature.h" COSMOPOLITAN_C_START_ -#define TSC_AUX_CORE(MSR) ((MSR) & 0xfff) +#define TSC_AUX_CORE(MSR) ((MSR)&0xfff) #define TSC_AUX_NODE(MSR) (((MSR) >> 12) & 0xfff) /** @@ -25,7 +25,8 @@ COSMOPOLITAN_C_START_ : /* no inputs */ \ : "memory"); \ EcxOut = (OPT_OUT_IA32_TSC_AUX); \ - if (EcxOut) *EcxOut = Ecx; \ + if (EcxOut) \ + *EcxOut = Ecx; \ Rdx << 32 | Rax; \ }) diff --git a/libc/nt/enum/consolemodeflags.h b/libc/nt/enum/consolemodeflags.h index a0d8bed14..595114cce 100644 --- a/libc/nt/enum/consolemodeflags.h +++ b/libc/nt/enum/consolemodeflags.h @@ -2,22 +2,22 @@ #define COSMOPOLITAN_LIBC_NT_ENUM_CONSOLEMODEFLAGS_H_ /* input mode */ -#define kNtEnableProcessedInput 0x0001u -#define kNtEnableLineInput 0x0002u -#define kNtEnableEchoInput 0x0004u -#define kNtEnableWindowInput 0x0008u -#define kNtEnableMouseInput 0x0010u -#define kNtEnableInsertMode 0x0020u -#define kNtEnableQuickEditMode 0x0040u -#define kNtEnableExtendedFlags 0x0080u -#define kNtEnableAutoPosition 0x0100u +#define kNtEnableProcessedInput 0x0001u +#define kNtEnableLineInput 0x0002u +#define kNtEnableEchoInput 0x0004u +#define kNtEnableWindowInput 0x0008u +#define kNtEnableMouseInput 0x0010u +#define kNtEnableInsertMode 0x0020u +#define kNtEnableQuickEditMode 0x0040u +#define kNtEnableExtendedFlags 0x0080u +#define kNtEnableAutoPosition 0x0100u #define kNtEnableVirtualTerminalInput 0x0200u /* output mode */ -#define kNtEnableProcessedOutput 0x0001u -#define kNtEnableWrapAtEolOutput 0x0002u +#define kNtEnableProcessedOutput 0x0001u +#define kNtEnableWrapAtEolOutput 0x0002u #define kNtEnableVirtualTerminalProcessing 0x0004u -#define kNtDisableNewlineAutoReturn 0x0008u -#define kNtEnableLvbGridWorldwide 0x0010u +#define kNtDisableNewlineAutoReturn 0x0008u +#define kNtEnableLvbGridWorldwide 0x0010u #endif /* COSMOPOLITAN_LIBC_NT_ENUM_CONSOLEMODEFLAGS_H_ */ diff --git a/libc/nt/enum/consoleselectionflags.h b/libc/nt/enum/consoleselectionflags.h index 75e069d19..4b74e9f2d 100644 --- a/libc/nt/enum/consoleselectionflags.h +++ b/libc/nt/enum/consoleselectionflags.h @@ -1,10 +1,10 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_ -#define kNtConsoleNoSelection 0x0000u +#define kNtConsoleNoSelection 0x0000u #define kNtConsoleSelectionInProgress 0x0001u -#define kNtConsoleSelectionNotEmpty 0x0002u -#define kNtConsoleMouseSelection 0x0004u -#define kNtConsoleMouseDown 0x0008u +#define kNtConsoleSelectionNotEmpty 0x0002u +#define kNtConsoleMouseSelection 0x0004u +#define kNtConsoleMouseDown 0x0008u #endif /* COSMOPOLITAN_LIBC_NT_ENUM_CONSOLESELECTIONFLAGS_H_ */ diff --git a/libc/nt/enum/creationdisposition.h b/libc/nt/enum/creationdisposition.h index 989ed19f2..dc4c83258 100644 --- a/libc/nt/enum/creationdisposition.h +++ b/libc/nt/enum/creationdisposition.h @@ -1,10 +1,10 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_ -#define kNtCreateNew 1 -#define kNtCreateAlways 2 -#define kNtOpenExisting 3 -#define kNtOpenAlways 4 +#define kNtCreateNew 1 +#define kNtCreateAlways 2 +#define kNtOpenExisting 3 +#define kNtOpenAlways 4 #define kNtTruncateExisting 5 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_CREATIONDISPOSITION_H_ */ diff --git a/libc/nt/enum/ctrlevent.h b/libc/nt/enum/ctrlevent.h index 98bd348d3..0d04ac011 100644 --- a/libc/nt/enum/ctrlevent.h +++ b/libc/nt/enum/ctrlevent.h @@ -1,10 +1,10 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_ -#define kNtCtrlCEvent 0 /* SIGINT */ -#define kNtCtrlBreakEvent 1 /* SIGQUIT */ -#define kNtCtrlCloseEvent 2 /* SIGHUP */ -#define kNtCtrlLogoffEvent 5 /* SIGTERM */ +#define kNtCtrlCEvent 0 /* SIGINT */ +#define kNtCtrlBreakEvent 1 /* SIGQUIT */ +#define kNtCtrlCloseEvent 2 /* SIGHUP */ +#define kNtCtrlLogoffEvent 5 /* SIGTERM */ #define kNtCtrlShutdownEvent 6 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_CTRLEVENT_H_ */ diff --git a/libc/nt/enum/exceptionhandleractions.h b/libc/nt/enum/exceptionhandleractions.h index 15358f41a..7f6c84f8d 100644 --- a/libc/nt/enum/exceptionhandleractions.h +++ b/libc/nt/enum/exceptionhandleractions.h @@ -1,8 +1,8 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_ -#define kNtExceptionExecuteHandler 0x1u +#define kNtExceptionExecuteHandler 0x1u #define kNtExceptionContinueExecution 0xffffffffu -#define kNtExceptionContinueSearch 0x0u +#define kNtExceptionContinueSearch 0x0u #endif /* COSMOPOLITAN_LIBC_NT_ENUM_EXCEPTIONHANDLERACTIONS_H_ */ diff --git a/libc/nt/enum/fileinformationclass.h b/libc/nt/enum/fileinformationclass.h index 2035ddd13..74b2df676 100644 --- a/libc/nt/enum/fileinformationclass.h +++ b/libc/nt/enum/fileinformationclass.h @@ -1,46 +1,46 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_ -#define kNtFileDirectoryInformation 1 /*→ struct NtFileDirectoryInformation */ -#define kNtFileFullDirectoryInformation 2 /*→ etc. */ -#define kNtFileBothDirectoryInformation 3 -#define kNtFileBasicInformation 4 -#define kNtFileStandardInformation 5 -#define kNtFileInternalInformation 6 -#define kNtFileEaInformation 7 -#define kNtFileAccessInformation 8 -#define kNtFileNameInformation 9 -#define kNtFileRenameInformation 10 -#define kNtFileLinkInformation 11 -#define kNtFileNamesInformation 12 -#define kNtFileDispositionInformation 13 -#define kNtFilePositionInformation 14 -#define kNtFileFullEaInformation 15 -#define kNtFileModeInformation 16 -#define kNtFileAlignmentInformation 17 -#define kNtFileAllInformation 18 -#define kNtFileAllocationInformation 19 -#define kNtFileEndOfFileInformation 20 -#define kNtFileAlternateNameInformation 21 -#define kNtFileStreamInformation 22 -#define kNtFilePipeInformation 23 -#define kNtFilePipeLocalInformation 24 -#define kNtFilePipeRemoteInformation 25 -#define kNtFileMailslotQueryInformation 26 -#define kNtFileMailslotSetInformation 27 -#define kNtFileCompressionInformation 28 -#define kNtFileObjectIdInformation 29 -#define kNtFileCompletionInformation 30 -#define kNtFileMoveClusterInformation 31 -#define kNtFileQuotaInformation 32 -#define kNtFileReparsePointInformation 33 -#define kNtFileNetworkOpenInformation 34 -#define kNtFileAttributeTagInformation 35 -#define kNtFileTrackingInformation 36 +#define kNtFileDirectoryInformation 1 /*→ struct NtFileDirectoryInformation */ +#define kNtFileFullDirectoryInformation 2 /*→ etc. */ +#define kNtFileBothDirectoryInformation 3 +#define kNtFileBasicInformation 4 +#define kNtFileStandardInformation 5 +#define kNtFileInternalInformation 6 +#define kNtFileEaInformation 7 +#define kNtFileAccessInformation 8 +#define kNtFileNameInformation 9 +#define kNtFileRenameInformation 10 +#define kNtFileLinkInformation 11 +#define kNtFileNamesInformation 12 +#define kNtFileDispositionInformation 13 +#define kNtFilePositionInformation 14 +#define kNtFileFullEaInformation 15 +#define kNtFileModeInformation 16 +#define kNtFileAlignmentInformation 17 +#define kNtFileAllInformation 18 +#define kNtFileAllocationInformation 19 +#define kNtFileEndOfFileInformation 20 +#define kNtFileAlternateNameInformation 21 +#define kNtFileStreamInformation 22 +#define kNtFilePipeInformation 23 +#define kNtFilePipeLocalInformation 24 +#define kNtFilePipeRemoteInformation 25 +#define kNtFileMailslotQueryInformation 26 +#define kNtFileMailslotSetInformation 27 +#define kNtFileCompressionInformation 28 +#define kNtFileObjectIdInformation 29 +#define kNtFileCompletionInformation 30 +#define kNtFileMoveClusterInformation 31 +#define kNtFileQuotaInformation 32 +#define kNtFileReparsePointInformation 33 +#define kNtFileNetworkOpenInformation 34 +#define kNtFileAttributeTagInformation 35 +#define kNtFileTrackingInformation 36 #define kNtFileIdBothDirectoryInformation 37 #define kNtFileIdFullDirectoryInformation 38 #define kNtFileValidDataLengthInformation 39 -#define kNtFileShortNameInformation 40 -#define kNtFileInformation_MAX 40 +#define kNtFileShortNameInformation 40 +#define kNtFileInformation_MAX 40 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_FILEINFORMATIONCLASS_H_ */ diff --git a/libc/nt/enum/filesharemode.h b/libc/nt/enum/filesharemode.h index b28510bac..4efb897db 100644 --- a/libc/nt/enum/filesharemode.h +++ b/libc/nt/enum/filesharemode.h @@ -2,8 +2,8 @@ #define COSMOPOLITAN_LIBC_NT_ENUM_FILESHAREFLAGS_H_ #define kNtFileShareExclusive 0x00000000u -#define kNtFileShareRead 0x00000001u -#define kNtFileShareWrite 0x00000002u -#define kNtFileShareDelete 0x00000004u +#define kNtFileShareRead 0x00000001u +#define kNtFileShareWrite 0x00000002u +#define kNtFileShareDelete 0x00000004u #endif /* COSMOPOLITAN_LIBC_NT_ENUM_FILESHAREFLAGS_H_ */ diff --git a/libc/nt/enum/fillattribute.h b/libc/nt/enum/fillattribute.h index 02ec2f51e..f98079cec 100644 --- a/libc/nt/enum/fillattribute.h +++ b/libc/nt/enum/fillattribute.h @@ -1,13 +1,13 @@ #ifndef COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_ #define COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_ -#define kNtForegroundBlue 0x0001 -#define kNtForegroundGreen 0x0002 -#define kNtForegroundRed 0x0004 +#define kNtForegroundBlue 0x0001 +#define kNtForegroundGreen 0x0002 +#define kNtForegroundRed 0x0004 #define kNtForegroundIntensity 0x0008 -#define kNtBackgroundBlue 0x0010 -#define kNtBackgroundGreen 0x0020 -#define kNtBackgroundRed 0x0040 +#define kNtBackgroundBlue 0x0010 +#define kNtBackgroundGreen 0x0020 +#define kNtBackgroundRed 0x0040 #define kNtBackgroundIntensity 0x0080 #endif /* COSMOPOLITAN_LIBC_NT_NTFILLATTRIBUTE_H_ */ diff --git a/libc/nt/enum/fsinformationclass.h b/libc/nt/enum/fsinformationclass.h index f32a702ca..3a1e93849 100644 --- a/libc/nt/enum/fsinformationclass.h +++ b/libc/nt/enum/fsinformationclass.h @@ -1,15 +1,15 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_ -#define kNtFileFsVolumeInformation 1 -#define kNtFileFsLabelInformation 2 -#define kNtFileFsSizeInformation 3 -#define kNtFileFsDeviceInformation 4 -#define kNtFileFsAttributeInformation 5 -#define kNtFileFsControlInformation 6 -#define kNtFileFsFullSizeInformation 7 -#define kNtFileFsObjectIdInformation 8 +#define kNtFileFsVolumeInformation 1 +#define kNtFileFsLabelInformation 2 +#define kNtFileFsSizeInformation 3 +#define kNtFileFsDeviceInformation 4 +#define kNtFileFsAttributeInformation 5 +#define kNtFileFsControlInformation 6 +#define kNtFileFsFullSizeInformation 7 +#define kNtFileFsObjectIdInformation 8 #define kNtFileFsDriverPathInformation 9 -#define kNtFileFsInformation_MAX 10 +#define kNtFileFsInformation_MAX 10 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_FSINFORMATIONCLASS_H_ */ diff --git a/libc/nt/enum/kwaitreason.h b/libc/nt/enum/kwaitreason.h index 04d1a8b75..df254f832 100644 --- a/libc/nt/enum/kwaitreason.h +++ b/libc/nt/enum/kwaitreason.h @@ -1,33 +1,33 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_ -#define kNtExecutive 0 -#define kNtFreePage 1 -#define kNtPageIn 2 -#define kNtPoolAllocation 3 -#define kNtDelayExecution 4 -#define kNtSuspended 5 -#define kNtUserRequest 6 -#define kNtWrExecutive 7 -#define kNtWrFreePage 8 -#define kNtWrPageIn 9 -#define kNtWrPoolAllocation 10 -#define kNtWrDelayExecution 11 -#define kNtWrSuspended 12 -#define kNtWrUserRequest 13 -#define kNtWrEventPair 14 -#define kNtWrQueue 15 -#define kNtWrLpcReceive 16 -#define kNtWrLpcReply 17 -#define kNtWrVirtualMemory 18 -#define kNtWrPageOut 19 -#define kNtWrRendezvous 20 -#define kNtSpare2 21 -#define kNtSpare3 22 -#define kNtSpare4 23 -#define kNtSpare5 24 -#define kNtSpare6 25 -#define kNtWrKernel 26 +#define kNtExecutive 0 +#define kNtFreePage 1 +#define kNtPageIn 2 +#define kNtPoolAllocation 3 +#define kNtDelayExecution 4 +#define kNtSuspended 5 +#define kNtUserRequest 6 +#define kNtWrExecutive 7 +#define kNtWrFreePage 8 +#define kNtWrPageIn 9 +#define kNtWrPoolAllocation 10 +#define kNtWrDelayExecution 11 +#define kNtWrSuspended 12 +#define kNtWrUserRequest 13 +#define kNtWrEventPair 14 +#define kNtWrQueue 15 +#define kNtWrLpcReceive 16 +#define kNtWrLpcReply 17 +#define kNtWrVirtualMemory 18 +#define kNtWrPageOut 19 +#define kNtWrRendezvous 20 +#define kNtSpare2 21 +#define kNtSpare3 22 +#define kNtSpare4 23 +#define kNtSpare5 24 +#define kNtSpare6 25 +#define kNtWrKernel 26 #define kNtMaximumWaitReason 27 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_KWAITREASON_H_ */ diff --git a/libc/nt/enum/processaccess.h b/libc/nt/enum/processaccess.h index 2844f7132..81ec68fe2 100644 --- a/libc/nt/enum/processaccess.h +++ b/libc/nt/enum/processaccess.h @@ -2,19 +2,19 @@ #define COSMOPOLITAN_LIBC_NT_ENUM_PROCESSACCESS_H_ #include "libc/nt/enum/accessmask.h" -#define kNtProcessCreateProcess 0x0080u -#define kNtProcessCreateThread 0x0002u -#define kNtProcessDupHandle 0x0040u -#define kNtProcessQueryInformation 0x0400u +#define kNtProcessCreateProcess 0x0080u +#define kNtProcessCreateThread 0x0002u +#define kNtProcessDupHandle 0x0040u +#define kNtProcessQueryInformation 0x0400u #define kNtProcessQueryLimitedInformation 0x1000u -#define kNtProcessSetInformation 0x0200u -#define kNtProcessSetQuota 0x0100u -#define kNtProcessSuspendResume 0x0800u -#define kNtProcessTerminate 0x0001u -#define kNtProcessVmOperation 0x0008u -#define kNtProcessVmRead 0x0010u -#define kNtProcessVmWrite 0x0020u -#define kNtProcessSynchronize kNtSynchronize +#define kNtProcessSetInformation 0x0200u +#define kNtProcessSetQuota 0x0100u +#define kNtProcessSuspendResume 0x0800u +#define kNtProcessTerminate 0x0001u +#define kNtProcessVmOperation 0x0008u +#define kNtProcessVmRead 0x0010u +#define kNtProcessVmWrite 0x0020u +#define kNtProcessSynchronize kNtSynchronize #define kNtProcessAllAccess \ (kNtStandardRightsRequired | kNtSynchronize | 0xffffu) diff --git a/libc/nt/enum/procthreadattributes.h b/libc/nt/enum/procthreadattributes.h index 939f24e9c..84027c3e4 100644 --- a/libc/nt/enum/procthreadattributes.h +++ b/libc/nt/enum/procthreadattributes.h @@ -2,6 +2,6 @@ #define COSMOPOLITAN_LIBC_NT_ENUM_PROCTHREADATTRIBUTES_H_ #define kNtProcThreadAttributeReplaceValue 1 -#define kNtProcThreadAttributeHandleList 0x00020002 +#define kNtProcThreadAttributeHandleList 0x00020002 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_PROCTHREADATTRIBUTES_H_ */ diff --git a/libc/nt/enum/securityinformation.h b/libc/nt/enum/securityinformation.h index 0fbd2d41d..dd5d6c242 100644 --- a/libc/nt/enum/securityinformation.h +++ b/libc/nt/enum/securityinformation.h @@ -1,19 +1,19 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_ -#define kNtOwnerSecurityInformation 0x00000001 -#define kNtGroupSecurityInformation 0x00000002 -#define kNtDaclSecurityInformation 0x00000004 -#define kNtSaclSecurityInformation 0x00000008 -#define kNtLabelSecurityInformation 0x00000010 -#define kNtAttributeSecurityInformation 0x00000020 -#define kNtScopeSecurityInformation 0x00000040 +#define kNtOwnerSecurityInformation 0x00000001 +#define kNtGroupSecurityInformation 0x00000002 +#define kNtDaclSecurityInformation 0x00000004 +#define kNtSaclSecurityInformation 0x00000008 +#define kNtLabelSecurityInformation 0x00000010 +#define kNtAttributeSecurityInformation 0x00000020 +#define kNtScopeSecurityInformation 0x00000040 #define kNtProcessTrustLabelSecurityInformation 0x00000080 -#define kNtAccessFilterSecurityInformation 0x00000100 -#define kNtBackupSecurityInformation 0x00010000 -#define kNtProtectedDaclSecurityInformation 0x80000000 -#define kNtProtectedSaclSecurityInformation 0x40000000 -#define kNtUnprotectedDaclSecurityInformation 0x20000000 -#define kNtUnprotectedSaclSecurityInformation 0x10000000 +#define kNtAccessFilterSecurityInformation 0x00000100 +#define kNtBackupSecurityInformation 0x00010000 +#define kNtProtectedDaclSecurityInformation 0x80000000 +#define kNtProtectedSaclSecurityInformation 0x40000000 +#define kNtUnprotectedDaclSecurityInformation 0x20000000 +#define kNtUnprotectedSaclSecurityInformation 0x10000000 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_SECURITYINFORMATION_H_ */ diff --git a/libc/nt/enum/startf.h b/libc/nt/enum/startf.h index 5464f50a5..ece5f2ce8 100644 --- a/libc/nt/enum/startf.h +++ b/libc/nt/enum/startf.h @@ -1,19 +1,19 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_ -#define kNtStartfUseshowwindow 0x00000001 /* otherwise wShowWindow ignored */ -#define kNtStartfUsesize 0x00000002 /* otherwise dwX / dwY ignored */ -#define kNtStartfUseposition 0x00000004 /* otherwise dwX/YSize ignored */ -#define kNtStartfUsecountchars 0x00000008 /* otherwise dwX/YCountChars ign. */ +#define kNtStartfUseshowwindow 0x00000001 /* otherwise wShowWindow ignored */ +#define kNtStartfUsesize 0x00000002 /* otherwise dwX / dwY ignored */ +#define kNtStartfUseposition 0x00000004 /* otherwise dwX/YSize ignored */ +#define kNtStartfUsecountchars 0x00000008 /* otherwise dwX/YCountChars ign. */ #define kNtStartfUsefillattribute 0x00000010 /* etc. */ -#define kNtStartfRunfullscreen 0x00000020 -#define kNtStartfForceonfeedback 0x00000040 +#define kNtStartfRunfullscreen 0x00000020 +#define kNtStartfForceonfeedback 0x00000040 #define kNtStartfForceofffeedback 0x00000080 -#define kNtStartfUsestdhandles 0x00000100 /* otherwise hStd... ignored */ -#define kNtStartfUsehotkey 0x00000200 -#define kNtStartfTitleislinkname 0x00000800 -#define kNtStartfTitleisappid 0x00001000 -#define kNtStartfPreventpinning 0x00002000 -#define kNtStartfUntrustedsource 0x00008000 +#define kNtStartfUsestdhandles 0x00000100 /* otherwise hStd... ignored */ +#define kNtStartfUsehotkey 0x00000200 +#define kNtStartfTitleislinkname 0x00000800 +#define kNtStartfTitleisappid 0x00001000 +#define kNtStartfPreventpinning 0x00002000 +#define kNtStartfUntrustedsource 0x00008000 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_STARTF_H_ */ diff --git a/libc/nt/enum/systeminformationclass.h b/libc/nt/enum/systeminformationclass.h index eab431b18..1749f9f9b 100644 --- a/libc/nt/enum/systeminformationclass.h +++ b/libc/nt/enum/systeminformationclass.h @@ -1,20 +1,20 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_ -#define kNtSystemBasicInformation 0 -#define kNtSystemProcessorInformation 1 -#define kNtSystemPerformanceInformation 2 -#define kNtSystemTimeOfDayInformation 3 -#define kNtSystemProcessInformation 5 -#define kNtSystemProcessorTimes 8 -#define kNtSystemGlobalFlag 9 -#define kNtSystemModuleInformation 11 -#define kNtSystemLockInformation 12 -#define kNtSystemHandleInformation 16 -#define kNtSystemObjectInformation 17 -#define kNtSystemInterruptInformation 23 -#define kNtSystemExceptionInformation 33 +#define kNtSystemBasicInformation 0 +#define kNtSystemProcessorInformation 1 +#define kNtSystemPerformanceInformation 2 +#define kNtSystemTimeOfDayInformation 3 +#define kNtSystemProcessInformation 5 +#define kNtSystemProcessorTimes 8 +#define kNtSystemGlobalFlag 9 +#define kNtSystemModuleInformation 11 +#define kNtSystemLockInformation 12 +#define kNtSystemHandleInformation 16 +#define kNtSystemObjectInformation 17 +#define kNtSystemInterruptInformation 23 +#define kNtSystemExceptionInformation 33 #define kNtSystemRegistryQuotaInformation 37 -#define kNtSystemLookasideInformation 45 +#define kNtSystemLookasideInformation 45 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_SYSTEMINFORMATIONCLASS_H_ */ diff --git a/libc/nt/enum/threadaccess.h b/libc/nt/enum/threadaccess.h index d2d4c0027..45ad624ec 100644 --- a/libc/nt/enum/threadaccess.h +++ b/libc/nt/enum/threadaccess.h @@ -2,18 +2,18 @@ #define COSMOPOLITAN_LIBC_NT_ENUM_THREADACCESS_H_ #include "libc/nt/enum/accessmask.h" -#define kNtThreadTerminate 0x0001 -#define kNtThreadSuspendResume 0x0002 -#define kNtThreadGetContext 0x0008 -#define kNtThreadSetContext 0x0010 -#define kNtThreadQueryInformation 0x0040 -#define kNtThreadSetInformation 0x0020 -#define kNtThreadSetThreadToken 0x0080 -#define kNtThreadImpersonate 0x0100 -#define kNtThreadDirectImpersonation 0x0200 -#define kNtThreadSetLimitedInformation 0x0400 +#define kNtThreadTerminate 0x0001 +#define kNtThreadSuspendResume 0x0002 +#define kNtThreadGetContext 0x0008 +#define kNtThreadSetContext 0x0010 +#define kNtThreadQueryInformation 0x0040 +#define kNtThreadSetInformation 0x0020 +#define kNtThreadSetThreadToken 0x0080 +#define kNtThreadImpersonate 0x0100 +#define kNtThreadDirectImpersonation 0x0200 +#define kNtThreadSetLimitedInformation 0x0400 #define kNtThreadQueryLimitedInformation 0x0800 -#define kNtThreadResume 0x1000 -#define kNtThreadAllAccess (kNtStandardRightsRequired | kNtSynchronize | 0xFFFF) +#define kNtThreadResume 0x1000 +#define kNtThreadAllAccess (kNtStandardRightsRequired | kNtSynchronize | 0xFFFF) #endif /* COSMOPOLITAN_LIBC_NT_ENUM_THREADACCESS_H_ */ diff --git a/libc/nt/enum/tokeninformationclass.h b/libc/nt/enum/tokeninformationclass.h index b2e181eec..b3c37a93a 100644 --- a/libc/nt/enum/tokeninformationclass.h +++ b/libc/nt/enum/tokeninformationclass.h @@ -1,23 +1,23 @@ #ifndef COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_ #define COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_ -#define kNtTokenUser 1 -#define kNtTokenGroups 2 -#define kNtTokenPrivileges 3 -#define kNtTokenOwner 4 -#define kNtTokenPrimaryGroup 5 -#define kNtTokenDefaultDacl 6 -#define kNtTokenSource 7 -#define kNtTokenType 8 -#define kNtTokenImpersonationLevel 9 -#define kNtTokenStatistics 10 -#define kNtTokenRestrictedSids 11 -#define kNtTokenSessionId 12 +#define kNtTokenUser 1 +#define kNtTokenGroups 2 +#define kNtTokenPrivileges 3 +#define kNtTokenOwner 4 +#define kNtTokenPrimaryGroup 5 +#define kNtTokenDefaultDacl 6 +#define kNtTokenSource 7 +#define kNtTokenType 8 +#define kNtTokenImpersonationLevel 9 +#define kNtTokenStatistics 10 +#define kNtTokenRestrictedSids 11 +#define kNtTokenSessionId 12 #define kNtTokenGroupsAndPrivileges 13 -#define kNtTokenSessionReference 14 -#define kNtTokenSandBoxInert 15 -#define kNtTokenAuditPolicy 16 -#define kNtTokenOrigin 17 -#define kNtTokenInfoClass_MAX 18 +#define kNtTokenSessionReference 14 +#define kNtTokenSandBoxInert 15 +#define kNtTokenAuditPolicy 16 +#define kNtTokenOrigin 17 +#define kNtTokenInfoClass_MAX 18 #endif /* COSMOPOLITAN_LIBC_NT_ENUM_TOKENINFORMATIONCLASS_H_ */ diff --git a/libc/nt/struct/ntexceptionrecord.h b/libc/nt/struct/ntexceptionrecord.h index 08fad0ad1..bb11104a0 100644 --- a/libc/nt/struct/ntexceptionrecord.h +++ b/libc/nt/struct/ntexceptionrecord.h @@ -4,7 +4,6 @@ #define kNtExceptionMaximumParameters 15 #define kNtExceptionNoncontinuable 1 - struct NtExceptionRecord { uint32_t ExceptionCode; /* kNtException... */ uint32_t ExceptionFlags; /* kNtExceptionNoncontinuable */ diff --git a/libc/runtime/getinterpreterexecutablename.c b/libc/runtime/getinterpreterexecutablename.c index a5857faa4..8f9c8a4d2 100644 --- a/libc/runtime/getinterpreterexecutablename.c +++ b/libc/runtime/getinterpreterexecutablename.c @@ -74,8 +74,8 @@ char *GetInterpreterExecutableName(char *p, size_t n) { cmd[2] = 12; // KERN_PROC_PATHNAME } else { // cmd[2] = 5; // KERN_PROC_PATHNAME - } // - cmd[3] = -1; // current process + } // + cmd[3] = -1; // current process if (sysctl(cmd, ARRAYLEN(cmd), p, &n, 0, 0) != -1) { errno = e; return p; diff --git a/libc/runtime/pc.internal.h b/libc/runtime/pc.internal.h index b14a7f527..b9d2b4a89 100644 --- a/libc/runtime/pc.internal.h +++ b/libc/runtime/pc.internal.h @@ -205,9 +205,9 @@ void __unref_page(struct mman *, uint64_t *, uint64_t); * I/O devices. */ forceinline void __invert_and_perm_ref_memory_area(struct mman *mm, - uint64_t *pml4t, uint64_t ps, - uint64_t size, - uint64_t pte_flags) { + uint64_t *pml4t, uint64_t ps, + uint64_t size, + uint64_t pte_flags) { __invert_memory_area(mm, pml4t, ps, size, pte_flags | PAGE_REFC); } diff --git a/libc/runtime/zipos-fcntl.c b/libc/runtime/zipos-fcntl.c index 0c1c799ad..92b017942 100644 --- a/libc/runtime/zipos-fcntl.c +++ b/libc/runtime/zipos-fcntl.c @@ -31,8 +31,7 @@ static int __zipos_dupfd(int fd, int cmd, int start) { if (start < 0) return einval(); if (IsWindows()) { - return sys_dup_nt(fd, -1, (cmd == F_DUPFD_CLOEXEC ? _O_CLOEXEC : 0), - start); + return sys_dup_nt(fd, -1, (cmd == F_DUPFD_CLOEXEC ? _O_CLOEXEC : 0), start); } rc = sys_fcntl(fd, cmd, start, __sys_fcntl); if (rc != -1) { diff --git a/libc/runtime/zipos-mmap.c b/libc/runtime/zipos-mmap.c index 0f27cdfd7..1480c7cb8 100644 --- a/libc/runtime/zipos-mmap.c +++ b/libc/runtime/zipos-mmap.c @@ -50,7 +50,7 @@ * @return virtual base address of new mapping, or MAP_FAILED w/ errno */ void *__zipos_mmap(void *addr, size_t size, int prot, int flags, - struct ZiposHandle *h, int64_t off) { + struct ZiposHandle *h, int64_t off) { if (off < 0) { STRACE("negative zipos mmap offset"); diff --git a/libc/runtime/zipos-notat.c b/libc/runtime/zipos-notat.c index 2b27672e5..809d622df 100644 --- a/libc/runtime/zipos-notat.c +++ b/libc/runtime/zipos-notat.c @@ -17,8 +17,8 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/internal.h" -#include "libc/sysv/errfuns.h" #include "libc/runtime/zipos.internal.h" +#include "libc/sysv/errfuns.h" int __zipos_notat(int dirfd, const char *path) { struct ZiposUri zipname; diff --git a/libc/sock/epoll.c b/libc/sock/epoll.c index 1be06e4d5..dfb7174d6 100644 --- a/libc/sock/epoll.c +++ b/libc/sock/epoll.c @@ -127,7 +127,7 @@ https://github.com/piscisaureus/wepoll"); } while (0) #define CONTAINOF(ptr, type, member) \ - ((type *)((uintptr_t)(ptr) - offsetof(type, member))) + ((type *)((uintptr_t)(ptr)-offsetof(type, member))) #define TREE__ROTATE(cis, trans) \ struct TreeNode *p = node; \ diff --git a/libc/sock/gethostips.c b/libc/sock/gethostips.c index 4a402ac1e..0e956c1b0 100644 --- a/libc/sock/gethostips.c +++ b/libc/sock/gethostips.c @@ -20,11 +20,11 @@ #include "libc/calls/syscall-sysv.internal.h" #include "libc/calls/syscall_support-nt.internal.h" #include "libc/dce.h" -#include "libc/serialize.h" #include "libc/macros.internal.h" #include "libc/mem/mem.h" #include "libc/nt/errors.h" #include "libc/nt/iphlpapi.h" +#include "libc/serialize.h" #include "libc/sock/sock.h" #include "libc/str/str.h" #include "libc/sysv/consts/af.h" diff --git a/libc/stdio/vcscanf.c b/libc/stdio/vcscanf.c index e37b374ed..ad91f88d8 100644 --- a/libc/stdio/vcscanf.c +++ b/libc/stdio/vcscanf.c @@ -553,9 +553,10 @@ int __vcscanf(int callback(void *), // items = -1; goto Done; } else if (rawmode && j != width) { - /* The C standard says that %c "matches a sequence of characters of - * **exactly** the number specified by the field width". If we have - * fewer characters, what we've just read is invalid. */ + /* The C standard says that %c "matches a sequence of characters + * of + * **exactly** the number specified by the field width". If we + * have fewer characters, what we've just read is invalid. */ goto Done; } else if (!rawmode && j < bufsize) { if (charbytes == sizeof(char)) { diff --git a/libc/str/iswpunct.c b/libc/str/iswpunct.c index 6ba67e833..96c16f34b 100644 --- a/libc/str/iswpunct.c +++ b/libc/str/iswpunct.c @@ -372,76 +372,76 @@ int iswpunct(wint_t c) { case u'⹍': // PARAGRAPHUS MARK (0x2e4d Po) case u'⹎': // PUNCTUS ELEVATUS MARK (0x2e4e Po) case u'⹏': // CORNISH VERSE DIVIDER (0x2e4f Po) - case u'、': // IDEOGRAPHIC COMMA (0x3001 Po) - case u'。': // IDEOGRAPHIC FULL STOP (0x3002 Po) - case u'〃': // DITTO MARK (0x3003 Po) - case u'〈': // LEFT ANGLE BRACKET (0x3008 Ps) - case u'〉': // RIGHT ANGLE BRACKET (0x3009 Pe) - case u'《': // LEFT DOUBLE ANGLE BRACKET (0x300a Ps) - case u'》': // RIGHT DOUBLE ANGLE BRACKET (0x300b Pe) - case u'「': // LEFT CORNER BRACKET (0x300c Ps) - case u'」': // RIGHT CORNER BRACKET (0x300d Pe) - case u'『': // LEFT WHITE CORNER BRACKET (0x300e Ps) - case u'』': // RIGHT WHITE CORNER BRACKET (0x300f Pe) - case u'【': // LEFT BLACK LENTICULAR BRACKET (0x3010 Ps) - case u'】': // RIGHT BLACK LENTICULAR BRACKET (0x3011 Pe) - case u'〔': // LEFT TORTOISE SHELL BRACKET (0x3014 Ps) - case u'〕': // RIGHT TORTOISE SHELL BRACKET (0x3015 Pe) - case u'〖': // LEFT WHITE LENTICULAR BRACKET (0x3016 Ps) - case u'〗': // RIGHT WHITE LENTICULAR BRACKET (0x3017 Pe) - case u'〘': // LEFT WHITE TORTOISE SHELL BRACKET (0x3018 Ps) - case u'〙': // RIGHT WHITE TORTOISE SHELL BRACKET (0x3019 Pe) - case u'〚': // LEFT WHITE SQUARE BRACKET (0x301a Ps) - case u'〛': // RIGHT WHITE SQUARE BRACKET (0x301b Pe) - case u'〜': // WAVE DASH (0x301c Pd) - case u'〝': // REVERSED DOUBLE PRIME QUOTATION MARK (0x301d Ps) - case u'〞': // DOUBLE PRIME QUOTATION MARK (0x301e Pe) - case u'〟': // LOW DOUBLE PRIME QUOTATION MARK (0x301f Pe) - case u'〰': // WAVY DASH (0x3030 Pd) - case u'〽': // PART ALTERNATION MARK (0x303d Po) - case u'゠': // KATAKANA-HIRAGANA DOUBLE HYPHEN (0x30a0 Pd) - case u'・': // KATAKANA MIDDLE DOT (0x30fb Po) - case u'꓾': // LISU PUNCTUATION COMMA (0xa4fe Po) - case u'꓿': // LISU PUNCTUATION FULL STOP (0xa4ff Po) - case u'꘍': // VAI COMMA (0xa60d Po) - case u'꘎': // VAI FULL STOP (0xa60e Po) - case u'꘏': // VAI QUESTION MARK (0xa60f Po) - case u'꙾': // CYRILLIC KAVYKA (0xa67e Po) - case u'꡴': // PHAGS-PA SINGLE HEAD MARK (0xa874 Po) - case u'꡵': // PHAGS-PA DOUBLE HEAD MARK (0xa875 Po) - case u'꡶': // PHAGS-PA MARK SHAD (0xa876 Po) - case u'꡷': // PHAGS-PA MARK DOUBLE SHAD (0xa877 Po) - case u'꣎': // SAURASHTRA DANDA (0xa8ce Po) - case u'꣏': // SAURASHTRA DOUBLE DANDA (0xa8cf Po) - case u'꣸': // DEVANAGARI SIGN PUSHPIKA (0xa8f8 Po) - case u'꣹': // DEVANAGARI GAP FILLER (0xa8f9 Po) - case u'꣺': // DEVANAGARI CARET (0xa8fa Po) - case u'꣼': // DEVANAGARI SIGN SIDDHAM (0xa8fc Po) - case u'꧁': // JAVANESE LEFT RERENGGAN (0xa9c1 Po) - case u'꧂': // JAVANESE RIGHT RERENGGAN (0xa9c2 Po) - case u'꧃': // JAVANESE PADA ANDAP (0xa9c3 Po) - case u'꧄': // JAVANESE PADA MADYA (0xa9c4 Po) - case u'꧅': // JAVANESE PADA LUHUR (0xa9c5 Po) - case u'꧆': // JAVANESE PADA WINDU (0xa9c6 Po) - case u'꧇': // JAVANESE PADA PANGKAT (0xa9c7 Po) - case u'꧈': // JAVANESE PADA LINGSA (0xa9c8 Po) - case u'꧉': // JAVANESE PADA LUNGSI (0xa9c9 Po) - case u'꧊': // JAVANESE PADA ADEG (0xa9ca Po) - case u'꧋': // JAVANESE PADA ADEG ADEG (0xa9cb Po) - case u'꧌': // JAVANESE PADA PISELEH (0xa9cc Po) - case u'꧍': // JAVANESE TURNED PADA PISELEH (0xa9cd Po) - case u'꧞': // JAVANESE PADA TIRTA TUMETES (0xa9de Po) - case u'꧟': // JAVANESE PADA ISEN-ISEN (0xa9df Po) - case u'꩜': // CHAM PUNCTUATION SPIRAL (0xaa5c Po) - case u'꩝': // CHAM PUNCTUATION DANDA (0xaa5d Po) - case u'꩞': // CHAM PUNCTUATION DOUBLE DANDA (0xaa5e Po) - case u'꩟': // CHAM PUNCTUATION TRIPLE DANDA (0xaa5f Po) - case u'꫞': // TAI VIET SYMBOL HO HOI (0xaade Po) - case u'꫟': // TAI VIET SYMBOL KOI KOI (0xaadf Po) - case u'꫰': // MEETEI MAYEK CHEIKHAN (0xaaf0 Po) - case u'꫱': // MEETEI MAYEK AHANG KHUDAM (0xaaf1 Po) - case u'꯫': // MEETEI MAYEK CHEIKHEI (0xabeb Po) - case u'︐': // PRESENTATION FORM FOR VERTICAL COMMA (0xfe10 Po) + case u'、': // IDEOGRAPHIC COMMA (0x3001 Po) + case u'。': // IDEOGRAPHIC FULL STOP (0x3002 Po) + case u'〃': // DITTO MARK (0x3003 Po) + case u'〈': // LEFT ANGLE BRACKET (0x3008 Ps) + case u'〉': // RIGHT ANGLE BRACKET (0x3009 Pe) + case u'《': // LEFT DOUBLE ANGLE BRACKET (0x300a Ps) + case u'》': // RIGHT DOUBLE ANGLE BRACKET (0x300b Pe) + case u'「': // LEFT CORNER BRACKET (0x300c Ps) + case u'」': // RIGHT CORNER BRACKET (0x300d Pe) + case u'『': // LEFT WHITE CORNER BRACKET (0x300e Ps) + case u'』': // RIGHT WHITE CORNER BRACKET (0x300f Pe) + case u'【': // LEFT BLACK LENTICULAR BRACKET (0x3010 Ps) + case u'】': // RIGHT BLACK LENTICULAR BRACKET (0x3011 Pe) + case u'〔': // LEFT TORTOISE SHELL BRACKET (0x3014 Ps) + case u'〕': // RIGHT TORTOISE SHELL BRACKET (0x3015 Pe) + case u'〖': // LEFT WHITE LENTICULAR BRACKET (0x3016 Ps) + case u'〗': // RIGHT WHITE LENTICULAR BRACKET (0x3017 Pe) + case u'〘': // LEFT WHITE TORTOISE SHELL BRACKET (0x3018 Ps) + case u'〙': // RIGHT WHITE TORTOISE SHELL BRACKET (0x3019 Pe) + case u'〚': // LEFT WHITE SQUARE BRACKET (0x301a Ps) + case u'〛': // RIGHT WHITE SQUARE BRACKET (0x301b Pe) + case u'〜': // WAVE DASH (0x301c Pd) + case u'〝': // REVERSED DOUBLE PRIME QUOTATION MARK (0x301d Ps) + case u'〞': // DOUBLE PRIME QUOTATION MARK (0x301e Pe) + case u'〟': // LOW DOUBLE PRIME QUOTATION MARK (0x301f Pe) + case u'〰': // WAVY DASH (0x3030 Pd) + case u'〽': // PART ALTERNATION MARK (0x303d Po) + case u'゠': // KATAKANA-HIRAGANA DOUBLE HYPHEN (0x30a0 Pd) + case u'・': // KATAKANA MIDDLE DOT (0x30fb Po) + case u'꓾': // LISU PUNCTUATION COMMA (0xa4fe Po) + case u'꓿': // LISU PUNCTUATION FULL STOP (0xa4ff Po) + case u'꘍': // VAI COMMA (0xa60d Po) + case u'꘎': // VAI FULL STOP (0xa60e Po) + case u'꘏': // VAI QUESTION MARK (0xa60f Po) + case u'꙾': // CYRILLIC KAVYKA (0xa67e Po) + case u'꡴': // PHAGS-PA SINGLE HEAD MARK (0xa874 Po) + case u'꡵': // PHAGS-PA DOUBLE HEAD MARK (0xa875 Po) + case u'꡶': // PHAGS-PA MARK SHAD (0xa876 Po) + case u'꡷': // PHAGS-PA MARK DOUBLE SHAD (0xa877 Po) + case u'꣎': // SAURASHTRA DANDA (0xa8ce Po) + case u'꣏': // SAURASHTRA DOUBLE DANDA (0xa8cf Po) + case u'꣸': // DEVANAGARI SIGN PUSHPIKA (0xa8f8 Po) + case u'꣹': // DEVANAGARI GAP FILLER (0xa8f9 Po) + case u'꣺': // DEVANAGARI CARET (0xa8fa Po) + case u'꣼': // DEVANAGARI SIGN SIDDHAM (0xa8fc Po) + case u'꧁': // JAVANESE LEFT RERENGGAN (0xa9c1 Po) + case u'꧂': // JAVANESE RIGHT RERENGGAN (0xa9c2 Po) + case u'꧃': // JAVANESE PADA ANDAP (0xa9c3 Po) + case u'꧄': // JAVANESE PADA MADYA (0xa9c4 Po) + case u'꧅': // JAVANESE PADA LUHUR (0xa9c5 Po) + case u'꧆': // JAVANESE PADA WINDU (0xa9c6 Po) + case u'꧇': // JAVANESE PADA PANGKAT (0xa9c7 Po) + case u'꧈': // JAVANESE PADA LINGSA (0xa9c8 Po) + case u'꧉': // JAVANESE PADA LUNGSI (0xa9c9 Po) + case u'꧊': // JAVANESE PADA ADEG (0xa9ca Po) + case u'꧋': // JAVANESE PADA ADEG ADEG (0xa9cb Po) + case u'꧌': // JAVANESE PADA PISELEH (0xa9cc Po) + case u'꧍': // JAVANESE TURNED PADA PISELEH (0xa9cd Po) + case u'꧞': // JAVANESE PADA TIRTA TUMETES (0xa9de Po) + case u'꧟': // JAVANESE PADA ISEN-ISEN (0xa9df Po) + case u'꩜': // CHAM PUNCTUATION SPIRAL (0xaa5c Po) + case u'꩝': // CHAM PUNCTUATION DANDA (0xaa5d Po) + case u'꩞': // CHAM PUNCTUATION DOUBLE DANDA (0xaa5e Po) + case u'꩟': // CHAM PUNCTUATION TRIPLE DANDA (0xaa5f Po) + case u'꫞': // TAI VIET SYMBOL HO HOI (0xaade Po) + case u'꫟': // TAI VIET SYMBOL KOI KOI (0xaadf Po) + case u'꫰': // MEETEI MAYEK CHEIKHAN (0xaaf0 Po) + case u'꫱': // MEETEI MAYEK AHANG KHUDAM (0xaaf1 Po) + case u'꯫': // MEETEI MAYEK CHEIKHEI (0xabeb Po) + case u'︐': // PRESENTATION FORM FOR VERTICAL COMMA (0xfe10 Po) case u'︑': // PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (0xfe11 Po) case u'︒': // PRESENTATION FORM FOR VERTICAL IDEO FULL STOP (0xfe12 Po) case u'︓': // PRESENTATION FORM FOR VERTICAL COLON (0xfe13 Po) diff --git a/libc/str/locale.h b/libc/str/locale.h index ec66e45dd..a31f9fd61 100644 --- a/libc/str/locale.h +++ b/libc/str/locale.h @@ -21,7 +21,7 @@ COSMOPOLITAN_C_START_ -#define LC_GLOBAL_LOCALE ((locale_t) - 1) +#define LC_GLOBAL_LOCALE ((locale_t)-1) struct __locale_map { const void *map; diff --git a/libc/str/lz4cpy.c b/libc/str/lz4cpy.c index 827a5226d..832501510 100644 --- a/libc/str/lz4cpy.c +++ b/libc/str/lz4cpy.c @@ -16,10 +16,10 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/serialize.h" #include "libc/intrin/pushpop.internal.h" #include "libc/intrin/repmovsb.h" #include "libc/nexgen32e/kompressor.h" +#include "libc/serialize.h" #include "libc/str/str.h" /** diff --git a/libc/str/tpdecodecb.internal.h b/libc/str/tpdecodecb.internal.h index eddbdfd26..64ba05670 100644 --- a/libc/str/tpdecodecb.internal.h +++ b/libc/str/tpdecodecb.internal.h @@ -13,25 +13,30 @@ forceinline int tpdecodecb(wint_t *out, int first, int get(void *arg, uint32_t i), void *arg) { uint32_t wc, cb, need, msb, j, i = 1; - if (__builtin_expect((wc = first) == -1, 0)) return -1; + if (__builtin_expect((wc = first) == -1, 0)) + return -1; while (__builtin_expect((wc & 0b11000000) == 0b10000000, 0)) { - if ((wc = get(arg, i++)) == -1) return -1; + if ((wc = get(arg, i++)) == -1) + return -1; } if (__builtin_expect(!(0 <= wc && wc <= 0x7F), 0)) { msb = wc < 252 ? bsr(~wc & 0xff) : 1; need = 7 - msb; wc &= ((1u << msb) - 1) | 0b00000011; for (j = 1; j < need; ++j) { - if ((cb = get(arg, i++)) == -1) return -1; + if ((cb = get(arg, i++)) == -1) + return -1; if ((cb & 0b11000000) == 0b10000000) { wc = wc << 6 | (cb & 0b00111111); } else { - if (out) *out = u'\xFFFD'; + if (out) + *out = u'\xFFFD'; return -1; } } } - if (__builtin_expect(!!out, 1)) *out = (wint_t)wc; + if (__builtin_expect(!!out, 1)) + *out = (wint_t)wc; return i; } diff --git a/libc/str/wctype.c b/libc/str/wctype.c index 182f47d5b..588439a25 100644 --- a/libc/str/wctype.c +++ b/libc/str/wctype.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/serialize.h" #include "libc/macros.internal.h" +#include "libc/serialize.h" #include "libc/str/str.h" static const char kWcTypeNames[][8] = { diff --git a/libc/sysv/consts/fileno.h b/libc/sysv/consts/fileno.h index f8294d299..a9233f1e1 100644 --- a/libc/sysv/consts/fileno.h +++ b/libc/sysv/consts/fileno.h @@ -1,7 +1,7 @@ #ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_FILENO_H_ #define COSMOPOLITAN_LIBC_SYSV_CONSTS_FILENO_H_ -#define STDIN_FILENO 0 +#define STDIN_FILENO 0 #define STDOUT_FILENO 1 #define STDERR_FILENO 2 diff --git a/libc/sysv/consts/icmp6.h b/libc/sysv/consts/icmp6.h index 505a590b0..43ce452b8 100644 --- a/libc/sysv/consts/icmp6.h +++ b/libc/sysv/consts/icmp6.h @@ -1,39 +1,36 @@ #ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_ICMP6_H_ #define COSMOPOLITAN_LIBC_SYSV_CONSTS_ICMP6_H_ -#define ICMP6_DST_UNREACH ICMP6_DST_UNREACH -#define ICMP6_DST_UNREACH_ADDR ICMP6_DST_UNREACH_ADDR -#define ICMP6_DST_UNREACH_ADMIN ICMP6_DST_UNREACH_ADMIN -#define ICMP6_DST_UNREACH_BEYONDSCOPE ICMP6_DST_UNREACH_BEYONDSCOPE -#define ICMP6_DST_UNREACH_NOPORT ICMP6_DST_UNREACH_NOPORT -#define ICMP6_DST_UNREACH_NOROUTE ICMP6_DST_UNREACH_NOROUTE -#define ICMP6_ECHO_REPLY ICMP6_ECHO_REPLY -#define ICMP6_ECHO_REQUEST ICMP6_ECHO_REQUEST -#define ICMP6_FILTER ICMP6_FILTER -#define ICMP6_INFOMSG_MASK ICMP6_INFOMSG_MASK -#define ICMP6_PACKET_TOO_BIG ICMP6_PACKET_TOO_BIG -#define ICMP6_PARAMPROB_HEADER ICMP6_PARAMPROB_HEADER -#define ICMP6_PARAMPROB_NEXTHEADER ICMP6_PARAMPROB_NEXTHEADER -#define ICMP6_PARAMPROB_OPTION ICMP6_PARAMPROB_OPTION -#define ICMP6_PARAM_PROB ICMP6_PARAM_PROB -#define ICMP6_ROUTER_RENUMBERING ICMP6_ROUTER_RENUMBERING -#define ICMP6_RR_FLAGS_FORCEAPPLY ICMP6_RR_FLAGS_FORCEAPPLY -#define ICMP6_RR_FLAGS_PREVDONE ICMP6_RR_FLAGS_PREVDONE -#define ICMP6_RR_FLAGS_REQRESULT ICMP6_RR_FLAGS_REQRESULT -#define ICMP6_RR_FLAGS_SPECSITE ICMP6_RR_FLAGS_SPECSITE -#define ICMP6_RR_FLAGS_TEST ICMP6_RR_FLAGS_TEST -#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME \ - ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME -#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME \ - ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME -#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO ICMP6_RR_PCOUSE_RAFLAGS_AUTO -#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK ICMP6_RR_PCOUSE_RAFLAGS_ONLINK -#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN \ - ICMP6_RR_RESULT_FLAGS_FORBIDDEN -#define ICMP6_RR_RESULT_FLAGS_OOB ICMP6_RR_RESULT_FLAGS_OOB -#define ICMP6_TIME_EXCEEDED ICMP6_TIME_EXCEEDED -#define ICMP6_TIME_EXCEED_REASSEMBLY ICMP6_TIME_EXCEED_REASSEMBLY -#define ICMP6_TIME_EXCEED_TRANSIT ICMP6_TIME_EXCEED_TRANSIT +#define ICMP6_DST_UNREACH ICMP6_DST_UNREACH +#define ICMP6_DST_UNREACH_ADDR ICMP6_DST_UNREACH_ADDR +#define ICMP6_DST_UNREACH_ADMIN ICMP6_DST_UNREACH_ADMIN +#define ICMP6_DST_UNREACH_BEYONDSCOPE ICMP6_DST_UNREACH_BEYONDSCOPE +#define ICMP6_DST_UNREACH_NOPORT ICMP6_DST_UNREACH_NOPORT +#define ICMP6_DST_UNREACH_NOROUTE ICMP6_DST_UNREACH_NOROUTE +#define ICMP6_ECHO_REPLY ICMP6_ECHO_REPLY +#define ICMP6_ECHO_REQUEST ICMP6_ECHO_REQUEST +#define ICMP6_FILTER ICMP6_FILTER +#define ICMP6_INFOMSG_MASK ICMP6_INFOMSG_MASK +#define ICMP6_PACKET_TOO_BIG ICMP6_PACKET_TOO_BIG +#define ICMP6_PARAMPROB_HEADER ICMP6_PARAMPROB_HEADER +#define ICMP6_PARAMPROB_NEXTHEADER ICMP6_PARAMPROB_NEXTHEADER +#define ICMP6_PARAMPROB_OPTION ICMP6_PARAMPROB_OPTION +#define ICMP6_PARAM_PROB ICMP6_PARAM_PROB +#define ICMP6_ROUTER_RENUMBERING ICMP6_ROUTER_RENUMBERING +#define ICMP6_RR_FLAGS_FORCEAPPLY ICMP6_RR_FLAGS_FORCEAPPLY +#define ICMP6_RR_FLAGS_PREVDONE ICMP6_RR_FLAGS_PREVDONE +#define ICMP6_RR_FLAGS_REQRESULT ICMP6_RR_FLAGS_REQRESULT +#define ICMP6_RR_FLAGS_SPECSITE ICMP6_RR_FLAGS_SPECSITE +#define ICMP6_RR_FLAGS_TEST ICMP6_RR_FLAGS_TEST +#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME +#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME +#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO ICMP6_RR_PCOUSE_RAFLAGS_AUTO +#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK ICMP6_RR_PCOUSE_RAFLAGS_ONLINK +#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN ICMP6_RR_RESULT_FLAGS_FORBIDDEN +#define ICMP6_RR_RESULT_FLAGS_OOB ICMP6_RR_RESULT_FLAGS_OOB +#define ICMP6_TIME_EXCEEDED ICMP6_TIME_EXCEEDED +#define ICMP6_TIME_EXCEED_REASSEMBLY ICMP6_TIME_EXCEED_REASSEMBLY +#define ICMP6_TIME_EXCEED_TRANSIT ICMP6_TIME_EXCEED_TRANSIT COSMOPOLITAN_C_START_ diff --git a/libc/sysv/consts/iff.h b/libc/sysv/consts/iff.h index 404c24e52..a07298e3d 100644 --- a/libc/sysv/consts/iff.h +++ b/libc/sysv/consts/iff.h @@ -38,5 +38,4 @@ COSMOPOLITAN_C_END_ #define IFF_RUNNING IFF_RUNNING #define IFF_SLAVE IFF_SLAVE - #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IFF_H_ */ diff --git a/libc/sysv/consts/ip.h b/libc/sysv/consts/ip.h index 158b8cae2..3d3c82b08 100644 --- a/libc/sysv/consts/ip.h +++ b/libc/sysv/consts/ip.h @@ -102,6 +102,5 @@ extern const int IP_XFRM_POLICY; #define IP_UNICAST_IF IP_UNICAST_IF #define IP_XFRM_POLICY IP_XFRM_POLICY - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IP_H_ */ diff --git a/libc/sysv/consts/ipv6.h b/libc/sysv/consts/ipv6.h index 44726a41b..4e5c5471c 100644 --- a/libc/sysv/consts/ipv6.h +++ b/libc/sysv/consts/ipv6.h @@ -122,6 +122,5 @@ extern const int IPV6_XFRM_POLICY; #define IPV6_V6ONLY IPV6_V6ONLY #define IPV6_XFRM_POLICY IPV6_XFRM_POLICY - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_IPV6_H_ */ diff --git a/libc/sysv/consts/limits.h b/libc/sysv/consts/limits.h index dbe349748..a23ac9f6d 100644 --- a/libc/sysv/consts/limits.h +++ b/libc/sysv/consts/limits.h @@ -24,6 +24,5 @@ extern const int MAX_INPUT; #define MAX_CANON MAX_CANON #define MAX_INPUT MAX_INPUT - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LIMITS_H_ */ diff --git a/libc/sysv/consts/lio.h b/libc/sysv/consts/lio.h index b0fed0aad..94344a27b 100644 --- a/libc/sysv/consts/lio.h +++ b/libc/sysv/consts/lio.h @@ -1,11 +1,11 @@ #ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_LIO_H_ #define COSMOPOLITAN_LIBC_SYSV_CONSTS_LIO_H_ -#define LIO_NOP LIO_NOP +#define LIO_NOP LIO_NOP #define LIO_NOWAIT LIO_NOWAIT -#define LIO_READ LIO_READ -#define LIO_WAIT LIO_WAIT -#define LIO_WRITE LIO_WRITE +#define LIO_READ LIO_READ +#define LIO_WAIT LIO_WAIT +#define LIO_WRITE LIO_WRITE COSMOPOLITAN_C_START_ diff --git a/libc/sysv/consts/lock.h b/libc/sysv/consts/lock.h index 5fdcce2d3..9cf46025c 100644 --- a/libc/sysv/consts/lock.h +++ b/libc/sysv/consts/lock.h @@ -15,5 +15,4 @@ COSMOPOLITAN_C_END_ #define LOCK_SH LOCK_SH #define LOCK_UN LOCK_UN - #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_LOCK_H_ */ diff --git a/libc/sysv/consts/mcast.h b/libc/sysv/consts/mcast.h index 4157a2e2d..82613f00e 100644 --- a/libc/sysv/consts/mcast.h +++ b/libc/sysv/consts/mcast.h @@ -1,15 +1,15 @@ #ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_MCAST_H_ #define COSMOPOLITAN_LIBC_SYSV_CONSTS_MCAST_H_ -#define MCAST_BLOCK_SOURCE MCAST_BLOCK_SOURCE -#define MCAST_EXCLUDE MCAST_EXCLUDE -#define MCAST_INCLUDE MCAST_INCLUDE -#define MCAST_JOIN_GROUP MCAST_JOIN_GROUP -#define MCAST_JOIN_SOURCE_GROUP MCAST_JOIN_SOURCE_GROUP -#define MCAST_LEAVE_GROUP MCAST_LEAVE_GROUP +#define MCAST_BLOCK_SOURCE MCAST_BLOCK_SOURCE +#define MCAST_EXCLUDE MCAST_EXCLUDE +#define MCAST_INCLUDE MCAST_INCLUDE +#define MCAST_JOIN_GROUP MCAST_JOIN_GROUP +#define MCAST_JOIN_SOURCE_GROUP MCAST_JOIN_SOURCE_GROUP +#define MCAST_LEAVE_GROUP MCAST_LEAVE_GROUP #define MCAST_LEAVE_SOURCE_GROUP MCAST_LEAVE_SOURCE_GROUP -#define MCAST_MSFILTER MCAST_MSFILTER -#define MCAST_UNBLOCK_SOURCE MCAST_UNBLOCK_SOURCE +#define MCAST_MSFILTER MCAST_MSFILTER +#define MCAST_UNBLOCK_SOURCE MCAST_UNBLOCK_SOURCE COSMOPOLITAN_C_START_ diff --git a/libc/sysv/consts/modem.h b/libc/sysv/consts/modem.h index 54d4a9be2..7d507523d 100644 --- a/libc/sysv/consts/modem.h +++ b/libc/sysv/consts/modem.h @@ -36,6 +36,5 @@ extern const int TIOCM_ST; #define TIOCMBIC TIOCMBIC #define TIOCMBIS TIOCMBIS - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MODEM_H_ */ diff --git a/libc/sysv/consts/mount.h b/libc/sysv/consts/mount.h index 21c7745e9..846c7f453 100644 --- a/libc/sysv/consts/mount.h +++ b/libc/sysv/consts/mount.h @@ -92,6 +92,5 @@ extern const int MNT_SNAPSHOT; #define MNT_NOCLUSTERW MNT_NOCLUSTERW #define MNT_SNAPSHOT MNT_SNAPSHOT - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_MOUNT_H_ */ diff --git a/libc/sysv/consts/pf.h b/libc/sysv/consts/pf.h index 9f376da36..ebb0f04d1 100644 --- a/libc/sysv/consts/pf.h +++ b/libc/sysv/consts/pf.h @@ -94,6 +94,5 @@ extern const int PF_X25; #define PF_WANPIPE PF_WANPIPE #define PF_X25 PF_X25 - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PF_H_ */ diff --git a/libc/sysv/consts/poll.h b/libc/sysv/consts/poll.h index 7d44c2c32..79c1173c7 100644 --- a/libc/sysv/consts/poll.h +++ b/libc/sysv/consts/poll.h @@ -27,6 +27,5 @@ extern const int16_t POLLWRNORM; #define POLLWRBAND POLLWRBAND #define POLLWRNORM POLLWRNORM - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POLL_H_ */ diff --git a/libc/sysv/consts/posix.h b/libc/sysv/consts/posix.h index ff0978b50..8293b4297 100644 --- a/libc/sysv/consts/posix.h +++ b/libc/sysv/consts/posix.h @@ -22,6 +22,5 @@ extern const int POSIX_MADV_DONTNEED; #define POSIX_MADV_DONTNEED POSIX_MADV_DONTNEED - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POSIX_H_ */ diff --git a/libc/sysv/consts/pty.h b/libc/sysv/consts/pty.h index d0c02f8e5..c564e7469 100644 --- a/libc/sysv/consts/pty.h +++ b/libc/sysv/consts/pty.h @@ -23,6 +23,5 @@ extern const int TIOCPKT_STOP; #define TIOCPKT TIOCPKT - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_PTY_H_ */ diff --git a/libc/sysv/consts/read.h b/libc/sysv/consts/read.h index edef19603..3fa23a933 100644 --- a/libc/sysv/consts/read.h +++ b/libc/sysv/consts/read.h @@ -1,18 +1,18 @@ #ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_READ_H_ #define COSMOPOLITAN_LIBC_SYSV_CONSTS_READ_H_ -#define READ_10 READ_10 -#define READ_12 READ_12 -#define READ_6 READ_6 -#define READ_BLOCK_LIMITS READ_BLOCK_LIMITS -#define READ_BUFFER READ_BUFFER -#define READ_CAPACITY READ_CAPACITY -#define READ_DEFECT_DATA READ_DEFECT_DATA +#define READ_10 READ_10 +#define READ_12 READ_12 +#define READ_6 READ_6 +#define READ_BLOCK_LIMITS READ_BLOCK_LIMITS +#define READ_BUFFER READ_BUFFER +#define READ_CAPACITY READ_CAPACITY +#define READ_DEFECT_DATA READ_DEFECT_DATA #define READ_ELEMENT_STATUS READ_ELEMENT_STATUS -#define READ_LONG READ_LONG -#define READ_POSITION READ_POSITION -#define READ_REVERSE READ_REVERSE -#define READ_TOC READ_TOC +#define READ_LONG READ_LONG +#define READ_POSITION READ_POSITION +#define READ_REVERSE READ_REVERSE +#define READ_TOC READ_TOC COSMOPOLITAN_C_START_ diff --git a/libc/sysv/consts/reboot.h b/libc/sysv/consts/reboot.h index 232b62657..c488af089 100644 --- a/libc/sysv/consts/reboot.h +++ b/libc/sysv/consts/reboot.h @@ -26,6 +26,5 @@ extern const unsigned RB_NOSYNC; #define RB_DISABLE_CAD RB_DISABLE_CAD #define RB_NOSYNC RB_NOSYNC - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_REBOOT_H_ */ diff --git a/libc/sysv/consts/rlim.h b/libc/sysv/consts/rlim.h index c7f081ae1..f41aba12c 100644 --- a/libc/sysv/consts/rlim.h +++ b/libc/sysv/consts/rlim.h @@ -12,6 +12,5 @@ extern const uint64_t RLIM_SAVED_MAX; #define RLIM_SAVED_CUR RLIM_SAVED_CUR #define RLIM_SAVED_MAX RLIM_SAVED_MAX - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_RLIM_H_ */ diff --git a/libc/sysv/consts/sa.h b/libc/sysv/consts/sa.h index b6a99776d..6abdd3481 100644 --- a/libc/sysv/consts/sa.h +++ b/libc/sysv/consts/sa.h @@ -22,6 +22,5 @@ extern const uint64_t SA_SIGINFO; #define SA_RESTART SA_RESTART #define SA_SIGINFO SA_SIGINFO - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SA_H_ */ diff --git a/libc/sysv/consts/sched.h b/libc/sysv/consts/sched.h index 9a960aa6e..532cf634b 100644 --- a/libc/sysv/consts/sched.h +++ b/libc/sysv/consts/sched.h @@ -19,6 +19,5 @@ extern const int SCHED_RR; #define SCHED_RESET_ON_FORK SCHED_RESET_ON_FORK #define SCHED_RR SCHED_RR - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SCHED_H_ */ diff --git a/libc/sysv/consts/scm.h b/libc/sysv/consts/scm.h index 60052b287..ec405ef23 100644 --- a/libc/sysv/consts/scm.h +++ b/libc/sysv/consts/scm.h @@ -17,5 +17,4 @@ COSMOPOLITAN_C_END_ #define SCM_TIMESTAMPNS SCM_TIMESTAMPNS #define SCM_WIFI_STATUS SCM_WIFI_STATUS - #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SCM_H_ */ diff --git a/libc/sysv/consts/sf.h b/libc/sysv/consts/sf.h index 6e3d74aae..a153a308b 100644 --- a/libc/sysv/consts/sf.h +++ b/libc/sysv/consts/sf.h @@ -17,6 +17,5 @@ extern const int SF_SYNC; #define SF_NODISKIO SF_NODISKIO #define SF_SYNC SF_SYNC - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SF_H_ */ diff --git a/libc/sysv/consts/sicode.h b/libc/sysv/consts/sicode.h index 6fb95090a..b4eaad702 100644 --- a/libc/sysv/consts/sicode.h +++ b/libc/sysv/consts/sicode.h @@ -105,6 +105,5 @@ extern const int32_t SYS_USER_DISPATCH; #define SYS_SECCOMP SYS_SECCOMP #define SYS_USER_DISPATCH SYS_USER_DISPATCH - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SICODE_H_ */ diff --git a/libc/sysv/consts/st.h b/libc/sysv/consts/st.h index 13eeebb1d..293e4c2b9 100644 --- a/libc/sysv/consts/st.h +++ b/libc/sysv/consts/st.h @@ -28,6 +28,5 @@ extern const int ST_WRITE; #define ST_SYNCHRONOUS ST_SYNCHRONOUS #define ST_WRITE ST_WRITE - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_ST_H_ */ diff --git a/libc/sysv/consts/tcp.h b/libc/sysv/consts/tcp.h index 3e92216c3..0ef015765 100644 --- a/libc/sysv/consts/tcp.h +++ b/libc/sysv/consts/tcp.h @@ -66,6 +66,5 @@ extern const int TCP_WINDOW_CLAMP; #define TCP_USER_TIMEOUT TCP_USER_TIMEOUT #define TCP_WINDOW_CLAMP TCP_WINDOW_CLAMP - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_TCP_H_ */ diff --git a/libc/sysv/consts/utime.h b/libc/sysv/consts/utime.h index 8c63fc9e1..d87bda525 100644 --- a/libc/sysv/consts/utime.h +++ b/libc/sysv/consts/utime.h @@ -10,5 +10,4 @@ COSMOPOLITAN_C_END_ #define UTIME_NOW UTIME_NOW #define UTIME_OMIT UTIME_OMIT - #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_UTIME_H_ */ diff --git a/libc/sysv/consts/w.h b/libc/sysv/consts/w.h index 8f1b323ae..4bb937164 100644 --- a/libc/sysv/consts/w.h +++ b/libc/sysv/consts/w.h @@ -10,6 +10,5 @@ extern const int WCONTINUED; #define WUNTRACED WUNTRACED #define WCONTINUED WCONTINUED - COSMOPOLITAN_C_END_ #endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_W_H_ */ diff --git a/libc/testlib/ezbench.h b/libc/testlib/ezbench.h index 475562405..35fa23e33 100644 --- a/libc/testlib/ezbench.h +++ b/libc/testlib/ezbench.h @@ -35,7 +35,8 @@ COSMOPOLITAN_C_START_ } while (++Tries < EZBENCH_TRIES && \ (__testlib_getcore() != Core && \ __testlib_getinterrupts() > Interrupts)); \ - if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" speculative"); \ + if (Tries == EZBENCH_TRIES) \ + __testlib_ezbenchwarn(" speculative"); \ Tries = 0; \ do { \ __testlib_yield(); \ @@ -51,94 +52,100 @@ COSMOPOLITAN_C_START_ } while (++Tries < EZBENCH_TRIES && \ (__testlib_getcore() != Core && \ __testlib_getinterrupts() > Interrupts)); \ - if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" memory strict"); \ + if (Tries == EZBENCH_TRIES) \ + __testlib_ezbenchwarn(" memory strict"); \ __testlib_ezbenchreport( \ NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \ MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \ } while (0) -#define EZBENCH3(NAME, NUM, INIT, EXPR) \ - do { \ - int Core, Tries, Interrupts; \ - double Speculative, MemoryStrict; \ - Tries = 0; \ - do { \ - __testlib_yield(); \ - Core = __testlib_getcore(); \ - Interrupts = __testlib_getinterrupts(); \ - INIT; \ - EXPR; \ - Speculative = BENCHLOOP(__startbench, __endbench, NUM, ({ \ - INIT; \ - __polluteregisters(); \ - }), \ - (EXPR)); \ - } while (++Tries < EZBENCH_TRIES && \ - (__testlib_getcore() != Core && \ - __testlib_getinterrupts() > Interrupts)); \ - if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" speculative"); \ - Tries = 0; \ - do { \ - __testlib_yield(); \ - Core = __testlib_getcore(); \ - Interrupts = __testlib_getinterrupts(); \ - INIT; \ - EXPR; \ - MemoryStrict = BENCHLOOP(__startbench_m, __endbench_m, NUM, ({ \ - INIT; \ - __polluteregisters(); \ - }), \ - (EXPR)); \ - } while (++Tries < EZBENCH_TRIES && \ - (__testlib_getcore() != Core && \ - __testlib_getinterrupts() > Interrupts)); \ - if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" memory strict"); \ - __testlib_ezbenchreport( \ - NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \ - MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \ +#define EZBENCH3(NAME, NUM, INIT, EXPR) \ + do { \ + int Core, Tries, Interrupts; \ + double Speculative, MemoryStrict; \ + Tries = 0; \ + do { \ + __testlib_yield(); \ + Core = __testlib_getcore(); \ + Interrupts = __testlib_getinterrupts(); \ + INIT; \ + EXPR; \ + Speculative = BENCHLOOP(__startbench, __endbench, NUM, ({ \ + INIT; \ + __polluteregisters(); \ + }), \ + (EXPR)); \ + } while (++Tries < EZBENCH_TRIES && \ + (__testlib_getcore() != Core && \ + __testlib_getinterrupts() > Interrupts)); \ + if (Tries == EZBENCH_TRIES) \ + __testlib_ezbenchwarn(" speculative"); \ + Tries = 0; \ + do { \ + __testlib_yield(); \ + Core = __testlib_getcore(); \ + Interrupts = __testlib_getinterrupts(); \ + INIT; \ + EXPR; \ + MemoryStrict = BENCHLOOP(__startbench_m, __endbench_m, NUM, ({ \ + INIT; \ + __polluteregisters(); \ + }), \ + (EXPR)); \ + } while (++Tries < EZBENCH_TRIES && \ + (__testlib_getcore() != Core && \ + __testlib_getinterrupts() > Interrupts)); \ + if (Tries == EZBENCH_TRIES) \ + __testlib_ezbenchwarn(" memory strict"); \ + __testlib_ezbenchreport( \ + NAME, MAX(.001, Speculative - __testlib_ezbenchcontrol()), \ + MAX(.001, MemoryStrict - __testlib_ezbenchcontrol())); \ } while (0) -#define EZBENCH_C(NAME, CONTROL, EXPR) \ - do { \ - int Core, Tries, Interrupts; \ - double Control, Speculative, MemoryStrict; \ - Tries = 0; \ - do { \ - __testlib_yield(); \ - Core = __testlib_getcore(); \ - Interrupts = __testlib_getinterrupts(); \ - Control = BENCHLOOP(__startbench_m, __endbench_m, EZBENCH_COUNT, \ - ({ __polluteregisters(); }), (CONTROL)); \ - } while (++Tries < EZBENCH_TRIES && \ - (__testlib_getcore() != Core && \ - __testlib_getinterrupts() > Interrupts)); \ - if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" control"); \ - Tries = 0; \ - do { \ - __testlib_yield(); \ - Core = __testlib_getcore(); \ - Interrupts = __testlib_getinterrupts(); \ - EXPR; \ - Speculative = BENCHLOOP(__startbench, __endbench, EZBENCH_COUNT, \ - __polluteregisters(), (EXPR)); \ - } while (++Tries < EZBENCH_TRIES && \ - (__testlib_getcore() != Core && \ - __testlib_getinterrupts() > Interrupts)); \ - if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" speculative"); \ - Tries = 0; \ - do { \ - __testlib_yield(); \ - Core = __testlib_getcore(); \ - Interrupts = __testlib_getinterrupts(); \ - EXPR; \ - MemoryStrict = BENCHLOOP(__startbench_m, __endbench_m, 8, \ - ({ __polluteregisters(); }), (EXPR)); \ - } while (++Tries < EZBENCH_TRIES && \ - (__testlib_getcore() != Core && \ - __testlib_getinterrupts() > Interrupts)); \ - if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(" memory strict"); \ - __testlib_ezbenchreport(NAME, MAX(.001, Speculative - Control), \ - MAX(.001, MemoryStrict - Control)); \ +#define EZBENCH_C(NAME, CONTROL, EXPR) \ + do { \ + int Core, Tries, Interrupts; \ + double Control, Speculative, MemoryStrict; \ + Tries = 0; \ + do { \ + __testlib_yield(); \ + Core = __testlib_getcore(); \ + Interrupts = __testlib_getinterrupts(); \ + Control = BENCHLOOP(__startbench_m, __endbench_m, EZBENCH_COUNT, \ + ({ __polluteregisters(); }), (CONTROL)); \ + } while (++Tries < EZBENCH_TRIES && \ + (__testlib_getcore() != Core && \ + __testlib_getinterrupts() > Interrupts)); \ + if (Tries == EZBENCH_TRIES) \ + __testlib_ezbenchwarn(" control"); \ + Tries = 0; \ + do { \ + __testlib_yield(); \ + Core = __testlib_getcore(); \ + Interrupts = __testlib_getinterrupts(); \ + EXPR; \ + Speculative = BENCHLOOP(__startbench, __endbench, EZBENCH_COUNT, \ + __polluteregisters(), (EXPR)); \ + } while (++Tries < EZBENCH_TRIES && \ + (__testlib_getcore() != Core && \ + __testlib_getinterrupts() > Interrupts)); \ + if (Tries == EZBENCH_TRIES) \ + __testlib_ezbenchwarn(" speculative"); \ + Tries = 0; \ + do { \ + __testlib_yield(); \ + Core = __testlib_getcore(); \ + Interrupts = __testlib_getinterrupts(); \ + EXPR; \ + MemoryStrict = BENCHLOOP(__startbench_m, __endbench_m, 8, \ + ({ __polluteregisters(); }), (EXPR)); \ + } while (++Tries < EZBENCH_TRIES && \ + (__testlib_getcore() != Core && \ + __testlib_getinterrupts() > Interrupts)); \ + if (Tries == EZBENCH_TRIES) \ + __testlib_ezbenchwarn(" memory strict"); \ + __testlib_ezbenchreport(NAME, MAX(.001, Speculative - Control), \ + MAX(.001, MemoryStrict - Control)); \ } while (0) #define EZBENCH_N(NAME, N, EXPR) \ @@ -156,7 +163,8 @@ COSMOPOLITAN_C_START_ EXPR; \ Speculative = BENCHLOOPER(__startbench, __endbench, 32, (EXPR)); \ } while (++Tries < EZBENCH_TRIES && !Speculative); \ - if (Tries == EZBENCH_TRIES) __testlib_ezbenchwarn(""); \ + if (Tries == EZBENCH_TRIES) \ + __testlib_ezbenchwarn(""); \ __testlib_ezbenchreport_n(NAME, 'n', N, Speculative); \ } while (0) diff --git a/libc/testlib/testlib.h b/libc/testlib/testlib.h index 07654b13d..8ff94e2da 100644 --- a/libc/testlib/testlib.h +++ b/libc/testlib/testlib.h @@ -420,8 +420,10 @@ forceinline void testlib_onfail2(bool isfatal) { forceinline void assertNotEquals(FILIFU_ARGS intptr_t donotwant, intptr_t got, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (got != donotwant) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (got != donotwant) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertNotEquals", "=", gotcode, testlib_formatint(got), testlib_formatint(donotwant)); testlib_onfail2(isfatal); @@ -455,8 +457,10 @@ forceinline void assertBetween(FILIFU_ARGS intptr_t beg, intptr_t end, intptr_t got, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (beg <= got && got <= end) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (beg <= got && got <= end) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertBetween", "∉", gotcode, testlib_formatint(got), testlib_formatrange(beg, end)); testlib_onfail2(isfatal); @@ -466,8 +470,10 @@ forceinline void assertStringEquals(FILIFU_ARGS size_t cw, const void *want, const void *got, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (testlib_strequals(cw, want, got)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_strequals(cw, want, got)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertStringEquals", "≠", gotcode, testlib_formatstr(cw, want, -1), testlib_formatstr(cw, got, -1)); @@ -478,8 +484,10 @@ forceinline void assertStringNotEquals(FILIFU_ARGS size_t cw, const void *want, const void *got, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (!testlib_strequals(cw, want, got)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (!testlib_strequals(cw, want, got)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertStringNotEquals", "=", gotcode, testlib_formatstr(cw, want, -1), testlib_formatstr(cw, got, -1)); @@ -490,8 +498,10 @@ forceinline void assertStrnEquals(FILIFU_ARGS size_t cw, const void *want, const void *got, size_t n, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (testlib_strnequals(cw, want, got, n)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_strnequals(cw, want, got, n)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertStrnEquals", "≠", gotcode, testlib_formatstr(cw, got, n), testlib_formatstr(cw, want, n)); @@ -502,8 +512,10 @@ forceinline void assertStrnNotEquals(FILIFU_ARGS size_t cw, const void *want, const void *got, size_t n, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (!testlib_strnequals(cw, want, got, n)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (!testlib_strnequals(cw, want, got, n)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertStrnNotEquals", "=", gotcode, testlib_formatstr(cw, got, n), testlib_formatstr(cw, want, n)); @@ -514,8 +526,10 @@ forceinline void assertStringCaseEquals(FILIFU_ARGS size_t cw, const void *want, const void *got, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (testlib_strcaseequals(cw, want, got)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_strcaseequals(cw, want, got)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertStringCaseEquals", "≠", gotcode, testlib_formatstr(cw, got, -1), testlib_formatstr(cw, want, -1)); @@ -526,8 +540,10 @@ forceinline void assertStringCaseNotEquals(FILIFU_ARGS size_t cw, const void *want, const void *got, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (!testlib_strcaseequals(cw, want, got)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (!testlib_strcaseequals(cw, want, got)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertStringCaseNotEquals", "=", gotcode, testlib_formatstr(cw, got, -1), testlib_formatstr(cw, want, -1)); @@ -538,8 +554,10 @@ forceinline void assertStrnCaseEquals(FILIFU_ARGS size_t cw, const void *want, const void *got, size_t n, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (testlib_strncaseequals(cw, want, got, n)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_strncaseequals(cw, want, got, n)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertStrnCaseEquals", "≠", gotcode, testlib_formatstr(cw, got, n), testlib_formatstr(cw, want, n)); @@ -551,8 +569,10 @@ forceinline void assertStrnCaseNotEquals(FILIFU_ARGS size_t cw, size_t n, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (!testlib_strncaseequals(cw, want, got, n)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (!testlib_strncaseequals(cw, want, got, n)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertStrnCaseNotEquals", "=", gotcode, testlib_formatstr(cw, got, n), testlib_formatstr(cw, want, n)); @@ -563,8 +583,10 @@ forceinline void assertStartsWith(FILIFU_ARGS size_t cw, const char *prefix, const char *s, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (testlib_startswith(cw, s, prefix)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_startswith(cw, s, prefix)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertStartsWith", "≠", gotcode, testlib_formatstr(1, prefix, -1), testlib_formatstr(1, s, -1)); @@ -575,8 +597,10 @@ forceinline void assertEndsWith(FILIFU_ARGS size_t cw, const char *suffix, const char *s, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (testlib_endswith(cw, s, suffix)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_endswith(cw, s, suffix)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertEndsWith", "≠", gotcode, testlib_formatstr(1, s, -1), testlib_formatstr(1, suffix, -1)); @@ -587,8 +611,10 @@ forceinline void assertContains(FILIFU_ARGS size_t cw, const char *needle, const char *s, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (testlib_contains(cw, s, needle)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_contains(cw, s, needle)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertContains", "∉", gotcode, testlib_formatstr(1, s, -1), testlib_formatstr(1, needle, -1)); @@ -600,8 +626,10 @@ forceinline void assertBinaryEquals_cp437(FILIFU_ARGS const char16_t *want, const char *gotcode, bool isfatal) { ++g_testlib_ran; char *v1, *v2; - if (testlib_binequals(want, got, n)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_binequals(want, got, n)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_formatbinaryasglyphs(want, got, n, &v1, &v2); testlib_showerror(file, line, func, "assertBinaryEquals", "≠", gotcode, v1, v2); @@ -613,8 +641,10 @@ forceinline void assertBinaryEquals_hex(FILIFU_ARGS const char *want, const char *gotcode, bool isfatal) { ++g_testlib_ran; char *v1, *v2; - if (testlib_hexequals(want, got, n)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_hexequals(want, got, n)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_formatbinaryashex(want, got, n, &v1, &v2); testlib_showerror(file, line, func, "assertBinaryEquals", "≠", gotcode, v1, v2); @@ -627,8 +657,10 @@ forceinline void assertBinaryNotEquals_cp437(FILIFU_ARGS const char16_t *want, bool isfatal) { ++g_testlib_ran; char *v1, *v2; - if (!testlib_binequals(want, got, n)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (!testlib_binequals(want, got, n)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_formatbinaryasglyphs(want, got, n, &v1, &v2); testlib_showerror(file, line, func, "assertBinaryNotEquals", "=", gotcode, v1, v2); @@ -640,8 +672,10 @@ forceinline void assertBinaryNotEquals_hex(FILIFU_ARGS const char *want, const char *gotcode, bool isfatal) { ++g_testlib_ran; char *v1, *v2; - if (!testlib_hexequals(want, got, n)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (!testlib_hexequals(want, got, n)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_formatbinaryashex(want, got, n, &v1, &v2); testlib_showerror(file, line, func, "assertBinaryNotEquals", "=", gotcode, v1, v2); @@ -652,8 +686,10 @@ forceinline void assertLongDoubleEquals(FILIFU_ARGS long double want, long double got, const char *gotcode, bool isfatal) { ++g_testlib_ran; - if (testlib_almostequallongdouble(want, got)) return; - if (g_testlib_shoulddebugbreak) DebugBreak(); + if (testlib_almostequallongdouble(want, got)) + return; + if (g_testlib_shoulddebugbreak) + DebugBreak(); testlib_showerror(file, line, func, "assertLongDoubleEquals", "≠", gotcode, testlib_formatfloat(want), testlib_formatfloat(got)); testlib_onfail2(isfatal); diff --git a/libc/thread/sem_open.c b/libc/thread/sem_open.c index 3415a70c2..41ab6615f 100644 --- a/libc/thread/sem_open.c +++ b/libc/thread/sem_open.c @@ -48,7 +48,7 @@ static struct Semaphores { char *path; bool dead; int refs; - } * list; + } *list; } g_semaphores; static void sem_open_lock(void) { diff --git a/libc/thread/thread.h b/libc/thread/thread.h index dfc9ca1e1..b496ce664 100644 --- a/libc/thread/thread.h +++ b/libc/thread/thread.h @@ -44,7 +44,8 @@ COSMOPOLITAN_C_START_ #define PTHREAD_COND_INITIALIZER _PTHREAD_INIT #define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_INIT #define PTHREAD_MUTEX_INITIALIZER _PTHREAD_INIT -#define _PTHREAD_INIT {0} +#define _PTHREAD_INIT \ + { 0 } typedef uintptr_t pthread_t; typedef int pthread_id_np_t; diff --git a/net/http/findcontenttype.c b/net/http/findcontenttype.c index fc4f826f7..5ad6a3a81 100644 --- a/net/http/findcontenttype.c +++ b/net/http/findcontenttype.c @@ -17,9 +17,9 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/assert.h" -#include "libc/serialize.h" #include "libc/intrin/bswap.h" #include "libc/macros.internal.h" +#include "libc/serialize.h" #include "libc/str/str.h" #include "libc/str/tab.internal.h" #include "net/http/http.h" diff --git a/net/http/isnocompressext.c b/net/http/isnocompressext.c index ac26542b9..10b6b7e72 100644 --- a/net/http/isnocompressext.c +++ b/net/http/isnocompressext.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/serialize.h" #include "libc/intrin/bswap.h" #include "libc/macros.internal.h" +#include "libc/serialize.h" #include "libc/str/str.h" #include "libc/str/tab.internal.h" #include "net/http/http.h" diff --git a/net/turfwar/blackhole.c b/net/turfwar/blackhole.c index 0c4b925e9..a1c75025f 100644 --- a/net/turfwar/blackhole.c +++ b/net/turfwar/blackhole.c @@ -18,9 +18,9 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/errno.h" -#include "libc/serialize.h" #include "libc/intrin/kprintf.h" #include "libc/runtime/runtime.h" +#include "libc/serialize.h" #include "libc/sock/sock.h" #include "libc/sock/struct/sockaddr.h" #include "libc/str/str.h" diff --git a/test/dsp/core/illumination_test.c b/test/dsp/core/illumination_test.c index da113648c..491f61315 100644 --- a/test/dsp/core/illumination_test.c +++ b/test/dsp/core/illumination_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "dsp/core/core.h" #include "dsp/core/illumination.h" +#include "dsp/core/core.h" #include "libc/log/log.h" #include "libc/math.h" #include "libc/testlib/ezbench.h" diff --git a/test/libc/calls/sigtimedwait_test.c b/test/libc/calls/sigtimedwait_test.c index c45b735e3..9103485c5 100644 --- a/test/libc/calls/sigtimedwait_test.c +++ b/test/libc/calls/sigtimedwait_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/calls/calls.h" #include "libc/calls/sigtimedwait.h" +#include "libc/calls/calls.h" #include "libc/calls/struct/siginfo.h" #include "libc/calls/struct/siginfo.internal.h" #include "libc/calls/struct/sigset.h" diff --git a/test/libc/fmt/zleb64_test.c b/test/libc/fmt/zleb64_test.c index 78491b5ca..e521f347b 100644 --- a/test/libc/fmt/zleb64_test.c +++ b/test/libc/fmt/zleb64_test.c @@ -18,8 +18,8 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/fmt/leb128.h" #include "libc/limits.h" -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/testlib/testlib.h" TEST(zleb64, testZero) { diff --git a/test/libc/intrin/describegidlist_test.c b/test/libc/intrin/describegidlist_test.c index 1b9d61376..98c6a3408 100644 --- a/test/libc/intrin/describegidlist_test.c +++ b/test/libc/intrin/describegidlist_test.c @@ -23,8 +23,8 @@ TEST(DescribeGidList, test) { uint32_t list[] = {8, 67, 530, 9}; uint32_t biglist[] = {8, 67, 530, 9, 8, 67, 530, 9, 8, 67, 530, 9, - 8, 67, 530, 9, 8, 67, 530, 9, 8, 67, 530, 9, - 8, 67, 530, 9, 8, 67, 530, 9, 8, 67, 530, 9}; + 8, 67, 530, 9, 8, 67, 530, 9, 8, 67, 530, 9, + 8, 67, 530, 9, 8, 67, 530, 9, 8, 67, 530, 9}; EXPECT_STREQ("n/a", DescribeGidList(-1, sizeof(list) / sizeof(list[0]), list)); EXPECT_STREQ("n/a", DescribeGidList(0, -1, list)); diff --git a/test/libc/intrin/lockipc_test.c b/test/libc/intrin/lockipc_test.c index f9111c997..4123c09af 100644 --- a/test/libc/intrin/lockipc_test.c +++ b/test/libc/intrin/lockipc_test.c @@ -30,7 +30,7 @@ struct SharedMemory { pthread_mutex_t mutex; volatile long x; -} * shm; +}* shm; void Worker(void) { long t; diff --git a/test/libc/mem/prog/sock.c b/test/libc/mem/prog/sock.c index 686937c03..914be959c 100644 --- a/test/libc/mem/prog/sock.c +++ b/test/libc/mem/prog/sock.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/errno.h" #include "libc/sock/sock.h" +#include "libc/errno.h" #include "libc/sysv/consts/af.h" #include "libc/sysv/consts/sock.h" diff --git a/test/libc/mem/qsort_test.c b/test/libc/mem/qsort_test.c index a30e3e32a..e693da6b6 100644 --- a/test/libc/mem/qsort_test.c +++ b/test/libc/mem/qsort_test.c @@ -19,7 +19,6 @@ #include "libc/macros.internal.h" #include "libc/mem/alg.h" #include "libc/mem/gc.h" -#include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/stdio/rand.h" diff --git a/test/libc/nexgen32e/strsak32_test.c b/test/libc/nexgen32e/strsak32_test.c index 18e0be763..4508ed735 100644 --- a/test/libc/nexgen32e/strsak32_test.c +++ b/test/libc/nexgen32e/strsak32_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/nexgen32e/nexgen32e.h" #include "libc/mem/gc.h" +#include "libc/nexgen32e/nexgen32e.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" diff --git a/test/libc/proc/handkill_test.c b/test/libc/proc/handkill_test.c index 7e03f7a38..07284b4ee 100644 --- a/test/libc/proc/handkill_test.c +++ b/test/libc/proc/handkill_test.c @@ -41,7 +41,7 @@ struct SharedMemory { atomic_bool ready; atomic_bool got_signal; atomic_bool handler_returned; -} * shm; +} *shm; void OnSig(int sig) { signal(SIGUSR1, SIG_DFL); diff --git a/test/libc/proc/sched_getaffinity_test.c b/test/libc/proc/sched_getaffinity_test.c index d75680f95..6e2a7f65d 100644 --- a/test/libc/proc/sched_getaffinity_test.c +++ b/test/libc/proc/sched_getaffinity_test.c @@ -23,8 +23,8 @@ #include "libc/fmt/conv.h" #include "libc/intrin/popcnt.h" #include "libc/intrin/safemacros.internal.h" -#include "libc/runtime/runtime.h" #include "libc/proc/posix_spawn.h" +#include "libc/runtime/runtime.h" #include "libc/testlib/subprocess.h" #include "libc/testlib/testlib.h" #include "libc/thread/thread.h" diff --git a/test/libc/stdio/crypt_test.c b/test/libc/stdio/crypt_test.c index b3c4d50ff..c61963435 100644 --- a/test/libc/stdio/crypt_test.c +++ b/test/libc/stdio/crypt_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/testlib/testlib.h" #include "third_party/musl/crypt.h" +#include "libc/testlib/testlib.h" TEST(crypt, test) { // consistent with python crypt.crypt() diff --git a/test/libc/stdio/devrand_test.c b/test/libc/stdio/devrand_test.c index 0eca6ac64..f0b238232 100644 --- a/test/libc/stdio/devrand_test.c +++ b/test/libc/stdio/devrand_test.c @@ -17,9 +17,9 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/dce.h" +#include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/stdio/rand.h" -#include "libc/mem/gc.h" #include "libc/str/str.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/stdio/dumphexc_test.c b/test/libc/stdio/dumphexc_test.c index 5ad6d0f0d..cd8868f44 100644 --- a/test/libc/stdio/dumphexc_test.c +++ b/test/libc/stdio/dumphexc_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/stdio/hex.internal.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" diff --git a/test/libc/stdio/fgetln_test.c b/test/libc/stdio/fgetln_test.c index 90890256d..14857cb61 100644 --- a/test/libc/stdio/fgetln_test.c +++ b/test/libc/stdio/fgetln_test.c @@ -18,7 +18,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/mem/gc.h" -#include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" diff --git a/test/libc/stdio/iconv_test.c b/test/libc/stdio/iconv_test.c index 15684679d..9b47df98c 100644 --- a/test/libc/stdio/iconv_test.c +++ b/test/libc/stdio/iconv_test.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/mem/mem.h" -#include "libc/mem/gc.h" #include "libc/stdio/iconv.h" +#include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/stdio/joinstrlist_test.c b/test/libc/stdio/joinstrlist_test.c index d81eba1ef..bd990cf18 100644 --- a/test/libc/stdio/joinstrlist_test.c +++ b/test/libc/stdio/joinstrlist_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/serialize.h" #include "libc/mem/mem.h" +#include "libc/serialize.h" #include "libc/stdio/append.h" #include "libc/stdio/strlist.internal.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/stdio/rand_test.c b/test/libc/stdio/rand_test.c index 0ec7b0b3a..d8a6829a1 100644 --- a/test/libc/stdio/rand_test.c +++ b/test/libc/stdio/rand_test.c @@ -17,8 +17,8 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/stdio/rand.h" -#include "libc/serialize.h" #include "libc/mem/mem.h" +#include "libc/serialize.h" #include "libc/str/str.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/stdio/vappendf_test.c b/test/libc/stdio/vappendf_test.c index 72c49c936..c3894660f 100644 --- a/test/libc/stdio/vappendf_test.c +++ b/test/libc/stdio/vappendf_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/serialize.h" #include "libc/mem/mem.h" +#include "libc/serialize.h" #include "libc/stdio/append.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" diff --git a/test/libc/str/blake2_test.c b/test/libc/str/blake2_test.c index 41d17aa75..65f2f34e0 100644 --- a/test/libc/str/blake2_test.c +++ b/test/libc/str/blake2_test.c @@ -16,11 +16,11 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/stdio/stdio.h" #include "libc/str/blake2.h" #include "libc/assert.h" #include "libc/mem/mem.h" #include "libc/stdio/rand.h" +#include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/str/tab.internal.h" #include "libc/testlib/ezbench.h" diff --git a/test/libc/thread/pthread_atfork_test.c b/test/libc/thread/pthread_atfork_test.c index 06b87cded..dc977b9aa 100644 --- a/test/libc/thread/pthread_atfork_test.c +++ b/test/libc/thread/pthread_atfork_test.c @@ -19,7 +19,6 @@ #include "libc/calls/calls.h" #include "libc/dce.h" #include "libc/mem/gc.h" -#include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/runtime/internal.h" #include "libc/runtime/runtime.h" diff --git a/test/libc/thread/pthread_rwlock_rdlock_test.c b/test/libc/thread/pthread_rwlock_rdlock_test.c index 9c7b8c165..e7ad11cc3 100644 --- a/test/libc/thread/pthread_rwlock_rdlock_test.c +++ b/test/libc/thread/pthread_rwlock_rdlock_test.c @@ -18,7 +18,6 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/atomic.h" #include "libc/mem/gc.h" -#include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/testlib/testlib.h" #include "libc/thread/thread.h" diff --git a/test/libc/tinymath/measureentropy_test.c b/test/libc/tinymath/measureentropy_test.c index 75389c14f..0c9ec1a96 100644 --- a/test/libc/tinymath/measureentropy_test.c +++ b/test/libc/tinymath/measureentropy_test.c @@ -17,8 +17,8 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/math.h" -#include "libc/stdio/rand.h" #include "libc/mem/gc.h" +#include "libc/stdio/rand.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/x/utf16to8_test.c b/test/libc/x/utf16to8_test.c index fc7196566..e359df03f 100644 --- a/test/libc/x/utf16to8_test.c +++ b/test/libc/x/utf16to8_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/x/utf8to16_test.c b/test/libc/x/utf8to16_test.c index ce3c21072..cdd3d99d1 100644 --- a/test/libc/x/utf8to16_test.c +++ b/test/libc/x/utf8to16_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" diff --git a/test/libc/x/utf8to32_test.c b/test/libc/x/utf8to32_test.c index 0935f7485..cf17662bb 100644 --- a/test/libc/x/utf8to32_test.c +++ b/test/libc/x/utf8to32_test.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/mem/shuffle.internal.h" -#include "libc/mem/gc.h" #include "libc/stdio/rand.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" diff --git a/test/net/http/decodelatin1_test.c b/test/net/http/decodelatin1_test.c index be3d87503..822c7d215 100644 --- a/test/net/http/decodelatin1_test.c +++ b/test/net/http/decodelatin1_test.c @@ -17,8 +17,8 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" diff --git a/test/net/http/encodehttpheadervalue_test.c b/test/net/http/encodehttpheadervalue_test.c index faa1c40d5..2100c3779 100644 --- a/test/net/http/encodehttpheadervalue_test.c +++ b/test/net/http/encodehttpheadervalue_test.c @@ -17,8 +17,8 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/errno.h" -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" diff --git a/test/net/http/escapehtml_test.c b/test/net/http/escapehtml_test.c index 95cf2729e..7eebca47c 100644 --- a/test/net/http/escapehtml_test.c +++ b/test/net/http/escapehtml_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" diff --git a/test/net/http/escapejsstringliteral_test.c b/test/net/http/escapejsstringliteral_test.c index c71718b77..865738262 100644 --- a/test/net/http/escapejsstringliteral_test.c +++ b/test/net/http/escapejsstringliteral_test.c @@ -18,11 +18,11 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" #include "libc/log/check.h" -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/stdio/stdio.h" -#include "libc/temp.h" #include "libc/str/str.h" +#include "libc/temp.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" diff --git a/test/net/http/escapeurlparam_test.c b/test/net/http/escapeurlparam_test.c index c6fffedb7..1d914740d 100644 --- a/test/net/http/escapeurlparam_test.c +++ b/test/net/http/escapeurlparam_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" diff --git a/test/net/http/indentlines_test.c b/test/net/http/indentlines_test.c index 79599d678..e8f9ce5c9 100644 --- a/test/net/http/indentlines_test.c +++ b/test/net/http/indentlines_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" diff --git a/test/net/http/tokenbucket_test.c b/test/net/http/tokenbucket_test.c index 94bd3ff43..160c55058 100644 --- a/test/net/http/tokenbucket_test.c +++ b/test/net/http/tokenbucket_test.c @@ -16,6 +16,7 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "net/http/tokenbucket.h" #include "libc/assert.h" #include "libc/atomic.h" #include "libc/calls/struct/timespec.h" @@ -28,7 +29,6 @@ #include "libc/testlib/ezbench.h" #include "libc/testlib/testlib.h" #include "net/http/http.h" -#include "net/http/tokenbucket.h" #define TB_CIDR 22 #define TB_BYTES (1u << TB_CIDR) diff --git a/test/net/http/underlong_test.c b/test/net/http/underlong_test.c index 246aafe97..a9fbc5c41 100644 --- a/test/net/http/underlong_test.c +++ b/test/net/http/underlong_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/mem/mem.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" diff --git a/test/tool/args/args_test.c b/test/tool/args/args_test.c index 4ddcd3088..ec57b1044 100644 --- a/test/tool/args/args_test.c +++ b/test/tool/args/args_test.c @@ -16,10 +16,10 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "tool/args/args.h" #include "libc/mem/mem.h" #include "libc/runtime/runtime.h" #include "libc/testlib/testlib.h" -#include "tool/args/args.h" void FreeZipArgs(void); int LoadZipArgsImpl(int *, char ***, char *); diff --git a/test/tool/build/lib/interner_test.c b/test/tool/build/lib/interner_test.c index 23d2966fe..b26709ae7 100644 --- a/test/tool/build/lib/interner_test.c +++ b/test/tool/build/lib/interner_test.c @@ -16,15 +16,15 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/mem/mem.h" +#include "tool/build/lib/interner.h" #include "libc/mem/gc.h" +#include "libc/mem/mem.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/fastrandomstring.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" -#include "tool/build/lib/interner.h" TEST(interner, test) { struct Interner *t = defer(freeinterner, newinterner()); diff --git a/test/tool/build/lib/stripcomponents_test.c b/test/tool/build/lib/stripcomponents_test.c index 875f6858f..0809fdd23 100644 --- a/test/tool/build/lib/stripcomponents_test.c +++ b/test/tool/build/lib/stripcomponents_test.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/testlib/testlib.h" #include "tool/build/lib/stripcomponents.h" +#include "libc/testlib/testlib.h" TEST(StripComponents, test) { EXPECT_STREQ("", StripComponents("", 0)); diff --git a/test/tool/viz/lib/fun_test.c b/test/tool/viz/lib/fun_test.c index 5cb0ac213..dc5340631 100644 --- a/test/tool/viz/lib/fun_test.c +++ b/test/tool/viz/lib/fun_test.c @@ -18,8 +18,8 @@ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/log/check.h" #include "libc/macros.internal.h" -#include "libc/stdio/rand.h" #include "libc/mem/gc.h" +#include "libc/stdio/rand.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/testlib.h" diff --git a/test/tool/viz/lib/halfblit_test.c b/test/tool/viz/lib/halfblit_test.c index c0689c80a..20230e91d 100644 --- a/test/tool/viz/lib/halfblit_test.c +++ b/test/tool/viz/lib/halfblit_test.c @@ -16,11 +16,11 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "tool/viz/lib/halfblit.h" #include "libc/fmt/bing.internal.h" #include "libc/mem/gc.h" #include "libc/testlib/testlib.h" #include "libc/x/x.h" -#include "tool/viz/lib/halfblit.h" TEST(halfblit, test_4x4_to_2x2) { EXPECT_BINEQ(u" ☺" diff --git a/tool/args/args.c b/tool/args/args.c index 0d7a298de..cfb88fd59 100644 --- a/tool/args/args.c +++ b/tool/args/args.c @@ -92,12 +92,11 @@ int LoadZipArgsImpl(int *argc, char ***argv, char *data) { start = 0; } - if (!founddots) - { - founddots = true; - for (i = 1; i < *argc; ++i) { - AddZipArg(&n, &args, (*argv)[i]); - } + if (!founddots) { + founddots = true; + for (i = 1; i < *argc; ++i) { + AddZipArg(&n, &args, (*argv)[i]); + } } if (founddots || *argc <= 1) { diff --git a/tool/build/ar.c b/tool/build/ar.c index 469d76582..616ee56dd 100644 --- a/tool/build/ar.c +++ b/tool/build/ar.c @@ -29,11 +29,11 @@ #include "libc/fmt/itoa.h" #include "libc/fmt/libgen.h" #include "libc/fmt/magnumstrs.internal.h" -#include "libc/serialize.h" #include "libc/intrin/bsr.h" #include "libc/limits.h" #include "libc/macros.internal.h" #include "libc/runtime/runtime.h" +#include "libc/serialize.h" #include "libc/stdckdint.h" #include "libc/str/str.h" #include "libc/sysv/consts/map.h" diff --git a/tool/build/lib/asmdown.h b/tool/build/lib/asmdown.h index 56d324042..44a994294 100644 --- a/tool/build/lib/asmdown.h +++ b/tool/build/lib/asmdown.h @@ -11,7 +11,7 @@ struct Asmdown { char *name; bool is_alias; struct Javadown *javadown; - } * p; + } *p; } symbols; }; diff --git a/tool/build/lib/interner.c b/tool/build/lib/interner.c index 89d9d9488..a287b1132 100644 --- a/tool/build/lib/interner.c +++ b/tool/build/lib/interner.c @@ -33,7 +33,7 @@ struct InternerObject { struct InternerHash { unsigned hash; /* 0 means empty */ unsigned index; - } * p; + } *p; }; static void rehash(struct InternerObject *it) { diff --git a/tool/build/lib/javadown.c b/tool/build/lib/javadown.c index 40c73f738..476da98ca 100644 --- a/tool/build/lib/javadown.c +++ b/tool/build/lib/javadown.c @@ -27,7 +27,7 @@ struct Lines { struct Line { char *p; size_t n; - } * p; + } *p; }; static char *SkipEmptyFirstLine(char *p) { diff --git a/tool/build/lib/javadown.h b/tool/build/lib/javadown.h index ed6edbee1..835447709 100644 --- a/tool/build/lib/javadown.h +++ b/tool/build/lib/javadown.h @@ -9,7 +9,7 @@ struct JavadownTag { struct JavadownTags { size_t n; - struct JavadownTag * p; + struct JavadownTag *p; }; struct Javadown { diff --git a/tool/build/reboot.c b/tool/build/reboot.c index d6d686bed..77d324430 100644 --- a/tool/build/reboot.c +++ b/tool/build/reboot.c @@ -7,11 +7,11 @@ │ • http://creativecommons.org/publicdomain/zero/1.0/ │ ╚─────────────────────────────────────────────────────────────────*/ #endif +#include "libc/sysv/consts/reboot.h" #include "libc/calls/calls.h" #include "libc/runtime/runtime.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "libc/sysv/consts/reboot.h" int main(int argc, char *argv[]) { char line[8] = {0}; diff --git a/tool/decode/lib/disassemblehex.c b/tool/decode/lib/disassemblehex.c index 77b1a20d1..afa901259 100644 --- a/tool/decode/lib/disassemblehex.c +++ b/tool/decode/lib/disassemblehex.c @@ -16,10 +16,10 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "tool/decode/lib/disassemblehex.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" #include "libc/str/tab.internal.h" -#include "tool/decode/lib/disassemblehex.h" static size_t countzeroes(const uint8_t *data, size_t size) { size_t i; diff --git a/tool/decode/lib/disassemblehex.h b/tool/decode/lib/disassemblehex.h index eb8224077..35ec894e3 100644 --- a/tool/decode/lib/disassemblehex.h +++ b/tool/decode/lib/disassemblehex.h @@ -1,6 +1,8 @@ #ifndef COSMOPOLITAN_TOOL_DECODE_LIB_DISASSEMBLEHEX_H_ #define COSMOPOLITAN_TOOL_DECODE_LIB_DISASSEMBLEHEX_H_ +#include "libc/stdio/stdio.h" + #define kDisassembleHexColumns 8 COSMOPOLITAN_C_START_ diff --git a/tool/decode/lib/elfidnames.c b/tool/decode/lib/elfidnames.c index 21388ace5..734d9f3aa 100644 --- a/tool/decode/lib/elfidnames.c +++ b/tool/decode/lib/elfidnames.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "tool/decode/lib/elfidnames.h" #include "libc/elf/def.h" #include "libc/elf/elf.h" -#include "tool/decode/lib/elfidnames.h" const struct IdName kElfTypeNames[] = { {ET_NONE, "ET_NONE"}, diff --git a/tool/decode/lib/ntfileflagnames.c b/tool/decode/lib/ntfileflagnames.c index 56d6f1ba5..d4cf7761b 100644 --- a/tool/decode/lib/ntfileflagnames.c +++ b/tool/decode/lib/ntfileflagnames.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/nt/enum/fileflagandattributes.h" #include "tool/decode/lib/ntfileflagnames.h" +#include "libc/nt/enum/fileflagandattributes.h" const struct IdName kNtFileFlagNames[] = { {kNtFileAttributeReadonly, "kNtFileAttributeReadonly"}, diff --git a/tool/decode/lib/peidnames.c b/tool/decode/lib/peidnames.c index 2b78c2cf0..71e30ff73 100644 --- a/tool/decode/lib/peidnames.c +++ b/tool/decode/lib/peidnames.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/nt/pedef.internal.h" #include "tool/decode/lib/peidnames.h" +#include "libc/nt/pedef.internal.h" const struct IdName kNtImageFileMachineNames[] = { {kNtImageFileMachineUnknown, "kNtImageFileMachineUnknown"}, diff --git a/tool/decode/lib/titlegen.c b/tool/decode/lib/titlegen.c index 2d45ded1d..c5073226c 100644 --- a/tool/decode/lib/titlegen.c +++ b/tool/decode/lib/titlegen.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "tool/decode/lib/titlegen.h" #include "libc/stdio/stdio.h" #include "libc/str/str.h" -#include "tool/decode/lib/titlegen.h" const struct Modeline kModelineAsm = { " mode:asm; indent-tabs-mode:t; tab-width:8; coding:utf-8 ", diff --git a/tool/decode/lib/zipnames.c b/tool/decode/lib/zipnames.c index 6cf872046..a5d834ff4 100644 --- a/tool/decode/lib/zipnames.c +++ b/tool/decode/lib/zipnames.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "tool/decode/lib/zipnames.h" #include "libc/nt/enum/fileflagandattributes.h" #include "libc/zip.internal.h" -#include "tool/decode/lib/zipnames.h" const struct IdName kZipCompressionNames[] = { {kZipCompressionNone, "kZipCompressionNone"}, diff --git a/tool/decode/pe2.c b/tool/decode/pe2.c index 3d8ab4eb2..7660aeee8 100644 --- a/tool/decode/pe2.c +++ b/tool/decode/pe2.c @@ -22,7 +22,6 @@ #include "libc/fmt/libgen.h" #include "libc/intrin/safemacros.internal.h" #include "libc/mem/gc.h" -#include "libc/mem/gc.h" #include "libc/mem/mem.h" #include "libc/nt/struct/imagedosheader.internal.h" #include "libc/nt/struct/imagentheaders.internal.h" diff --git a/tool/net/ljson.c b/tool/net/ljson.c index b78367081..7ca5ff76c 100644 --- a/tool/net/ljson.c +++ b/tool/net/ljson.c @@ -17,12 +17,12 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "tool/net/ljson.h" -#include "libc/serialize.h" #include "libc/intrin/likely.h" #include "libc/log/check.h" #include "libc/log/log.h" #include "libc/runtime/runtime.h" #include "libc/runtime/stack.h" +#include "libc/serialize.h" #include "libc/stdckdint.h" #include "libc/str/str.h" #include "libc/str/tab.internal.h" diff --git a/tool/plinko/lib/error.c b/tool/plinko/lib/error.c index 9f17201ca..4ecdf19f5 100644 --- a/tool/plinko/lib/error.c +++ b/tool/plinko/lib/error.c @@ -16,9 +16,9 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "tool/plinko/lib/error.h" #include "libc/log/log.h" #include "libc/runtime/runtime.h" -#include "tool/plinko/lib/error.h" #include "tool/plinko/lib/plinko.h" #include "tool/plinko/lib/printf.h" #include "tool/plinko/lib/stack.h" diff --git a/tool/plinko/lib/gc.h b/tool/plinko/lib/gc.h index 5fce4dd52..7196579ca 100644 --- a/tool/plinko/lib/gc.h +++ b/tool/plinko/lib/gc.h @@ -19,12 +19,14 @@ void Marker(const dword[], int, int); int Relocater(const dword[], const unsigned[], int, int); forceinline int Relocate(const struct Gc *G, int x) { - if (x >= G->C) return x; + if (x >= G->C) + return x; return Relocater(G->M, G->P, G->A, x); } forceinline void Mark(struct Gc *G, int x) { - if (x >= G->A) return; + if (x >= G->A) + return; Marker(G->M, G->A, x); } diff --git a/tool/plinko/lib/histo.c b/tool/plinko/lib/histo.c index 48d62dcaf..6c1b0f1b3 100644 --- a/tool/plinko/lib/histo.c +++ b/tool/plinko/lib/histo.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/assert.h" #include "tool/plinko/lib/histo.h" +#include "libc/assert.h" #include "tool/plinko/lib/plinko.h" #include "tool/plinko/lib/printf.h" diff --git a/tool/plinko/lib/index.h b/tool/plinko/lib/index.h index ee9f74499..f4d821e47 100644 --- a/tool/plinko/lib/index.h +++ b/tool/plinko/lib/index.h @@ -6,13 +6,15 @@ COSMOPOLITAN_C_START_ forceinline nosideeffect int Head(int x) { - if (x <= 0) return LO(Get(x)); + if (x <= 0) + return LO(Get(x)); Push(x); Raise(kCar); } forceinline nosideeffect int Tail(int x) { - if (x <= 0) return HI(Get(x)); + if (x <= 0) + return HI(Get(x)); Push(x); Raise(kCdr); } diff --git a/tool/plinko/lib/plinko.h b/tool/plinko/lib/plinko.h index 4ba9089d6..684e95c19 100644 --- a/tool/plinko/lib/plinko.h +++ b/tool/plinko/lib/plinko.h @@ -311,8 +311,10 @@ forceinline struct T Ret(dword ea, dword tm, dword r) { } static inline int FasterRecurse(int v, int a, dword p1, dword p2) { - if (v == LO(p1)) return HI(p1); - if (v == LO(p2)) return HI(p2); + if (v == LO(p1)) + return HI(p1); + if (v == LO(p2)) + return HI(p2); /* if (IsPrecious(v)) return v; */ /* if (v < 0 && Car(v) == kQuote) return Car(Cdr(v)); */ return recurse(MAKE(v, a), p1, p2); diff --git a/tool/plinko/lib/print.c b/tool/plinko/lib/print.c index 2ba74c126..0e0301071 100644 --- a/tool/plinko/lib/print.c +++ b/tool/plinko/lib/print.c @@ -16,10 +16,10 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "tool/plinko/lib/print.h" #include "tool/build/lib/case.h" #include "tool/plinko/lib/char.h" #include "tool/plinko/lib/plinko.h" -#include "tool/plinko/lib/print.h" #include "tool/plinko/lib/tree.h" int PrintDot(int fd) { diff --git a/tool/viz/lib/formatstringtable-code.c b/tool/viz/lib/formatstringtable-code.c index 4ab9b5ff3..1034dc875 100644 --- a/tool/viz/lib/formatstringtable-code.c +++ b/tool/viz/lib/formatstringtable-code.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/intrin/safemacros.internal.h" #include "libc/fmt/itoa.h" +#include "libc/intrin/safemacros.internal.h" #include "tool/viz/lib/formatstringtable.h" void *FormatStringTableAsCode(long yn, long xn, const char *const T[yn][xn], diff --git a/tool/viz/lib/glyphs.c b/tool/viz/lib/glyphs.c index 4f4483eb0..f23a32ae9 100644 --- a/tool/viz/lib/glyphs.c +++ b/tool/viz/lib/glyphs.c @@ -53,7 +53,8 @@ // from the space left below, seen by overimposing an underline ⠿_ // along the 3 dots, the Y axis is least 1,0,1,0,1,0,0,1 so 8 steps // -// Problem: fonts are taller than wider, and terminals are traditionally 80x24, so +// Problem: fonts are taller than wider, and terminals are traditionally 80x24, +// so // - we shouldn't use square glyphs, 8x16 seems to be the minimal size // - we should adapt the conversion to BMP to avoid accidental Y downsampling diff --git a/tool/viz/lib/halfblit.c b/tool/viz/lib/halfblit.c index 5a3a1ae15..8ca4f8f63 100644 --- a/tool/viz/lib/halfblit.c +++ b/tool/viz/lib/halfblit.c @@ -16,8 +16,8 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/log/check.h" #include "tool/viz/lib/halfblit.h" +#include "libc/log/check.h" void *halfblit(size_t n, void *block) { unsigned y, x; diff --git a/tool/viz/lib/stringbuilder.c b/tool/viz/lib/stringbuilder.c index 6f0771f52..f9419a41e 100644 --- a/tool/viz/lib/stringbuilder.c +++ b/tool/viz/lib/stringbuilder.c @@ -16,14 +16,15 @@ │ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "tool/viz/lib/stringbuilder.h" #include "libc/log/check.h" #include "libc/macros.internal.h" #include "libc/mem/mem.h" #include "libc/str/str.h" #include "libc/x/x.h" -#include "tool/viz/lib/stringbuilder.h" -static dontinline void StringBuilderGrow(size_t need, struct StringBuilder *sb) { +static dontinline void StringBuilderGrow(size_t need, + struct StringBuilder *sb) { size_t n2; n2 = MAX(16, sb->n); while (sb->i + need > n2) diff --git a/tool/viz/life.c b/tool/viz/life.c index 896e19034..35671839b 100644 --- a/tool/viz/life.c +++ b/tool/viz/life.c @@ -225,10 +225,10 @@ static char16_t statusline16[256]; #define GODOWN(x) ((x) << 8) #define GORIGHT(x) (((x) & ~RIGHT) << 1) #define GOLEFT(x) (((x) & ~LEFT) >> 1) -#define LEFTMOST(x) ((x) & LEFT) -#define RIGHTMOST(x) ((x) & RIGHT) -#define TOPMOST(x) ((x) & TOP) -#define BOTMOST(x) ((x) & BOTTOM) +#define LEFTMOST(x) ((x)&LEFT) +#define RIGHTMOST(x) ((x)&RIGHT) +#define TOPMOST(x) ((x)&TOP) +#define BOTMOST(x) ((x)&BOTTOM) #define ADD(X) \ do { \ diff --git a/tool/viz/maxmind.c b/tool/viz/maxmind.c index 823cf460a..ffa0ed9d0 100644 --- a/tool/viz/maxmind.c +++ b/tool/viz/maxmind.c @@ -17,18 +17,20 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" -#include "libc/serialize.h" #include "libc/log/check.h" #include "libc/log/log.h" #include "libc/mem/gc.h" #include "libc/mem/mem.h" +#include "libc/serialize.h" #include "libc/stdio/stdio.h" #include "net/http/http.h" #include "net/http/ip.h" #include "third_party/maxmind/maxminddb.h" -#define PATH(...) \ - (const char *const[]) { __VA_ARGS__, 0 } +#define PATH(...) \ + (const char *const[]) { \ + __VA_ARGS__, 0 \ + } MMDB_s *ipdb, *asdb;