Run clang-format (#1197)

This commit is contained in:
Jōshin 2024-06-01 13:30:43 -07:00 committed by GitHub
parent ea081b262c
commit f032b5570b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
183 changed files with 1074 additions and 983 deletions

View file

@ -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) {

View file

@ -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"

View file

@ -11,7 +11,7 @@ struct Asmdown {
char *name;
bool is_alias;
struct Javadown *javadown;
} * p;
} *p;
} symbols;
};

View file

@ -33,7 +33,7 @@ struct InternerObject {
struct InternerHash {
unsigned hash; /* 0 means empty */
unsigned index;
} * p;
} *p;
};
static void rehash(struct InternerObject *it) {

View file

@ -27,7 +27,7 @@ struct Lines {
struct Line {
char *p;
size_t n;
} * p;
} *p;
};
static char *SkipEmptyFirstLine(char *p) {

View file

@ -9,7 +9,7 @@ struct JavadownTag {
struct JavadownTags {
size_t n;
struct JavadownTag * p;
struct JavadownTag *p;
};
struct Javadown {

View file

@ -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};

View file

@ -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;

View file

@ -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_

View file

@ -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"},

View file

@ -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"},

View file

@ -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"},

View file

@ -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 ",

View file

@ -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"},

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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);
}

View file

@ -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"

View file

@ -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);
}

View file

@ -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);

View file

@ -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) {

View file

@ -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],

View file

@ -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

View file

@ -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;

View file

@ -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)

View file

@ -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 { \

View file

@ -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;