From 002e415c207e0cafb6aa98bc85a8d41eb411ec89 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Tue, 22 Sep 2026 07:04:21 -1000 Subject: Align with spaces instead of tabs --- source/cache.c | 14 +++++++------- source/cgit.c | 25 ++++++++++++------------- source/scan-tree.c | 14 +++++++------- source/ui-diff.c | 8 ++++---- source/ui-shared.c | 6 +++--- source/ui-snapshot.c | 14 +++++++------- source/ui-summary.c | 4 ++-- 7 files changed, 42 insertions(+), 43 deletions(-) (limited to 'source') diff --git a/source/cache.c b/source/cache.c index 0c86210..091c078 100644 --- a/source/cache.c +++ b/source/cache.c @@ -90,8 +90,8 @@ static int open_slot(struct cache_slot *slot) if (slot->key) slot->key_matches = - keylen >= 0 && - (size_t)keylen == slot->keylen && + keylen >= 0 && + (size_t)keylen == slot->keylen && !memcmp(slot->key, slot->buf, keylen + 1); return 0; @@ -193,8 +193,8 @@ static int is_modified(struct cache_slot *slot) if (stat(slot->path, ¤t)) return 1; return ( - current.st_ino != slot->st.st_ino || - current.st_mtime != slot->st.st_mtime || + current.st_ino != slot->st.st_ino || + current.st_mtime != slot->st.st_mtime || current.st_size != slot->st.st_size ); } @@ -242,9 +242,9 @@ static int lock_slot(struct cache_slot *slot) // slot, and once the path is confirmed to still name this file that // rename can no longer happen, because it takes the lock held here. if ( - fstat(slot->lock_fd, &held) || - stat(slot->lock_path, &named) || - held.st_ino != named.st_ino || + fstat(slot->lock_fd, &held) || + stat(slot->lock_path, &named) || + held.st_ino != named.st_ino || held.st_dev != named.st_dev ) { close(slot->lock_fd); diff --git a/source/cgit.c b/source/cgit.c index 00ce97f..8601dd0 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -384,9 +384,9 @@ static int generate_cached_repolist(const char *path, const char *cached_rc) // list, and once the path is confirmed to still name this file that // rename can no longer happen, because it takes the lock held here. if ( - fstat(fd, &held) || - stat(locked_rc.buf, &named) || - held.st_ino != named.st_ino || + fstat(fd, &held) || + stat(locked_rc.buf, &named) || + held.st_ino != named.st_ino || held.st_dev != named.st_dev ) { err = EAGAIN; @@ -844,10 +844,10 @@ static void authenticate_cookie(void) } if ( - ctx.env.request_method && - ctx.qry.page && - !ctx.repo && - !strcmp(ctx.env.request_method, "POST") && + ctx.env.request_method && + ctx.qry.page && + !ctx.repo && + !strcmp(ctx.env.request_method, "POST") && !strcmp(ctx.qry.page, "login") ) { authenticate_post(); @@ -921,9 +921,9 @@ static int calc_ttl(void) // object id can never come out differently and is the most expensive // page to rebuild. if ( - ctx.qry.has_oid && - page_is_static() && - (!ctx.qry.oid || is_full_oid(ctx.qry.oid)) && + ctx.qry.has_oid && + page_is_static() && + (!ctx.qry.oid || is_full_oid(ctx.qry.oid)) && (!ctx.qry.oid2 || is_full_oid(ctx.qry.oid2)) ) return ctx.cfg.cache_static_ttl; @@ -1157,7 +1157,7 @@ static int prepare_repo_cmd(int nongit, int err, int clone) return 1; } if ( - (ctx.qry.oid && !cgit_valid_rev(ctx.qry.oid)) || + (ctx.qry.oid && !cgit_valid_rev(ctx.qry.oid)) || (ctx.qry.oid2 && !cgit_valid_rev(ctx.qry.oid2)) ) { cgit_print_error_page(400, "Bad Request", "Invalid revision"); @@ -1354,8 +1354,7 @@ int cmd_main(int argc, const char **argv) ttl = calc_ttl(); // An unauthenticated request gets a body meant for one visitor, and a // HEAD request stops after the headers. - if (!ctx.env.authenticated || - (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))) + if (!ctx.env.authenticated || (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))) ctx.cfg.cache_size = 0; build_cache_key(&cache_key); diff --git a/source/scan-tree.c b/source/scan-tree.c index 4110511..97a58e6 100644 --- a/source/scan-tree.c +++ b/source/scan-tree.c @@ -61,13 +61,13 @@ static int trusted_key(const char *name, const char *value) if (ctx.cfg.trust_scan_config) return 1; untrusted = - ends_with(name, "-filter") || - !strcmp(name, "head-content") || - !strcmp(name, "module-link") || - starts_with(name, "module-link.") || - !strcmp(name, "logo") || - !strcmp(name, "logo-link") || - !strcmp(name, "clone-url") || + ends_with(name, "-filter") || + !strcmp(name, "head-content") || + !strcmp(name, "module-link") || + starts_with(name, "module-link.") || + !strcmp(name, "logo") || + !strcmp(name, "logo-link") || + !strcmp(name, "clone-url") || (!strcmp(name, "readme") && !strchr(value, ':')); if (!untrusted) return 1; diff --git a/source/ui-diff.c b/source/ui-diff.c index ee8dc76..f258e9f 100644 --- a/source/ui-diff.c +++ b/source/ui-diff.c @@ -128,8 +128,8 @@ static void print_fileinfo(struct fileinfo *info) } if ( - info->old_mode != info->new_mode && - !is_null_oid(info->old_oid) && + info->old_mode != info->new_mode && + !is_null_oid(info->old_oid) && !is_null_oid(info->new_oid) ) { html("["); @@ -176,8 +176,8 @@ static void count_diff_lines(char *line, int len) if (!render_line_fn || render_suppressed) return; if ( - cap_diffs && - ctx.cfg.max_diff_lines > 0 && + cap_diffs && + ctx.cfg.max_diff_lines > 0 && lines_added + lines_removed > ctx.cfg.max_diff_lines ) { render_suppressed = 1; diff --git a/source/ui-shared.c b/source/ui-shared.c index 25a84a6..4417975 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -1113,9 +1113,9 @@ static char *submodule_url_path(const char *url) return NULL; } } else if ( - skip_prefix(url, "http://", &rest) || - skip_prefix(url, "https://", &rest) || - skip_prefix(url, "git://", &rest) || + skip_prefix(url, "http://", &rest) || + skip_prefix(url, "https://", &rest) || + skip_prefix(url, "git://", &rest) || skip_prefix(url, "ssh://", &rest) ) { rest = strchr(rest, '/'); diff --git a/source/ui-snapshot.c b/source/ui-snapshot.c index 5f2d69d..348fd9c 100644 --- a/source/ui-snapshot.c +++ b/source/ui-snapshot.c @@ -139,13 +139,13 @@ static int write_tar_zstd_archive(const char *hex, const char *prefix) // ui-shared.c reads entry zero as the tar whose signature stands in for every // tar variant, so this order cannot change. const struct cgit_snapshot_format cgit_snapshot_formats[] = { - { ".tar", "application/x-tar", write_tar_archive, NULL }, - { ".tar.gz", "application/gzip", write_tar_gzip_archive, "gzip" }, - { ".tar.bz2", "application/x-bzip2", write_tar_bzip2_archive, "bzip2" }, - { ".tar.lz", "application/x-lzip", write_tar_lzip_archive, "lzip" }, - { ".tar.xz", "application/x-xz", write_tar_xz_archive, "xz" }, - { ".tar.zst", "application/zstd", write_tar_zstd_archive, "zstd" }, - { ".zip", "application/zip", write_zip_archive, NULL }, + { ".tar", "application/x-tar", write_tar_archive, NULL }, + { ".tar.gz", "application/gzip", write_tar_gzip_archive, "gzip" }, + { ".tar.bz2", "application/x-bzip2", write_tar_bzip2_archive, "bzip2" }, + { ".tar.lz", "application/x-lzip", write_tar_lzip_archive, "lzip" }, + { ".tar.xz", "application/x-xz", write_tar_xz_archive, "xz" }, + { ".tar.zst", "application/zstd", write_tar_zstd_archive, "zstd" }, + { ".zip", "application/zip", write_zip_archive, NULL }, { 0 } }; diff --git a/source/ui-summary.c b/source/ui-summary.c index da530e5..0b33a96 100644 --- a/source/ui-summary.c +++ b/source/ui-summary.c @@ -94,8 +94,8 @@ static char *resolve_about_path(const char *filename, const char *ref, const cha resolved_full = realpath(full_path, NULL); resolved_repo = realpath(ctx.repo->path, NULL); if ( - !resolved_base || !resolved_full || !resolved_repo || - path_within(resolved_base, resolved_repo) || + !resolved_base || !resolved_full || !resolved_repo || + path_within(resolved_base, resolved_repo) || !path_within(resolved_base, resolved_full) ) { free(full_path); -- cgit v2.8.0