git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] compat: let git_mmap use malloc(3) directly
Date: Mon, 23 Aug 2021 12:15:37 -0400	[thread overview]
Message-ID: <YSPJqc3vVa7ZX63m@coredump.intra.peff.net> (raw)
In-Reply-To: <9c2fe5de-be23-3e66-6edf-3c2edfb804f3@web.de>

On Sat, Aug 21, 2021 at 02:52:40PM +0200, René Scharfe wrote:

> xmalloc() dies on error, allows zero-sized allocations and enforces
> GIT_ALLOC_LIMIT for testing.  Our mmap replacement doesn't need any of
> that.  Let's cut out the wrapper, reject zero-sized requests as required
> by POSIX and use malloc(3) directly.  Allocation errors were needlessly
> handled by git_mmap() before; this code becomes reachable now.

Thanks, this is a good idea. As you note, the function was already
expecting a possible NULL return. And I think in general it's good for
our compat/ wrappers to stay as close to the OS-level functions they're
emulating as possible.

-Peff

  reply	other threads:[~2021-08-23 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21 12:52 [PATCH] compat: let git_mmap use malloc(3) directly René Scharfe
2021-08-23 16:15 ` Jeff King [this message]
2021-08-23 20:27 ` Johannes Schindelin

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YSPJqc3vVa7ZX63m@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=l.s.r@web.de \
    /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.
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 NNTP newsgroup(s).