From: Edward Thomson <ethomson@edwardthomson.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
phillip.wood@dunelm.org.uk, git@vger.kernel.org,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH v2 1/1] xdiff: provide indirection to git functions
Date: Fri, 25 Feb 2022 18:38:54 +0000 [thread overview]
Message-ID: <20220225183854.GA9@811aa366e12e> (raw)
In-Reply-To: <xmqqo82udctt.fsf@gitster.g>
On Fri, Feb 25, 2022 at 10:24:14AM -0800, Junio C Hamano wrote:
>
> Not so fast. I still do not see a strong reason to support
> xdl_malloc() and other wrappers.
git has an `xmalloc` but no matching `xfree`. libgit2 does not
necessarily use the system allocator (and on Windows, you run into the
question of _which_ system allocator you're using) and therefore has its
own allocation _and_ deallocation functions.
When libgit2 includes xdiff, I don't want to monkey around and try to
redefine `free` to our deallocator.
There are several options that could suffice for this. A different
tactic is to have xdiff call `xfree` which is just defined as `free` in
git. This would feel non-obvious to me as a git developer that in this
one part of the project, I need to use `xfree` instead of `free` on
memory that I have `xmalloc`ed. Using a net new name for allocation
functions may help serve as a reminder that it is a different API.
> Is the expectation for other projects when using the unified code,
> they do not use xdiff/git-xdiff.h and instead add
> xdiff/frotz-xdiff.h that defines xdl_malloc() and friends with the
> infrastructure they provide as part of the Frotz project (and the
> Xyzzy project would do the same with xdiff/xyzzy-xdiff.h header for
> them), making "git" the first among equal other consumers?
No, the thinking is that they would provide their own `git-xdiff.h` that
defines the mappings to their project-specific APIs.
Cheers-
-ed
next prev parent reply other threads:[~2022-02-25 18:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-17 22:52 [PATCH v2 0/1] xdiff: provide indirection to git functions Edward Thomson
2022-02-17 22:54 ` [PATCH v2 1/1] " Edward Thomson
2022-02-22 11:14 ` Phillip Wood
2022-02-25 15:41 ` Johannes Schindelin
2022-02-25 18:24 ` Junio C Hamano
2022-02-25 18:38 ` Edward Thomson [this message]
2022-02-25 18:58 ` Junio C Hamano
2022-02-25 19:03 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220225183854.GA9@811aa366e12e \
--to=ethomson@edwardthomson.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).