git-compat-util cleanups
PATCH v4 6/6 common: move alloc macros to common.h
In reply to Calvin Wanalloc_nr, ALLOC_GROW, and ALLOC_GROW_BY are commonly used macros for dynamic array allocation. Moving these macros to git-compat-util.h with the other alloc macros focuses alloc.[ch] to allocation for Git objects and additionally allows us to remove inclusions to alloc.h from files that solely used the above macros.
--- add-patch.c | 1 - alias.c | 1 - alloc.h | 75 ------------------------------ apply.c | 1 - archive-tar.c | 1 - archive.c | 1 - attr.c | 1 - builtin/blame.c | 1 - builtin/cat-file.c | 1 - builtin/checkout--worker.c | 1 - builtin/config.c | 1 - builtin/credential-cache--daemon.c | 1 - builtin/fetch-pack.c | 1 - builtin/fsmonitor--daemon.c | 1 - builtin/grep.c | 1 - builtin/index-pack.c | 1 - builtin/log.c | 1 - builtin/merge.c | 1 - builtin/mktree.c | 1 - builtin/mv.c | 1 - builtin/name-rev.c | 1 - builtin/pack-objects.c | 1 - builtin/repack.c | 1 - builtin/rev-parse.c | 1 - builtin/revert.c | 1 - builtin/rm.c | 1 - builtin/submodule--helper.c | 1 - bulk-checkin.c | 1 - cache-tree.c | 1 - chunk-format.c | 1 - commit-reach.c | 1 - config.c | 1 - daemon.c | 1 - delta-islands.c | 1 - diff.c | 1 - diffcore-rename.c | 1 - dir-iterator.c | 1 - dir.c | 1 - ewah/bitmap.c | 1 - ewah/ewah_bitmap.c | 1 - fetch-pack.c | 1 - fmt-merge-msg.c | 1 - fsck.c | 1 - git-compat-util.h | 75 ++++++++++++++++++++++++++++++ help.c | 1 - http-backend.c | 1 - line-log.c | 1 - list-objects-filter-options.c | 1 - list-objects-filter.c | 1 - midx.c | 1 - object-file.c | 1 - oid-array.c | 1 - oidtree.c | 1 - pack-bitmap-write.c | 1 - pack-bitmap.c | 1 - pack-objects.c | 1 - packfile.c | 1 - parallel-checkout.c | 1 - pretty.c | 1 - prio-queue.c | 1 - quote.c | 1 - read-cache.c | 1 - ref-filter.c | 1 - reflog-walk.c | 1 - refs.c | 1 - refspec.c | 1 - remote-curl.c | 1 - remote.c | 1 - rerere.c | 1 - revision.c | 1 - sequencer.c | 1 - server-info.c | 1 - shallow.c | 1 - sigchain.c | 1 - sparse-index.c | 1 - split-index.c | 1 - strbuf.c | 1 - string-list.c | 1 - strvec.c | 1 - submodule-config.c | 1 - submodule.c | 1 - t/helper/test-reach.c | 1 - trace2/tr2_tls.c | 1 - trailer.c | 1 - transport.c | 1 - tree-walk.c | 1 - userdiff.c | 1 - worktree.c | 1 - 88 files changed, 75 insertions(+), 161 deletions(-)
add-patch.c +0 -1
@@ -1,7 +1,6 @@#include "git-compat-util.h" #include "add-interactive.h" #include "advice.h" -#include "alloc.h" #include "editor.h" #include "environment.h" #include "gettext.h"
alias.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "alias.h" -#include "alloc.h" #include "config.h" #include "gettext.h" #include "strbuf.h"
alloc.h +0 -75
79 lines not on this page · raw message
apply.c +0 -1
@@ -9,7 +9,6 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "base85.h" #include "config.h" #include "object-store-ll.h"
archive-tar.c +0 -1
@@ -2,7 +2,6 @@* Copyright (c) 2005, 2006 Rene Scharfe */ #include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "gettext.h" #include "git-zlib.h"
archive.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "convert.h" #include "environment.h"
attr.c +0 -1
@@ -7,7 +7,6 @@*/ #include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "exec-cmd.h"
builtin/blame.c +0 -1
@@ -6,7 +6,6 @@*/ #include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "color.h" #include "builtin.h"
builtin/cat-file.c +0 -1
@@ -5,7 +5,6 @@*/ #define USE_THE_INDEX_VARIABLE #include "builtin.h" -#include "alloc.h" #include "config.h" #include "convert.h" #include "diff.h"
builtin/checkout--worker.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "config.h" #include "entry.h" #include "gettext.h"
builtin/config.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "color.h" #include "editor.h"
builtin/credential-cache--daemon.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "gettext.h" #include "object-file.h" #include "parse-options.h"
builtin/fetch-pack.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "gettext.h" #include "hex.h" #include "object-file.h"
builtin/fsmonitor--daemon.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
builtin/grep.c +0 -1
@@ -4,7 +4,6 @@* Copyright (c) 2006 Junio C Hamano */ #include "builtin.h" -#include "alloc.h" #include "gettext.h" #include "hex.h" #include "repository.h"
builtin/index-pack.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "config.h" #include "delta.h" #include "environment.h"
builtin/log.c +0 -1
@@ -6,7 +6,6 @@*/ #include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
builtin/merge.c +0 -1
@@ -10,7 +10,6 @@#include "builtin.h" #include "abspath.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "editor.h" #include "environment.h"
builtin/mktree.c +0 -1
@@ -4,7 +4,6 @@* Copyright (c) Junio C Hamano, 2006, 2009 */ #include "builtin.h" -#include "alloc.h" #include "gettext.h" #include "hex.h" #include "quote.h"
builtin/mv.c +0 -1
@@ -7,7 +7,6 @@#include "builtin.h" #include "abspath.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
builtin/name-rev.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
builtin/pack-objects.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
builtin/repack.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "config.h" #include "dir.h" #include "environment.h"
builtin/rev-parse.c +0 -1
@@ -6,7 +6,6 @@#define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "commit.h" #include "environment.h"
builtin/revert.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "builtin.h" #include "parse-options.h"
builtin/rm.c +0 -1
@@ -5,7 +5,6 @@*/ #define USE_THE_INDEX_VARIABLE #include "builtin.h" -#include "alloc.h" #include "advice.h" #include "config.h" #include "lockfile.h"
builtin/submodule--helper.c +0 -1
@@ -1,7 +1,6 @@#define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
bulk-checkin.c +0 -1
@@ -2,7 +2,6 @@* Copyright (c) 2011, Google Inc. */ #include "git-compat-util.h" -#include "alloc.h" #include "bulk-checkin.h" #include "environment.h" #include "gettext.h"
cache-tree.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "hex.h" #include "lockfile.h"
chunk-format.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "chunk-format.h" #include "csum-file.h" #include "gettext.h"
commit-reach.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "commit.h" #include "commit-graph.h" #include "decorate.h"
config.c +0 -1
@@ -8,7 +8,6 @@#include "git-compat-util.h" #include "abspath.h" #include "advice.h" -#include "alloc.h" #include "date.h" #include "branch.h" #include "config.h"
daemon.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "path.h"
delta-islands.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "attr.h" #include "object.h" #include "blob.h"
diff.c +0 -1
@@ -3,7 +3,6 @@*/ #include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "base85.h" #include "config.h" #include "convert.h"
diffcore-rename.c +0 -1
@@ -3,7 +3,6 @@* Copyright (C) 2005 Junio C Hamano */ #include "git-compat-util.h" -#include "alloc.h" #include "diff.h" #include "diffcore.h" #include "object-store-ll.h"
dir-iterator.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "dir.h" #include "iterator.h" #include "dir-iterator.h"
dir.c +0 -1
@@ -7,7 +7,6 @@*/ #include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "convert.h" #include "dir.h"
ewah/bitmap.c +0 -1
@@ -17,7 +17,6 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "git-compat-util.h" -#include "alloc.h" #include "ewok.h" #define EWAH_MASK (x) ((eword_t)1 << (x % BITS_IN_EWORD))
ewah/ewah_bitmap.c +0 -1
@@ -17,7 +17,6 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "git-compat-util.h" -#include "alloc.h" #include "ewok.h" #include "ewok_rlw.h"
fetch-pack.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "repository.h" #include "config.h" #include "date.h"
fmt-merge-msg.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "refs.h"
fsck.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "date.h" #include "dir.h" #include "hex.h"
git-compat-util.h +75 -0
81 lines not on this page · raw message
help.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "builtin.h" #include "exec-cmd.h"
http-backend.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "git-zlib.h"
line-log.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "line-range.h" #include "hex.h" #include "tag.h"
list-objects-filter-options.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "commit.h" #include "config.h" #include "gettext.h"
list-objects-filter.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "dir.h" #include "gettext.h" #include "hex.h"
midx.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "csum-file.h" #include "dir.h"
object-file.c +0 -1
@@ -8,7 +8,6 @@*/ #include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "convert.h" #include "environment.h"
oid-array.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "oid-array.h" #include "hash-lookup.h"
oidtree.c +0 -1
@@ -4,7 +4,6 @@*/ #include "git-compat-util.h" #include "oidtree.h" -#include "alloc.h" #include "hash.h" struct oidtree_iter_data {
pack-bitmap-write.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
pack-bitmap.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "commit.h" #include "gettext.h" #include "hex.h"
pack-objects.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "object.h" #include "pack.h" #include "pack-objects.h"
packfile.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
parallel-checkout.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "entry.h" #include "gettext.h"
pretty.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "commit.h" #include "environment.h"
prio-queue.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "prio-queue.h" static inline int compare (struct prio_queue *queue,int i,int j)
quote.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "path.h" #include "quote.h" #include "strbuf.h"
read-cache.c +0 -1
@@ -4,7 +4,6 @@* Copyright (C) Linus Torvalds, 2005 */ #include "git-compat-util.h" -#include "alloc.h" #include "bulk-checkin.h" #include "config.h" #include "date.h"
ref-filter.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "gpg-interface.h"
reflog-walk.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "commit.h" #include "refs.h" #include "diff.h"
refs.c +0 -1
@@ -4,7 +4,6 @@#include "git-compat-util.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "hashmap.h"
refspec.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "gettext.h" #include "hash.h" #include "hex.h"
remote-curl.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
remote.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
rerere.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "copy.h" #include "gettext.h"
revision.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
sequencer.c +0 -1
@@ -1,7 +1,6 @@#include "git-compat-util.h" #include "abspath.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "copy.h" #include "environment.h"
server-info.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "dir.h" #include "environment.h" #include "hex.h"
shallow.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "hex.h" #include "repository.h" #include "tempfile.h"
sigchain.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "sigchain.h" #define SIGCHAIN_MAX_SIGNALS 32
sparse-index.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "name-hash.h"
split-index.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "gettext.h" #include "hash.h" #include "mem-pool.h"
strbuf.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "gettext.h" #include "hex.h" #include "strbuf.h"
string-list.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "string-list.h" -#include "alloc.h" void string_list_init_nodup (struct string_list *list) {
strvec.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "strvec.h" -#include "alloc.h" #include "hex.h" #include "strbuf.h"
submodule-config.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "dir.h" #include "environment.h" #include "gettext.h"
submodule.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "repository.h" #include "config.h" #include "submodule-config.h"
t/helper/test-reach.c +0 -1
@@ -1,5 +1,4 @@#include "test-tool.h" -#include "alloc.h" #include "commit.h" #include "commit-reach.h" #include "config.h"
trace2/tr2_tls.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "thread-utils.h" #include "trace.h" #include "trace2/tr2_tls.h"
trailer.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
transport.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "hex.h"
tree-walk.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "tree-walk.h" -#include "alloc.h" #include "dir.h" #include "gettext.h" #include "hex.h"
userdiff.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "userdiff.h" #include "attr.h"
worktree.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "path.h"
Signature · 1 line
2.41.0.255.g8b1d071c50-goog
Re: [PATCH v4 6/6] common: move alloc macros to common.h
Quoted 5 lines · Calvin Wan
alloc_nr,ALLOC_GROW, andALLOC_GROW_BYare commonly used macros for dynamic array allocation. Moving these macros togit-compat-util.hwith the other alloc macros focuses alloc.[ch] to allocation for Git objects and additionally allows us to remove inclusions toalloc.hfrom files that solely used the above macros.
Is this step mistitled? There is no "common.h" in this round.
For that matter, when the series makes a big change like this round, please update the cover letter so that those who are reading it without having seen the prior rounds can understand what the series is about. It will equally help those who have seen prior rounds, too. what is going on. E.g. The cover letter of v1 emphasized why moving many things to common.h was a great thing (and promised to talk about it more in patch 3), but that focus certainly has shifted in this iteration that no longer even creates "common.h", right?
Thanks.
Re: [PATCH v4 6/6] common: move alloc macros to common.h
Quoted 1 line
Is this step mistitled? There is no "
common.h" in this round.
Ahhhh my pre-vacation brain managed to correctly edit the commit message, but not the header
Quoted 8 lines
For that matter, when the series makes a big change like this round, please update the cover letter so that those who are reading it without having seen the prior rounds can understand what the series is about. It will equally help those who have seen prior rounds, too. what is going on. E.g. The cover letter of v1 emphasized why moving many things to
common.hwas a great thing (and promised to talk about it more in patch 3), but that focus certainly has shifted in this iteration that no longer even creates "common.h", right?
That's correct. I'll reroll this series with an updated cover letter and fixed commit header.
Re: [PATCH v4 6/6] common: move alloc macros to common.h
Quoted 14 lines · Calvin Wan
Quoted 1 line
Is this step mistitled? There is no "
common.h" in this round.Ahhhh my pre-vacation brain managed to correctly edit the commit message, but not the header
Quoted 8 lines
For that matter, when the series makes a big change like this round, please update the cover letter so that those who are reading it without having seen the prior rounds can understand what the series is about. It will equally help those who have seen prior rounds, too. what is going on. E.g. The cover letter of v1 emphasized why moving many things to
common.hwas a great thing (and promised to talk about it more in patch 3), but that focus certainly has shifted in this iteration that no longer even creates "common.h", right?
Quoted 2 lines
That's correct. I'll reroll this series with an updated cover letter and fixed commit header.
That will help others, but in the meantime I'll just tweak the commit log message to say "to common.h" -> "to git-compat-util.h"; otherwise the series is ready for 'next', right?
THanks.
Re: [PATCH v4 6/6] common: move alloc macros to common.h
Quoted 3 lines
That will help others, but in the meantime I'll just tweak the commit log message to say "to
common.h" -> "togit-compat-util.h"; otherwise the series is ready for 'next', right?
Correct, I have it as "git-compat-util: move alloc macros to git-compat-util.h". Thanks!
Quoted 5 lines · Calvin Wan
Changes since v3:
- Dropped patches 5 and 6 since removing the circular dependency incommon.hturns out to be quite difficult
- Patch 8 moves the alloc macros togit-compat-util.hrather thancommon.hsince that does not exist anymore
Will queue.
Quoted 3 lines
Note for the maintainer:
I rebased this series onto both seen and next and they rebased cleanly.
Thanks. It is a very indirect way to ensure if the topic is usable, though. What we want is:
* A series of patches that applies cleanly to 'master'. Call the result of applying them $T (topic).
* "git checkout next && git merge $T" should give at most trivial conflicts.
* The same for 'seen'.
If the conflicts with topics in 'seen' are only with topics in the stalled category and/or expecting a reroll category, we may discard the other topic have _their_ reroll worry about adjusting for this topic.
FWIW, I did
(1) tentatively applied these patches to 'next^0', and discarded the result.
(2) applied these patches with "-3" to 'master^0', which saw a bit of conflicts in gpg-interface.c (with cw/strbuf-cleanup topic) and in strbuf.c (again with cw/strbuf-cleanup topic).
(3) to cross check the result, merged (2) into 'next^0' to make sure that it matches (1).
(4) merged (2) into 'seen^0'.
As this round has been rebased to a more recent codebase, even with the conflicts with cw/strbuf-cleanup, (4) indeed merged fairly cleanly, with the same set of conflicts as (3).
Thanks for rebasing the patches.
Hopefully people will be able to review and give feedback to the series this time.
v5 cover git-compat-util cleanups
In reply to Calvin WanOriginally[1], this series intended to move out all non-compat specific headers and macros to either their respective files or common.h. However, moving headers specifically to usage.h and common.h would cause circular header inclusions (i.e usage.h includes git-compat-util.h which includes usage.h) so that the rest of the codebase would not have to also include usage.h and common.h. The tradeoff between simplifying git-compat-util.h versus a confusing inclusion setup was deemed not worthwhile so those patches have been dropped.
The first 4 patches of this series now focuses on cleaning up and reducing the scope of git-compat-util.h by moving headers to their respective files in cases that do not cause circular header inclusions. The rest of series focuses on removing unnecessary headers.
[1] https://lore.kernel.org/git/[email protected]/T/#m4f75ad7065a74659ee0f648b50200330a925481a
Calvin Wan (6):
git-compat-util: move strbuf.c funcs to its header
git-compat-util: move wrapper.c funcs to its header sane-ctype.h: create header for sane-ctype macros
kwset: move translation table from ctype
treewide: remove unnecessary includes for wrapper.h
git-compat-util: move alloc macros to git-compat-util.h
add-patch.c | 1 - alias.c | 1 - alloc.h | 75 -------- apply.c | 2 - archive-tar.c | 1 - archive.c | 1 - attr.c | 1 - builtin/am.c | 1 - builtin/bisect.c | 1 - builtin/blame.c | 1 - builtin/branch.c | 1 - builtin/bugreport.c | 1 - builtin/cat-file.c | 1 - builtin/checkout--worker.c | 1 - builtin/clone.c | 1 - builtin/config.c | 2 - builtin/credential-cache--daemon.c | 1 - builtin/credential-cache.c | 1 - builtin/difftool.c | 1 - builtin/fast-import.c | 1 - builtin/fetch-pack.c | 1 - builtin/fmt-merge-msg.c | 1 - builtin/fsmonitor--daemon.c | 1 - builtin/gc.c | 1 - builtin/get-tar-commit-id.c | 1 - builtin/grep.c | 1 - builtin/index-pack.c | 2 - builtin/init-db.c | 1 - builtin/log.c | 1 - builtin/merge.c | 2 - builtin/mktree.c | 1 - builtin/mv.c | 1 - builtin/name-rev.c | 1 - builtin/pack-objects.c | 2 - builtin/rebase.c | 1 - builtin/receive-pack.c | 1 - builtin/repack.c | 1 - builtin/rerere.c | 1 - builtin/rev-parse.c | 1 - builtin/revert.c | 1 - builtin/rm.c | 1 - builtin/submodule--helper.c | 1 - builtin/symbolic-ref.c | 1 + builtin/unpack-file.c | 1 - builtin/unpack-objects.c | 1 + builtin/worktree.c | 1 - bulk-checkin.c | 2 - cache-tree.c | 1 - chunk-format.c | 1 - combine-diff.c | 1 - commit-graph.c | 1 - commit-reach.c | 1 - compat/terminal.c | 1 - config.c | 2 - convert.c | 1 - copy.c | 1 - csum-file.c | 1 - ctype.c | 36 ---- daemon.c | 2 - delta-islands.c | 1 - diff.c | 2 - diffcore-rename.c | 1 - dir-iterator.c | 1 - dir.c | 2 - editor.c | 1 - entry.c | 1 - environment.c | 1 - ewah/bitmap.c | 1 - ewah/ewah_bitmap.c | 1 - fetch-pack.c | 2 - fmt-merge-msg.c | 1 - fsck.c | 1 - git-compat-util.h | 284 ++++++++--------------------- gpg-interface.c | 1 - grep.c | 1 - help.c | 1 - http-backend.c | 2 - imap-send.c | 1 - kwset.c | 36 ++++ kwset.h | 2 + line-log.c | 1 - list-objects-filter-options.c | 1 - list-objects-filter.c | 1 - merge-ll.c | 1 - merge-recursive.c | 1 - midx.c | 1 - notes-merge.c | 1 - object-file.c | 2 - oid-array.c | 1 - oidtree.c | 1 - pack-bitmap-write.c | 1 - pack-bitmap.c | 1 - pack-objects.c | 1 - pack-write.c | 1 - packfile.c | 2 - parallel-checkout.c | 2 - path.c | 1 - pkt-line.c | 1 - pretty.c | 1 - prio-queue.c | 1 - quote.c | 1 - read-cache.c | 2 - rebase-interactive.c | 1 - ref-filter.c | 1 - reflog-walk.c | 1 - refs.c | 2 - refspec.c | 1 - remote-curl.c | 1 - remote.c | 1 - rerere.c | 2 - revision.c | 1 - sane-ctype.h | 66 +++++++ send-pack.c | 1 - sequencer.c | 2 - server-info.c | 2 - setup.c | 1 - shallow.c | 2 - sigchain.c | 1 - sparse-index.c | 1 - split-index.c | 1 - strbuf.c | 2 - strbuf.h | 32 ++++ streaming.c | 1 - string-list.c | 1 - strvec.c | 1 - submodule-config.c | 1 - submodule.c | 1 - t/helper/test-delta.c | 1 - t/helper/test-fsmonitor-client.c | 1 - t/helper/test-reach.c | 1 - t/helper/test-read-cache.c | 1 - tag.c | 1 - tempfile.c | 1 - trace.c | 1 - trace2/tr2_tls.c | 1 - trailer.c | 1 - transport-helper.c | 1 - transport.c | 2 - tree-walk.c | 1 - upload-pack.c | 1 - usage.c | 1 - userdiff.c | 1 - versioncmp.c | 1 + worktree.c | 2 - wrapper.c | 1 - wrapper.h | 111 +++++++++++ write-or-die.c | 1 - 147 files changed, 327 insertions(+), 478 deletions(-) create mode 100644 sane-ctype.h
Range-diff against v4:
-: ---------- > 1: 144284a8f1 git-compat-util: move strbuf.c funcs to its header -: ---------- > 2: 39913c44e8 git-compat-util: move wrapper.c funcs to its header -: ---------- > 3: c495762940 sane-ctype.h: create header for sane-ctype macros -: ---------- > 4: 2750d35e6d kwset: move translation table from ctype -: ---------- > 5: b5fb55d235 treewide: remove unnecessary includes for wrapper.h 1: 140d98111f ! 6: e4d8ad39d0 common: move alloc macros to common.h
@@ Metadata
Author: Calvin Wan <[email protected]>
## Commit message ##
- common: move alloc macros to common.h
+ git-compat-util: move alloc macros to git-compat-util.h
alloc_nr, ALLOC_GROW, and ALLOC_GROW_BY are commonly used macros for dynamic array allocation. Moving these macros to git-compat-util.h with
Signature · 1 line
2.41.0.255.g8b1d071c50-goog
PATCH v5 1/6 git-compat-util: move strbuf.c funcs to its header
While functions like starts_with() probably should not belong in the boundaries of the strbuf library, this commit focuses on first splitting out headers from git-compat-util.h.
--- builtin/symbolic-ref.c | 1 + builtin/unpack-objects.c | 1 + git-compat-util.h | 32 -------------------------------- strbuf.h | 32 ++++++++++++++++++++++++++++++++ versioncmp.c | 1 + 5 files changed, 35 insertions(+), 32 deletions(-)
builtin/symbolic-ref.c +1 -0
@@ -3,6 +3,7 @@#include "gettext.h" #include "refs.h" #include "parse-options.h" +#include "strbuf.h" static const char *const git_symbolic_ref_usage[] = {N_ ("git symbolic-ref [-m <reason>] <name> <ref>" ),
builtin/unpack-objects.c +1 -0
@@ -12,6 +12,7 @@#include "blob.h" #include "commit.h" #include "replace-object.h" +#include "strbuf.h" #include "tag.h" #include "tree.h" #include "tree-walk.h"
git-compat-util.h +0 -32
@@ -679,9 +679,6 @@ void set_warn_routine(report_fn routine);report_fn get_warn_routine (void );void set_die_is_recursing_routine (int (*routine)(void )); -int starts_with (const char *str,const char *prefix); -int istarts_with (const char *str,const char *prefix); -/* * If the string "str" begins with the string found in "prefix", return 1. * The "out" parameter is set to "str + strlen(prefix)" (i.e., to the point in
@@ -710,29 +707,6 @@ static inline int skip_prefix(const char *str, const char *prefix,return 0 ; } -/* -* If the string "str" is the same as the string in "prefix", then the "arg" -* parameter is set to the "def" parameter and 1 is returned. -* If the string "str" begins with the string found in "prefix" and then a -* "=" sign, then the "arg" parameter is set to "str + strlen(prefix) + 1" -* (i.e., to the point in the string right after the prefix and the "=" sign), -* and 1 is returned. -* -* Otherwise, return 0 and leave "arg" untouched. -* -* When we accept both a "--key" and a "--key=<val>" option, this function -* can be used instead of !strcmp(arg, "--key") and then -* skip_prefix(arg, "--key=", &arg) to parse such an option. -*/ -int skip_to_optional_arg_default (const char *str,const char *prefix, -const char **arg,const char *def); - -static inline int skip_to_optional_arg (const char *str,const char *prefix, -const char **arg) -{ -return skip_to_optional_arg_default (str, prefix, arg,"" ); -} -/* * Like skip_prefix, but promises never to read past "len" bytes of the input * buffer, and returns the remaining number of bytes in "out" via "outlen".
@@ -777,12 +751,6 @@ static inline int strip_suffix(const char *str, const char *suffix, size_t *len)return strip_suffix_mem (str, len, suffix); } -static inline int ends_with (const char *str,const char *suffix) -{ -size_t len; -return strip_suffix (str, suffix, &len); -} -#define SWAP (a, b) do { \ void *_swap_a_ptr = &(a); \ void *_swap_b_ptr = &(b); \
strbuf.h +32 -0
@@ -671,4 +671,36 @@ char *xstrvfmt(const char *fmt, va_list ap); __attribute__((format (printf,1 ,2 )))char *xstrfmt (const char *fmt, ...); +int starts_with (const char *str,const char *prefix); +int istarts_with (const char *str,const char *prefix); + +/* +* If the string "str" is the same as the string in "prefix", then the "arg" +* parameter is set to the "def" parameter and 1 is returned. +* If the string "str" begins with the string found in "prefix" and then a +* "=" sign, then the "arg" parameter is set to "str + strlen(prefix) + 1" +* (i.e., to the point in the string right after the prefix and the "=" sign), +* and 1 is returned. +* +* Otherwise, return 0 and leave "arg" untouched. +* +* When we accept both a "--key" and a "--key=<val>" option, this function +* can be used instead of !strcmp(arg, "--key") and then +* skip_prefix(arg, "--key=", &arg) to parse such an option. +*/ +int skip_to_optional_arg_default (const char *str,const char *prefix, +const char **arg,const char *def); + +static inline int skip_to_optional_arg (const char *str,const char *prefix, +const char **arg) +{ +return skip_to_optional_arg_default (str, prefix, arg,"" ); +} + +static inline int ends_with (const char *str,const char *suffix) +{ +size_t len; +return strip_suffix (str, suffix, &len); +} +#endif /* STRBUF_H */
versioncmp.c +1 -0
@@ -1,5 +1,6 @@#include "git-compat-util.h" #include "config.h" +#include "strbuf.h" #include "string-list.h" #include "versioncmp.h"
Signature · 1 line
2.41.0.255.g8b1d071c50-goog
PATCH v5 2/6 git-compat-util: move wrapper.c funcs to its header
In reply to Calvin WanSince the functions in wrapper.c are widely used across the codebase, include it by default in git-compat-util.h. A future patch will remove now unnecessary inclusions of wrapper.h from other files.
--- git-compat-util.h | 112 +--------------------------------------------- wrapper.h | 111 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 111 deletions(-)
git-compat-util.h +1 -111
@@ -627,7 +627,7 @@ static inline int git_has_dir_sep(const char *path)#include "compat/bswap.h" -struct strbuf ; +#include "wrapper.h" /* General helper functions */ NORETURN void usage(const char *err);
@@ -1047,36 +1047,6 @@ static inline int cast_size_t_to_int(size_t a)# define xalloca (size) (xmalloc(size))# define xalloca_free (p) (free(p))#endif -char *xstrdup (const char *str); -void *xmalloc (size_t size); -void *xmallocz (size_t size); -void *xmallocz_gently (size_t size); -void *xmemdupz (const void *data,size_t len); -char *xstrndup (const char *str,size_t len); -void *xrealloc (void *ptr,size_t size); -void *xcalloc (size_t nmemb,size_t size); -void xsetenv (const char *name,const char *value,int overwrite); -void *xmmap (void *start,size_t length,int prot,int flags,int fd,off_t offset); -const char *mmap_os_err (void ); -void *xmmap_gently (void *start,size_t length,int prot,int flags,int fd,off_t offset); -int xopen (const char *path,int flags, ...); -ssize_t xread (int fd,void *buf,size_t len); -ssize_t xwrite (int fd,const void *buf,size_t len); -ssize_t xpread (int fd,void *buf,size_t len,off_t offset); -int xdup (int fd); -FILE *xfopen (const char *path,const char *mode); -FILE *xfdopen (int fd,const char *mode); -int xmkstemp (char *temp_filename); -int xmkstemp_mode (char *temp_filename,int mode); -char *xgetcwd (void ); -FILE *fopen_for_writing (const char *path); -FILE *fopen_or_warn (const char *path,const char *mode); - -/* -* Like strncmp, but only return zero if s is NUL-terminated and exactly len -* characters long. If it is not, consider it greater than t. -*/ -int xstrncmpz (const char *s,const char *t,size_t len);/* * FREE_AND_NULL(ptr) is like free(ptr) followed by ptr = NULL. Note
@@ -1178,15 +1148,10 @@ static inline size_t xsize_t(off_t len)return (size_t ) len; } -__attribute__((format (printf,3 ,4 ))) -int xsnprintf (char *dst,size_t max,const char *fmt, ...); -#ifndef HOST_NAME_MAX #define HOST_NAME_MAX 256#endif -int xgethostname (char *buf,size_t len); -/* in ctype.c, for kwset users */ extern const unsigned char tolower_trans_tbl[256 ];
@@ -1427,72 +1392,6 @@ void bug_fl(const char *file, int line, const char *fmt, ...);#endif #endif -enum fsync_action { -FSYNC_WRITEOUT_ONLY , -FSYNC_HARDWARE_FLUSH -}; - -/* -* Issues an fsync against the specified file according to the specified mode. -* -* FSYNC_WRITEOUT_ONLY attempts to use interfaces available on some operating -* systems to flush the OS cache without issuing a flush command to the storage -* controller. If those interfaces are unavailable, the function fails with -* ENOSYS. -* -* FSYNC_HARDWARE_FLUSH does an OS writeout and hardware flush to ensure that -* changes are durable. It is not expected to fail. -*/ -int git_fsync (int fd,enum fsync_action action); - -/* -* Writes out trace statistics for fsync using the trace2 API. -*/ -void trace_git_fsync_stats (void ); - -/* -* Preserves errno, prints a message, but gives no warning for ENOENT. -* Returns 0 on success, which includes trying to unlink an object that does -* not exist. -*/ -int unlink_or_warn (const char *path); -/* -* Tries to unlink file. Returns 0 if unlink succeeded -* or the file already didn't exist. Returns -1 and -* appends a message to err suitable for -* 'error("%s", err->buf)' on error. -*/ -int unlink_or_msg (const char *file,struct strbuf *err); -/* -* Preserves errno, prints a message, but gives no warning for ENOENT. -* Returns 0 on success, which includes trying to remove a directory that does -* not exist. -*/ -int rmdir_or_warn (const char *path); -/* -* Calls the correct function out of {unlink,rmdir}_or_warn based on -* the supplied file mode. -*/ -int remove_or_warn (unsigned int mode,const char *path); - -/* -* Call access(2), but warn for any error except "missing file" -* (ENOENT or ENOTDIR). -*/ -#define ACCESS_EACCES_OK (1U << 0) -int access_or_warn (const char *path,int mode,unsigned flag); -int access_or_die (const char *path,int mode,unsigned flag); - -/* Warn on an inaccessible file if errno indicates this is an error */ -int warn_on_fopen_errors (const char *path); - -/* -* Open with O_NOFOLLOW, or equivalent. Note that the fallback equivalent -* may be racy. Do not use this as protection against an attacker who can -* simultaneously create paths. -*/ -int open_nofollow (const char *path,int flags); -#ifndef SHELL_PATH # define SHELL_PATH "/bin/sh"#endif
@@ -1632,13 +1531,4 @@ static inline void *container_of_or_null_offset(void *ptr, size_t offset) ((uintptr_t)&(ptr)->member - (uintptr_t)(ptr))#endif /* !__GNUC__ */ -void sleep_millisec (int millisec); - -/* -* Generate len bytes from the system cryptographically secure PRNG. -* Returns 0 on success and -1 on error, setting errno. The inability to -* satisfy the full request is an error. -*/ -int csprng_bytes (void *buf,size_t len); -#endif
wrapper.h +111 -0
121 lines not on this page · raw message
Signature · 1 line
2.41.0.255.g8b1d071c50-goog
PATCH v5 3/6 sane-ctype.h: create header for sane-ctype macros
In reply to Calvin WanSplitting these macros from git-compat-util.h cleans up the file and allows future third-party sources to not use these overrides if they do not wish to.
--- git-compat-util.h | 62 +------------------------------------------- sane-ctype.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 61 deletions(-) create mode 100644 sane-ctype.h
git-compat-util.h +1 -61
@@ -1155,67 +1155,7 @@ static inline size_t xsize_t(off_t len)/* in ctype.c, for kwset users */ extern const unsigned char tolower_trans_tbl[256 ]; -/* Sane ctype - no locale, and works with signed chars */ -#undef isascii -#undef isspace -#undef isdigit -#undef isalpha -#undef isalnum -#undef isprint -#undef islower -#undef isupper -#undef tolower -#undef toupper -#undef iscntrl -#undef ispunct -#undef isxdigit - -extern const unsigned char sane_ctype[256 ]; -extern const signed char hexval_table[256 ]; -#define GIT_SPACE 0x01 -#define GIT_DIGIT 0x02 -#define GIT_ALPHA 0x04 -#define GIT_GLOB_SPECIAL 0x08 -#define GIT_REGEX_SPECIAL 0x10 -#define GIT_PATHSPEC_MAGIC 0x20 -#define GIT_CNTRL 0x40 -#define GIT_PUNCT 0x80 -#define sane_istest (x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0) -#define isascii (x) (((x) & ~0x7f) == 0) -#define isspace (x) sane_istest(x,GIT_SPACE) -#define isdigit (x) sane_istest(x,GIT_DIGIT) -#define isalpha (x) sane_istest(x,GIT_ALPHA) -#define isalnum (x) sane_istest(x,GIT_ALPHA | GIT_DIGIT) -#define isprint (x) ((x) >= 0x20 && (x) <= 0x7e) -#define islower (x) sane_iscase(x, 1) -#define isupper (x) sane_iscase(x, 0) -#define is_glob_special (x) sane_istest(x,GIT_GLOB_SPECIAL) -#define is_regex_special (x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL) -#define iscntrl (x) (sane_istest(x,GIT_CNTRL)) -#define ispunct (x) sane_istest(x, GIT_PUNCT | GIT_REGEX_SPECIAL | \ - GIT_GLOB_SPECIAL | GIT_PATHSPEC_MAGIC) -#define isxdigit (x) (hexval_table[(unsigned char)(x)] != -1) -#define tolower (x) sane_case((unsigned char)(x), 0x20) -#define toupper (x) sane_case((unsigned char)(x), 0) -#define is_pathspec_magic (x) sane_istest(x,GIT_PATHSPEC_MAGIC) - -static inline int sane_case (int x,int high) -{ -if (sane_istest (x,GIT_ALPHA )) - x = (x & ~0x20 ) | high; -return x; -} - -static inline int sane_iscase (int x,int is_lower) -{ -if (!sane_istest (x,GIT_ALPHA )) -return 0 ; - -if (is_lower) -return (x &0x20 ) !=0 ; -else -return (x &0x20 ) ==0 ; -} +#include "sane-ctype.h" /* * Like skip_prefix, but compare case-insensitively. Note that the comparison
sane-ctype.h new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.41.0.255.g8b1d071c50-goog
PATCH v5 4/6 kwset: move translation table from ctype
In reply to Calvin WanThis table was originally introduced to solely be used with kwset machinery (0f871cf56e), so it would make sense for it to belong in kwset.[ch] rather than ctype.c and git-compat-util.h. It is only used in diffcore-pickaxe.c, which already includes kwset.h so no other headers have to be modified.
--- ctype.c | 36 ------------------------------------ git-compat-util.h | 3 --- kwset.c | 36 ++++++++++++++++++++++++++++++++++++ kwset.h | 2 ++ 4 files changed, 38 insertions(+), 39 deletions(-)
ctype.c +0 -36
@@ -28,39 +28,3 @@ const unsigned char sane_ctype[256] = { A, A, A, A, A, A, A, A, A, A, A, R, R, U, P, X, /* 112..127 */ /* Nothing in the 128.. range */ }; - -/* For case-insensitive kwset */ -const unsigned char tolower_trans_tbl[256 ] = { -0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x06 ,0x07 , -0x08 ,0x09 ,0x0a ,0x0b ,0x0c ,0x0d ,0x0e ,0x0f , -0x10 ,0x11 ,0x12 ,0x13 ,0x14 ,0x15 ,0x16 ,0x17 , -0x18 ,0x19 ,0x1a ,0x1b ,0x1c ,0x1d ,0x1e ,0x1f , -' ' ,'!' ,'"' ,'#' ,'$' ,'%' ,'&' ,0x27 , -'(' ,')' ,'*' ,'+' ,',' ,'-' ,'.' ,'/' , -'0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' , -'8' ,'9' ,':' ,';' ,'<' ,'=' ,'>' ,'?' , -'@' ,'a' ,'b' ,'c' ,'d' ,'e' ,'f' ,'g' , -'h' ,'i' ,'j' ,'k' ,'l' ,'m' ,'n' ,'o' , -'p' ,'q' ,'r' ,'s' ,'t' ,'u' ,'v' ,'w' , -'x' ,'y' ,'z' ,'[' ,0x5c ,']' ,'^' ,'_' , -'`' ,'a' ,'b' ,'c' ,'d' ,'e' ,'f' ,'g' , -'h' ,'i' ,'j' ,'k' ,'l' ,'m' ,'n' ,'o' , -'p' ,'q' ,'r' ,'s' ,'t' ,'u' ,'v' ,'w' , -'x' ,'y' ,'z' ,'{' ,'|' ,'}' ,'~' ,0x7f , -0x80 ,0x81 ,0x82 ,0x83 ,0x84 ,0x85 ,0x86 ,0x87 , -0x88 ,0x89 ,0x8a ,0x8b ,0x8c ,0x8d ,0x8e ,0x8f , -0x90 ,0x91 ,0x92 ,0x93 ,0x94 ,0x95 ,0x96 ,0x97 , -0x98 ,0x99 ,0x9a ,0x9b ,0x9c ,0x9d ,0x9e ,0x9f , -0xa0 ,0xa1 ,0xa2 ,0xa3 ,0xa4 ,0xa5 ,0xa6 ,0xa7 , -0xa8 ,0xa9 ,0xaa ,0xab ,0xac ,0xad ,0xae ,0xaf , -0xb0 ,0xb1 ,0xb2 ,0xb3 ,0xb4 ,0xb5 ,0xb6 ,0xb7 , -0xb8 ,0xb9 ,0xba ,0xbb ,0xbc ,0xbd ,0xbe ,0xbf , -0xc0 ,0xc1 ,0xc2 ,0xc3 ,0xc4 ,0xc5 ,0xc6 ,0xc7 , -0xc8 ,0xc9 ,0xca ,0xcb ,0xcc ,0xcd ,0xce ,0xcf , -0xd0 ,0xd1 ,0xd2 ,0xd3 ,0xd4 ,0xd5 ,0xd6 ,0xd7 , -0xd8 ,0xd9 ,0xda ,0xdb ,0xdc ,0xdd ,0xde ,0xdf , -0xe0 ,0xe1 ,0xe2 ,0xe3 ,0xe4 ,0xe5 ,0xe6 ,0xe7 , -0xe8 ,0xe9 ,0xea ,0xeb ,0xec ,0xed ,0xee ,0xef , -0xf0 ,0xf1 ,0xf2 ,0xf3 ,0xf4 ,0xf5 ,0xf6 ,0xf7 , -0xf8 ,0xf9 ,0xfa ,0xfb ,0xfc ,0xfd ,0xfe ,0xff , -};
git-compat-util.h +0 -3
@@ -1152,9 +1152,6 @@ static inline size_t xsize_t(off_t len)#define HOST_NAME_MAX 256#endif -/* in ctype.c, for kwset users */ -extern const unsigned char tolower_trans_tbl[256 ]; -#include "sane-ctype.h" /*
kwset.c +36 -0
@@ -49,6 +49,42 @@ static void *obstack_chunk_alloc(long size)#define U (c) ((unsigned char) (c)) +/* For case-insensitive kwset */ +const unsigned char tolower_trans_tbl[256 ] = { +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x06 ,0x07 , +0x08 ,0x09 ,0x0a ,0x0b ,0x0c ,0x0d ,0x0e ,0x0f , +0x10 ,0x11 ,0x12 ,0x13 ,0x14 ,0x15 ,0x16 ,0x17 , +0x18 ,0x19 ,0x1a ,0x1b ,0x1c ,0x1d ,0x1e ,0x1f , +' ' ,'!' ,'"' ,'#' ,'$' ,'%' ,'&' ,0x27 , +'(' ,')' ,'*' ,'+' ,',' ,'-' ,'.' ,'/' , +'0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' , +'8' ,'9' ,':' ,';' ,'<' ,'=' ,'>' ,'?' , +'@' ,'a' ,'b' ,'c' ,'d' ,'e' ,'f' ,'g' , +'h' ,'i' ,'j' ,'k' ,'l' ,'m' ,'n' ,'o' , +'p' ,'q' ,'r' ,'s' ,'t' ,'u' ,'v' ,'w' , +'x' ,'y' ,'z' ,'[' ,0x5c ,']' ,'^' ,'_' , +'`' ,'a' ,'b' ,'c' ,'d' ,'e' ,'f' ,'g' , +'h' ,'i' ,'j' ,'k' ,'l' ,'m' ,'n' ,'o' , +'p' ,'q' ,'r' ,'s' ,'t' ,'u' ,'v' ,'w' , +'x' ,'y' ,'z' ,'{' ,'|' ,'}' ,'~' ,0x7f , +0x80 ,0x81 ,0x82 ,0x83 ,0x84 ,0x85 ,0x86 ,0x87 , +0x88 ,0x89 ,0x8a ,0x8b ,0x8c ,0x8d ,0x8e ,0x8f , +0x90 ,0x91 ,0x92 ,0x93 ,0x94 ,0x95 ,0x96 ,0x97 , +0x98 ,0x99 ,0x9a ,0x9b ,0x9c ,0x9d ,0x9e ,0x9f , +0xa0 ,0xa1 ,0xa2 ,0xa3 ,0xa4 ,0xa5 ,0xa6 ,0xa7 , +0xa8 ,0xa9 ,0xaa ,0xab ,0xac ,0xad ,0xae ,0xaf , +0xb0 ,0xb1 ,0xb2 ,0xb3 ,0xb4 ,0xb5 ,0xb6 ,0xb7 , +0xb8 ,0xb9 ,0xba ,0xbb ,0xbc ,0xbd ,0xbe ,0xbf , +0xc0 ,0xc1 ,0xc2 ,0xc3 ,0xc4 ,0xc5 ,0xc6 ,0xc7 , +0xc8 ,0xc9 ,0xca ,0xcb ,0xcc ,0xcd ,0xce ,0xcf , +0xd0 ,0xd1 ,0xd2 ,0xd3 ,0xd4 ,0xd5 ,0xd6 ,0xd7 , +0xd8 ,0xd9 ,0xda ,0xdb ,0xdc ,0xdd ,0xde ,0xdf , +0xe0 ,0xe1 ,0xe2 ,0xe3 ,0xe4 ,0xe5 ,0xe6 ,0xe7 , +0xe8 ,0xe9 ,0xea ,0xeb ,0xec ,0xed ,0xee ,0xef , +0xf0 ,0xf1 ,0xf2 ,0xf3 ,0xf4 ,0xf5 ,0xf6 ,0xf7 , +0xf8 ,0xf9 ,0xfa ,0xfb ,0xfc ,0xfd ,0xfe ,0xff , +}; +/* Balanced tree of edges and labels leaving a given trie node. */ struct tree {
kwset.h +2 -0
@@ -26,6 +26,8 @@The author may be reached (Email) at the address [email protected], or (US mail) as Mike Haertel c/o Free Software Foundation. */ +extern const unsigned char tolower_trans_tbl[256 ]; +struct kwsmatch {int index;/* Index number of matching keyword. */
Signature · 1 line
2.41.0.255.g8b1d071c50-goog
PATCH v5 5/6 treewide: remove unnecessary includes for wrapper.h
In reply to Calvin Wan--- apply.c | 1 - builtin/am.c | 1 - builtin/bisect.c | 1 - builtin/branch.c | 1 - builtin/bugreport.c | 1 - builtin/clone.c | 1 - builtin/config.c | 1 - builtin/credential-cache.c | 1 - builtin/difftool.c | 1 - builtin/fast-import.c | 1 - builtin/fmt-merge-msg.c | 1 - builtin/gc.c | 1 - builtin/get-tar-commit-id.c | 1 - builtin/index-pack.c | 1 - builtin/init-db.c | 1 - builtin/merge.c | 1 - builtin/pack-objects.c | 1 - builtin/rebase.c | 1 - builtin/receive-pack.c | 1 - builtin/rerere.c | 1 - builtin/unpack-file.c | 1 - builtin/worktree.c | 1 - bulk-checkin.c | 1 - combine-diff.c | 1 - commit-graph.c | 1 - compat/terminal.c | 1 - config.c | 1 - convert.c | 1 - copy.c | 1 - csum-file.c | 1 - daemon.c | 1 - diff.c | 1 - dir.c | 1 - editor.c | 1 - entry.c | 1 - environment.c | 1 - fetch-pack.c | 1 - gpg-interface.c | 1 - grep.c | 1 - http-backend.c | 1 - imap-send.c | 1 - merge-ll.c | 1 - merge-recursive.c | 1 - notes-merge.c | 1 - object-file.c | 1 - pack-write.c | 1 - packfile.c | 1 - parallel-checkout.c | 1 - path.c | 1 - pkt-line.c | 1 - read-cache.c | 1 - rebase-interactive.c | 1 - refs.c | 1 - rerere.c | 1 - send-pack.c | 1 - sequencer.c | 1 - server-info.c | 1 - setup.c | 1 - shallow.c | 1 - strbuf.c | 1 - streaming.c | 1 - t/helper/test-delta.c | 1 - t/helper/test-fsmonitor-client.c | 1 - t/helper/test-read-cache.c | 1 - tag.c | 1 - tempfile.c | 1 - trace.c | 1 - transport-helper.c | 1 - transport.c | 1 - upload-pack.c | 1 - usage.c | 1 - worktree.c | 1 - wrapper.c | 1 - write-or-die.c | 1 - 74 files changed, 74 deletions(-)
apply.c +0 -1
@@ -37,7 +37,6 @@#include "symlinks.h" #include "wildmatch.h" #include "ws.h" -#include "wrapper.h" struct gitdiff_data {struct strbuf *root;
builtin/am.c +0 -1
@@ -44,7 +44,6 @@#include "path.h" #include "repository.h" #include "pretty.h" -#include "wrapper.h" /** * Returns the length of the first line of msg.
builtin/bisect.c +0 -1
@@ -15,7 +15,6 @@#include "prompt.h" #include "quote.h" #include "revision.h" -#include "wrapper.h" static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS") static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
builtin/branch.c +0 -1
@@ -28,7 +28,6 @@#include "worktree.h" #include "help.h" #include "commit-reach.h" -#include "wrapper.h" static const char *const builtin_branch_usage[] = {N_ ("git branch [<options>] [-r | -a] [--merged] [--no-merged]" ),
builtin/bugreport.c +0 -1
@@ -11,7 +11,6 @@#include "diagnose.h" #include "object-file.h" #include "setup.h" -#include "wrapper.h" static void get_system_info (struct strbuf *sys_info) {
builtin/clone.c +0 -1
@@ -45,7 +45,6 @@#include "hook.h" #include "bundle.h" #include "bundle-uri.h" -#include "wrapper.h" /* * Overall FIXMEs:
builtin/config.c +0 -1
@@ -15,7 +15,6 @@#include "setup.h" #include "strbuf.h" #include "worktree.h" -#include "wrapper.h" static const char *const builtin_config_usage[] = {N_ ("git config [<options>]" ),
builtin/credential-cache.c +0 -1
@@ -3,7 +3,6 @@#include "parse-options.h" #include "path.h" #include "strbuf.h" -#include "wrapper.h" #include "write-or-die.h" #ifndef NO_UNIX_SOCKETS
builtin/difftool.c +0 -1
@@ -32,7 +32,6 @@#include "dir.h" #include "entry.h" #include "setup.h" -#include "wrapper.h" static int trust_exit_code;
builtin/fast-import.c +0 -1
@@ -26,7 +26,6 @@#include "commit-reach.h" #include "khash.h" #include "date.h" -#include "wrapper.h" #define PACK_ID_BITS 16#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
builtin/fmt-merge-msg.c +0 -1
@@ -3,7 +3,6 @@#include "fmt-merge-msg.h" #include "gettext.h" #include "parse-options.h" -#include "wrapper.h" static const char *const fmt_merge_msg_usage[] = {N_ ("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]" ),
builtin/gc.c +0 -1
@@ -41,7 +41,6 @@#include "hook.h" #include "setup.h" #include "trace2.h" -#include "wrapper.h" #define FAILED_RUN "failed to run %s"
builtin/get-tar-commit-id.c +0 -1
@@ -5,7 +5,6 @@#include "commit.h" #include "tar.h" #include "quote.h" -#include "wrapper.h" static const char builtin_get_tar_commit_id_usage[] ="git get-tar-commit-id" ;
builtin/index-pack.c +0 -1
@@ -25,7 +25,6 @@#include "replace-object.h" #include "promisor-remote.h" #include "setup.h" -#include "wrapper.h" static const char index_pack_usage[] ="git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--[no-]rev-index] [--verify] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])" ;
builtin/init-db.c +0 -1
@@ -13,7 +13,6 @@#include "path.h" #include "setup.h" #include "strbuf.h" -#include "wrapper.h" static int guess_repository_type (const char *git_dir) {
builtin/merge.c +0 -1
@@ -53,7 +53,6 @@#include "commit-reach.h" #include "wt-status.h" #include "commit-graph.h" -#include "wrapper.h" #define DEFAULT_TWOHEAD (1<<0)#define DEFAULT_OCTOPUS (1<<1)
builtin/pack-objects.c +0 -1
@@ -43,7 +43,6 @@#include "promisor-remote.h" #include "pack-mtimes.h" #include "parse-options.h" -#include "wrapper.h" /* * Objects we are going to pack are collected in the `to_pack` structure.
builtin/rebase.c +0 -1
@@ -37,7 +37,6 @@#include "reset.h" #include "trace2.h" #include "hook.h" -#include "wrapper.h" static char const *const builtin_rebase_usage[] = { N_("git rebase [-i] [options] [--exec <cmd>] "
builtin/receive-pack.c +0 -1
@@ -40,7 +40,6 @@#include "worktree.h" #include "shallow.h" #include "parse-options.h" -#include "wrapper.h" static const char *const receive_pack_usage[] = {N_ ("git receive-pack <git-dir>" ),
builtin/rerere.c +0 -1
@@ -6,7 +6,6 @@#include "repository.h" #include "string-list.h" #include "rerere.h" -#include "wrapper.h" #include "xdiff/xdiff.h" #include "xdiff-interface.h" #include "pathspec.h"
builtin/unpack-file.c +0 -1
@@ -3,7 +3,6 @@#include "hex.h" #include "object-name.h" #include "object-store-ll.h" -#include "wrapper.h" static char *create_temp_file (struct object_id *oid) {
builtin/worktree.c +0 -1
@@ -24,7 +24,6 @@#include "submodule.h" #include "utf8.h" #include "worktree.h" -#include "wrapper.h" #include "quote.h" #define BUILTIN_WORKTREE_ADD_USAGE \
bulk-checkin.c +0 -1
@@ -17,7 +17,6 @@#include "packfile.h" #include "object-file.h" #include "object-store-ll.h" -#include "wrapper.h" static int odb_transaction_nesting;
combine-diff.c +0 -1
@@ -17,7 +17,6 @@#include "userdiff.h" #include "oid-array.h" #include "revision.h" -#include "wrapper.h" static int compare_paths (const struct combine_diff_path *one,const struct diff_filespec *two)
commit-graph.c +0 -1
@@ -26,7 +26,6 @@#include "trace2.h" #include "tree.h" #include "chunk-format.h" -#include "wrapper.h" void git_test_write_commit_graph_or_die (void ) {
compat/terminal.c +0 -1
@@ -6,7 +6,6 @@#include "run-command.h" #include "string-list.h" #include "hashmap.h" -#include "wrapper.h" #if defined(HAVE_DEV_TTY ) || defined(GIT_WINDOWS_NATIVE )
config.c +0 -1
@@ -39,7 +39,6 @@#include "wildmatch.h" #include "worktree.h" #include "ws.h" -#include "wrapper.h" #include "write-or-die.h" struct config_source {
convert.c +0 -1
@@ -16,7 +16,6 @@#include "trace.h" #include "utf8.h" #include "merge-ll.h" -#include "wrapper.h" /* * convert.c - convert a file when checking it out and checking it in.
copy.c +0 -1
@@ -1,7 +1,6 @@#include "git-compat-util.h" #include "copy.h" #include "path.h" -#include "wrapper.h" int copy_fd (int ifd,int ofd) {
csum-file.c +0 -1
@@ -11,7 +11,6 @@#include "progress.h" #include "csum-file.h" #include "hash.h" -#include "wrapper.h" static void verify_buffer_or_die(struct hashfile *f, const void *buf,
daemon.c +0 -1
@@ -10,7 +10,6 @@#include "setup.h" #include "strbuf.h" #include "string-list.h" -#include "wrapper.h" #ifdef NO_INITGROUPS #define initgroups (x, y) (0)/* nothing */
diff.c +0 -1
@@ -43,7 +43,6 @@#include "setup.h" #include "strmap.h" #include "ws.h" -#include "wrapper.h" #ifdef NO_FAST_WORKING_DIRECTORY #define FAST_WORKING_DIRECTORY 0
dir.c +0 -1
@@ -32,7 +32,6 @@#include "symlinks.h" #include "trace2.h" #include "tree.h" -#include "wrapper.h" /* * Tells read_directory_recursive how a file or directory should be treated.
editor.c +0 -1
@@ -11,7 +11,6 @@#include "strvec.h" #include "run-command.h" #include "sigchain.h" -#include "wrapper.h" #ifndef DEFAULT_EDITOR #define DEFAULT_EDITOR "vi"
entry.c +0 -1
@@ -14,7 +14,6 @@#include "fsmonitor.h" #include "entry.h" #include "parallel-checkout.h" -#include "wrapper.h" static void create_directories (const char *path,int path_len,const struct checkout *state)
environment.c +0 -1
@@ -28,7 +28,6 @@#include "setup.h" #include "shallow.h" #include "trace.h" -#include "wrapper.h" #include "write-or-die.h" int trust_executable_bit =1 ;
fetch-pack.c +0 -1
@@ -34,7 +34,6 @@#include "commit-graph.h" #include "sigchain.h" #include "mergesort.h" -#include "wrapper.h" static int transfer_unpack_limit =-1 ;static int fetch_unpack_limit =-1 ;
gpg-interface.c +0 -1
@@ -12,7 +12,6 @@#include "sigchain.h" #include "tempfile.h" #include "alias.h" -#include "wrapper.h" #include "environment.h" static int git_gpg_config(const char *, const char *,
grep.c +0 -1
@@ -12,7 +12,6 @@#include "commit.h" #include "quote.h" #include "help.h" -#include "wrapper.h" static int grep_source_load (struct grep_source *gs); static int grep_source_is_binary(struct grep_source *gs,
http-backend.c +0 -1
@@ -19,7 +19,6 @@#include "object-store-ll.h" #include "protocol.h" #include "date.h" -#include "wrapper.h" #include "write-or-die.h" static const char content_type[] ="Content-Type" ;
imap-send.c +0 -1
@@ -30,7 +30,6 @@#include "parse-options.h" #include "setup.h" #include "strbuf.h" -#include "wrapper.h" #if defined(NO_OPENSSL ) && !defined(HAVE_OPENSSL_CSPRNG )typedef void *SSL ;#endif
merge-ll.c +0 -1
@@ -13,7 +13,6 @@#include "merge-ll.h" #include "quote.h" #include "strbuf.h" -#include "wrapper.h" struct ll_merge_driver ;
merge-recursive.c +0 -1
@@ -38,7 +38,6 @@#include "tag.h" #include "tree-walk.h" #include "unpack-trees.h" -#include "wrapper.h" #include "xdiff-interface.h" struct merge_options_internal {
notes-merge.c +0 -1
@@ -20,7 +20,6 @@#include "trace.h" #include "notes-utils.h" #include "commit-reach.h" -#include "wrapper.h" struct notes_merge_pair {struct object_id obj, base, local, remote;
object-file.c +0 -1
@@ -44,7 +44,6 @@#include "setup.h" #include "submodule.h" #include "fsck.h" -#include "wrapper.h" /* The maximum size for an object header. */ #define MAX_HEADER_LEN 32
pack-write.c +0 -1
@@ -12,7 +12,6 @@#include "pack-revindex.h" #include "path.h" #include "strbuf.h" -#include "wrapper.h" void reset_pack_idx_option (struct pack_idx_option *opts) {
packfile.c +0 -1
@@ -24,7 +24,6 @@#include "commit-graph.h" #include "pack-revindex.h" #include "promisor-remote.h" -#include "wrapper.h" char *odb_pack_name(struct strbuf *buf, const unsigned char *hash,
parallel-checkout.c +0 -1
@@ -15,7 +15,6 @@#include "symlinks.h" #include "thread-utils.h" #include "trace2.h" -#include "wrapper.h" struct pc_worker {struct child_process cp;
path.c +0 -1
@@ -18,7 +18,6 @@#include "object-store-ll.h" #include "lockfile.h" #include "exec-cmd.h" -#include "wrapper.h" static int get_st_mode_bits (const char *path,int *mode) {
pkt-line.c +0 -1
@@ -5,7 +5,6 @@#include "hex.h" #include "run-command.h" #include "trace.h" -#include "wrapper.h" #include "write-or-die.h" char packet_buffer[LARGE_PACKET_MAX ];
read-cache.c +0 -1
@@ -46,7 +46,6 @@#include "csum-file.h" #include "promisor-remote.h" #include "hook.h" -#include "wrapper.h" /* Mask for the name length in ce_flags in the on-disk index */
rebase-interactive.c +0 -1
@@ -11,7 +11,6 @@#include "config.h" #include "dir.h" #include "object-name.h" -#include "wrapper.h" static const char edit_todo_list_advice[] = N_("You can fix this with 'git rebase --edit-todo' "
refs.c +0 -1
@@ -30,7 +30,6 @@#include "date.h" #include "commit.h" #include "wildmatch.h" -#include "wrapper.h" /* * List of all available backends
rerere.c +0 -1
@@ -20,7 +20,6 @@#include "object-store-ll.h" #include "hash-lookup.h" #include "strmap.h" -#include "wrapper.h" #define RESOLVED 0#define PUNTED 1
send-pack.c +0 -1
@@ -15,7 +15,6 @@#include "quote.h" #include "transport.h" #include "version.h" -#include "wrapper.h" #include "oid-array.h" #include "gpg-interface.h" #include "shallow.h"
sequencer.c +0 -1
@@ -49,7 +49,6 @@#include "rebase-interactive.h" #include "reset.h" #include "branch.h" -#include "wrapper.h" #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
server-info.c +0 -1
@@ -14,7 +14,6 @@#include "object-store-ll.h" #include "server-info.h" #include "strbuf.h" -#include "wrapper.h" struct update_info_ctx {FILE *cur_fp;
setup.c +0 -1
@@ -17,7 +17,6 @@#include "quote.h" #include "trace2.h" #include "worktree.h" -#include "wrapper.h" static int inside_git_dir =-1 ;static int inside_work_tree =-1 ;
shallow.c +0 -1
@@ -20,7 +20,6 @@#include "shallow.h" #include "statinfo.h" #include "trace.h" -#include "wrapper.h" void set_alternate_shallow_file (struct repository *r,const char *path,int override) {
strbuf.c +0 -1
@@ -6,7 +6,6 @@#include "string-list.h" #include "utf8.h" #include "date.h" -#include "wrapper.h" int starts_with (const char *str,const char *prefix) {
streaming.c +0 -1
@@ -10,7 +10,6 @@#include "object-store-ll.h" #include "replace-object.h" #include "packfile.h" -#include "wrapper.h" typedef int (*open_istream_fn)(struct git_istream *, struct repository *,
t/helper/test-delta.c +0 -1
@@ -11,7 +11,6 @@#include "test-tool.h" #include "git-compat-util.h" #include "delta.h" -#include "wrapper.h" static const char usage_str[] ="test-tool delta (-d|-p) <from_file> <data_file> <out_file>" ;
t/helper/test-fsmonitor-client.c +0 -1
@@ -11,7 +11,6 @@#include "setup.h" #include "thread-utils.h" #include "trace2.h" -#include "wrapper.h" #ifndef HAVE_FSMONITOR_DAEMON_BACKEND int cmd__fsmonitor_client(int argc UNUSED, const char **argv UNUSED)
t/helper/test-read-cache.c +0 -1
@@ -4,7 +4,6 @@#include "read-cache-ll.h" #include "repository.h" #include "setup.h" -#include "wrapper.h" int cmd__read_cache (int argc,const char **argv) {
tag.c +0 -1
@@ -10,7 +10,6 @@#include "gpg-interface.h" #include "hex.h" #include "packfile.h" -#include "wrapper.h" const char *tag_type ="tag" ;
tempfile.c +0 -1
@@ -47,7 +47,6 @@#include "path.h" #include "tempfile.h" #include "sigchain.h" -#include "wrapper.h" static VOLATILE_LIST_HEAD (tempfile_list);
trace.c +0 -1
@@ -27,7 +27,6 @@#include "quote.h" #include "setup.h" #include "trace.h" -#include "wrapper.h" struct trace_key trace_default_key = {"GIT_TRACE" ,0 ,0 ,0 };struct trace_key trace_perf_key =TRACE_KEY_INIT (PERFORMANCE );
transport-helper.c +0 -1
@@ -19,7 +19,6 @@#include "refspec.h" #include "transport-internal.h" #include "protocol.h" -#include "wrapper.h" static int debug;
transport.c +0 -1
@@ -30,7 +30,6 @@#include "object-store-ll.h" #include "color.h" #include "bundle-uri.h" -#include "wrapper.h" static int transport_use_color =-1 ;static char transport_colors[][COLOR_MAXLEN ] = {
upload-pack.c +0 -1
@@ -32,7 +32,6 @@#include "commit-graph.h" #include "commit-reach.h" #include "shallow.h" -#include "wrapper.h" #include "write-or-die.h" /* Remember to update object flag allocation in object.h */
usage.c +0 -1
@@ -6,7 +6,6 @@#include "git-compat-util.h" #include "gettext.h" #include "trace2.h" -#include "wrapper.h" static void vreportf (const char *prefix,const char *err,va_list params) {
worktree.c +0 -1
@@ -12,7 +12,6 @@#include "dir.h" #include "wt-status.h" #include "config.h" -#include "wrapper.h" void free_worktrees (struct worktree **worktrees) {
wrapper.c +0 -1
@@ -9,7 +9,6 @@#include "repository.h" #include "strbuf.h" #include "trace2.h" -#include "wrapper.h" static intmax_t count_fsync_writeout_only;static intmax_t count_fsync_hardware_flush;
write-or-die.c +0 -1
@@ -1,7 +1,6 @@#include "git-compat-util.h" #include "config.h" #include "run-command.h" -#include "wrapper.h" #include "write-or-die.h" /*
Signature · 1 line
2.41.0.255.g8b1d071c50-goog
PATCH v5 6/6 git-compat-util: move alloc macros to git-compat-util.h
In reply to Calvin Wanalloc_nr, ALLOC_GROW, and ALLOC_GROW_BY are commonly used macros for dynamic array allocation. Moving these macros to git-compat-util.h with the other alloc macros focuses alloc.[ch] to allocation for Git objects and additionally allows us to remove inclusions to alloc.h from files that solely used the above macros.
--- add-patch.c | 1 - alias.c | 1 - alloc.h | 75 ------------------------------ apply.c | 1 - archive-tar.c | 1 - archive.c | 1 - attr.c | 1 - builtin/blame.c | 1 - builtin/cat-file.c | 1 - builtin/checkout--worker.c | 1 - builtin/config.c | 1 - builtin/credential-cache--daemon.c | 1 - builtin/fetch-pack.c | 1 - builtin/fsmonitor--daemon.c | 1 - builtin/grep.c | 1 - builtin/index-pack.c | 1 - builtin/log.c | 1 - builtin/merge.c | 1 - builtin/mktree.c | 1 - builtin/mv.c | 1 - builtin/name-rev.c | 1 - builtin/pack-objects.c | 1 - builtin/repack.c | 1 - builtin/rev-parse.c | 1 - builtin/revert.c | 1 - builtin/rm.c | 1 - builtin/submodule--helper.c | 1 - bulk-checkin.c | 1 - cache-tree.c | 1 - chunk-format.c | 1 - commit-reach.c | 1 - config.c | 1 - daemon.c | 1 - delta-islands.c | 1 - diff.c | 1 - diffcore-rename.c | 1 - dir-iterator.c | 1 - dir.c | 1 - ewah/bitmap.c | 1 - ewah/ewah_bitmap.c | 1 - fetch-pack.c | 1 - fmt-merge-msg.c | 1 - fsck.c | 1 - git-compat-util.h | 75 ++++++++++++++++++++++++++++++ help.c | 1 - http-backend.c | 1 - line-log.c | 1 - list-objects-filter-options.c | 1 - list-objects-filter.c | 1 - midx.c | 1 - object-file.c | 1 - oid-array.c | 1 - oidtree.c | 1 - pack-bitmap-write.c | 1 - pack-bitmap.c | 1 - pack-objects.c | 1 - packfile.c | 1 - parallel-checkout.c | 1 - pretty.c | 1 - prio-queue.c | 1 - quote.c | 1 - read-cache.c | 1 - ref-filter.c | 1 - reflog-walk.c | 1 - refs.c | 1 - refspec.c | 1 - remote-curl.c | 1 - remote.c | 1 - rerere.c | 1 - revision.c | 1 - sequencer.c | 1 - server-info.c | 1 - shallow.c | 1 - sigchain.c | 1 - sparse-index.c | 1 - split-index.c | 1 - strbuf.c | 1 - string-list.c | 1 - strvec.c | 1 - submodule-config.c | 1 - submodule.c | 1 - t/helper/test-reach.c | 1 - trace2/tr2_tls.c | 1 - trailer.c | 1 - transport.c | 1 - tree-walk.c | 1 - userdiff.c | 1 - worktree.c | 1 - 88 files changed, 75 insertions(+), 161 deletions(-)
add-patch.c +0 -1
@@ -1,7 +1,6 @@#include "git-compat-util.h" #include "add-interactive.h" #include "advice.h" -#include "alloc.h" #include "editor.h" #include "environment.h" #include "gettext.h"
alias.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "alias.h" -#include "alloc.h" #include "config.h" #include "gettext.h" #include "strbuf.h"
alloc.h +0 -75
79 lines not on this page · raw message
apply.c +0 -1
@@ -9,7 +9,6 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "base85.h" #include "config.h" #include "object-store-ll.h"
archive-tar.c +0 -1
@@ -2,7 +2,6 @@* Copyright (c) 2005, 2006 Rene Scharfe */ #include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "gettext.h" #include "git-zlib.h"
archive.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "convert.h" #include "environment.h"
attr.c +0 -1
@@ -7,7 +7,6 @@*/ #include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "exec-cmd.h"
builtin/blame.c +0 -1
@@ -6,7 +6,6 @@*/ #include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "color.h" #include "builtin.h"
builtin/cat-file.c +0 -1
@@ -5,7 +5,6 @@*/ #define USE_THE_INDEX_VARIABLE #include "builtin.h" -#include "alloc.h" #include "config.h" #include "convert.h" #include "diff.h"
builtin/checkout--worker.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "config.h" #include "entry.h" #include "gettext.h"
builtin/config.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "color.h" #include "editor.h"
builtin/credential-cache--daemon.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "gettext.h" #include "object-file.h" #include "parse-options.h"
builtin/fetch-pack.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "gettext.h" #include "hex.h" #include "object-file.h"
builtin/fsmonitor--daemon.c +0 -1
@@ -1,6 +1,5 @@#include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
builtin/grep.c +0 -1
@@ -4,7 +4,6 @@* Copyright (c) 2006 Junio C Hamano */ #include "builtin.h" -#include "alloc.h" #include "gettext.h" #include "hex.h" #include "repository.h"
builtin/index-pack.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "config.h" #include "delta.h" #include "environment.h"
builtin/log.c +0 -1
@@ -6,7 +6,6 @@*/ #include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
builtin/merge.c +0 -1
@@ -10,7 +10,6 @@#include "builtin.h" #include "abspath.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "editor.h" #include "environment.h"
builtin/mktree.c +0 -1
@@ -4,7 +4,6 @@* Copyright (c) Junio C Hamano, 2006, 2009 */ #include "builtin.h" -#include "alloc.h" #include "gettext.h" #include "hex.h" #include "quote.h"
builtin/mv.c +0 -1
@@ -7,7 +7,6 @@#include "builtin.h" #include "abspath.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
builtin/name-rev.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
builtin/pack-objects.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
builtin/repack.c +0 -1
@@ -1,5 +1,4 @@#include "builtin.h" -#include "alloc.h" #include "config.h" #include "dir.h" #include "environment.h"
builtin/rev-parse.c +0 -1
@@ -6,7 +6,6 @@#define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "commit.h" #include "environment.h"
builtin/revert.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "builtin.h" #include "parse-options.h"
builtin/rm.c +0 -1
@@ -5,7 +5,6 @@*/ #define USE_THE_INDEX_VARIABLE #include "builtin.h" -#include "alloc.h" #include "advice.h" #include "config.h" #include "lockfile.h"
builtin/submodule--helper.c +0 -1
@@ -1,7 +1,6 @@#define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "abspath.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
bulk-checkin.c +0 -1
@@ -2,7 +2,6 @@* Copyright (c) 2011, Google Inc. */ #include "git-compat-util.h" -#include "alloc.h" #include "bulk-checkin.h" #include "environment.h" #include "gettext.h"
cache-tree.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "hex.h" #include "lockfile.h"
chunk-format.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "chunk-format.h" #include "csum-file.h" #include "gettext.h"
commit-reach.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "commit.h" #include "commit-graph.h" #include "decorate.h"
config.c +0 -1
@@ -8,7 +8,6 @@#include "git-compat-util.h" #include "abspath.h" #include "advice.h" -#include "alloc.h" #include "date.h" #include "branch.h" #include "config.h"
daemon.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "path.h"
delta-islands.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "attr.h" #include "object.h" #include "blob.h"
diff.c +0 -1
@@ -3,7 +3,6 @@*/ #include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "base85.h" #include "config.h" #include "convert.h"
diffcore-rename.c +0 -1
@@ -3,7 +3,6 @@* Copyright (C) 2005 Junio C Hamano */ #include "git-compat-util.h" -#include "alloc.h" #include "diff.h" #include "diffcore.h" #include "object-store-ll.h"
dir-iterator.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "dir.h" #include "iterator.h" #include "dir-iterator.h"
dir.c +0 -1
@@ -7,7 +7,6 @@*/ #include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "convert.h" #include "dir.h"
ewah/bitmap.c +0 -1
@@ -17,7 +17,6 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "git-compat-util.h" -#include "alloc.h" #include "ewok.h" #define EWAH_MASK (x) ((eword_t)1 << (x % BITS_IN_EWORD))
ewah/ewah_bitmap.c +0 -1
@@ -17,7 +17,6 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "git-compat-util.h" -#include "alloc.h" #include "ewok.h" #include "ewok_rlw.h"
fetch-pack.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "repository.h" #include "config.h" #include "date.h"
fmt-merge-msg.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "refs.h"
fsck.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "date.h" #include "dir.h" #include "hex.h"
git-compat-util.h +75 -0
81 lines not on this page · raw message
help.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "builtin.h" #include "exec-cmd.h"
http-backend.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "git-zlib.h"
line-log.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "line-range.h" #include "hex.h" #include "tag.h"
list-objects-filter-options.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "commit.h" #include "config.h" #include "gettext.h"
list-objects-filter.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "dir.h" #include "gettext.h" #include "hex.h"
midx.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "csum-file.h" #include "dir.h"
object-file.c +0 -1
@@ -8,7 +8,6 @@*/ #include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "convert.h" #include "environment.h"
oid-array.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "oid-array.h" #include "hash-lookup.h"
oidtree.c +0 -1
@@ -4,7 +4,6 @@*/ #include "git-compat-util.h" #include "oidtree.h" -#include "alloc.h" #include "hash.h" struct oidtree_iter_data {
pack-bitmap-write.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
pack-bitmap.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "commit.h" #include "gettext.h" #include "hex.h"
pack-objects.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "object.h" #include "pack.h" #include "pack-objects.h"
packfile.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "hex.h"
parallel-checkout.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "entry.h" #include "gettext.h"
pretty.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "commit.h" #include "environment.h"
prio-queue.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "prio-queue.h" static inline int compare (struct prio_queue *queue,int i,int j)
quote.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "path.h" #include "quote.h" #include "strbuf.h"
read-cache.c +0 -1
@@ -4,7 +4,6 @@* Copyright (C) Linus Torvalds, 2005 */ #include "git-compat-util.h" -#include "alloc.h" #include "bulk-checkin.h" #include "config.h" #include "date.h"
ref-filter.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "gpg-interface.h"
reflog-walk.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "commit.h" #include "refs.h" #include "diff.h"
refs.c +0 -1
@@ -4,7 +4,6 @@#include "git-compat-util.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "hashmap.h"
refspec.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "gettext.h" #include "hash.h" #include "hex.h"
remote-curl.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
remote.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
rerere.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "config.h" #include "copy.h" #include "gettext.h"
revision.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
sequencer.c +0 -1
@@ -1,7 +1,6 @@#include "git-compat-util.h" #include "abspath.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "copy.h" #include "environment.h"
server-info.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "dir.h" #include "environment.h" #include "hex.h"
shallow.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "hex.h" #include "repository.h" #include "tempfile.h"
sigchain.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "sigchain.h" #define SIGCHAIN_MAX_SIGNALS 32
sparse-index.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "name-hash.h"
split-index.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "gettext.h" #include "hash.h" #include "mem-pool.h"
strbuf.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "gettext.h" #include "hex.h" #include "strbuf.h"
string-list.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "string-list.h" -#include "alloc.h" void string_list_init_nodup (struct string_list *list) {
strvec.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "strvec.h" -#include "alloc.h" #include "hex.h" #include "strbuf.h"
submodule-config.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "dir.h" #include "environment.h" #include "gettext.h"
submodule.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "repository.h" #include "config.h" #include "submodule-config.h"
t/helper/test-reach.c +0 -1
@@ -1,5 +1,4 @@#include "test-tool.h" -#include "alloc.h" #include "commit.h" #include "commit-reach.h" #include "config.h"
trace2/tr2_tls.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "thread-utils.h" #include "trace.h" #include "trace2/tr2_tls.h"
trailer.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "gettext.h"
transport.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "advice.h" -#include "alloc.h" #include "config.h" #include "environment.h" #include "hex.h"
tree-walk.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "tree-walk.h" -#include "alloc.h" #include "dir.h" #include "gettext.h" #include "hex.h"
userdiff.c +0 -1
@@ -1,5 +1,4 @@#include "git-compat-util.h" -#include "alloc.h" #include "config.h" #include "userdiff.h" #include "attr.h"
worktree.c +0 -1
@@ -1,6 +1,5 @@#include "git-compat-util.h" #include "abspath.h" -#include "alloc.h" #include "environment.h" #include "gettext.h" #include "path.h"
Signature · 1 line
2.41.0.255.g8b1d071c50-goog