Re: [PATCH 3/6] common.h: move non-compat specific macros and functions from git-compat-util.h
From: Calvin Wan <hidden>
Date: 2023-05-17 17:27:27
At some level I am more or less indifferent, in the sense that both compat-util and common need to be included by a .c file anyway, whether it is _our_ source, or in a future third-party source that wants to link with the libified part of Git, so it does notreally make much of a difference if ARRAY_SIZE() is defined in which one of these two headers. But presumably such a future third-party source may arrange their own system support using their own counterpart to compat-util without using ours, and if that is what motivates this change, I could understand why a more-or-less git-agnostic common.h could be a good idea.
Also, a later patch moves ALLOC_GROW and other macros from alloc.h to common.h. I thought it would make more sense to have a common file for these macros to be moved to rather than adding to git-compat-util for the sake of only removing the alloc.h dependency from certain files.
Everything, other than sane-ctype macros, does look like a generally useful git-agnostic helper functions. If we were to move in this direction, I probably would prefer to separate sane-ctype macros in a separate header, simply because they are _designed_ to override system supplied ones and some third-party source may not want to use such a "feature".
Ah that makes sense that they would belong in a separate file like ctype.h -- I can split those macros out.