From dfe604f64088bc9c05d9e66eeb0653b0f36370c6 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 14:34:57 -0700 Subject: Order shared.c the way shared.h declares it The header's blob and pathspec checks move after the diff wrappers so each group reads as one, and each static helper now sits directly above its only user. --- source/shared.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'source/shared.h') diff --git a/source/shared.h b/source/shared.h index 4359bef..302b752 100644 --- a/source/shared.h +++ b/source/shared.h @@ -1,9 +1,8 @@ /* - * The helpers that belong to no single page. Repository registration, the - * lifetimes of the reference and commit records the renderers build, thin - * wrappers over git's diff machinery, and a handful of string, date and - * mimetype utilities all live here because several renderers need them. The - * two process-wide globals, ctx and cgit_repolist, are defined here as well. + * The helpers that more than one file needs. Repository registration and thin + * wrappers over git's diff machinery make up most of it, beside a few string + * and request checks. The two process-wide globals, ctx and cgit_repolist, + * are defined here as well. */ #ifndef CGIT_SHARED_H @@ -41,6 +40,15 @@ extern int cgit_diff_files(const struct object_id *old_oid, const struct object_ size_t *old_size, size_t *new_size, int *binary, int context, int ignorews, linediff_fn fn); +/* + * Limit a diff to the paths below prefix, which is taken literally. + */ +extern void cgit_diff_limit_path(struct diff_options *opt, const char *prefix); + +extern void cgit_diff_tree(const struct object_id *old_oid, const struct object_id *new_oid, + filepair_fn fn, const char *prefix, int ignorews); +extern void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix); + /* * Whether a blob of size bytes is past max-blob-size. Callers ask before * reading the object, so a huge blob stays out of memory rather than being @@ -54,15 +62,6 @@ extern int cgit_blob_too_large(size_t size); */ extern void cgit_literal_pathspec(struct pathspec *ps, struct pathspec_item *item, const char *path); -/* - * Limit a diff to the paths below prefix, which is taken literally. - */ -extern void cgit_diff_limit_path(struct diff_options *opt, const char *prefix); - -extern void cgit_diff_tree(const struct object_id *old_oid, const struct object_id *new_oid, - filepair_fn fn, const char *prefix, int ignorews); -extern void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix); - /* * Copy str without its trailing runs of c, returning NULL if nothing is left. */ -- cgit