From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Shrink the git binary a bit by avoiding unnecessary inline functions
Date: Mon, 23 Jun 2008 00:20:13 +0200 [thread overview]
Message-ID: <vpqej6p9ko2.fsf@bauges.imag.fr> (raw)
In-Reply-To: <alpine.LFD.1.10.0806221159140.2926@woody.linux-foundation.org> (Linus Torvalds's message of "Sun\, 22 Jun 2008 12\:19\:25 -0700 \(PDT\)")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> -static inline char* xstrdup(const char *str)
> -{
> - char *ret = strdup(str);
> - if (!ret) {
> - release_pack_memory(strlen(str) + 1, -1);
> - ret = strdup(str);
> - if (!ret)
> - die("Out of memory, strdup failed");
> - }
> - return ret;
> -}
Wouldn't it be better to split that kind of function into two parts:
- inline the short common case
- put the special case apart
like
static inline char* xstrdup(const char *str)
{
char *ret = strdup(str);
if (!ret)
return xstrdup_failed(str);
else
return ret;
}
(with xstrdup_failed not being inline.)
?
--
Matthieu
next prev parent reply other threads:[~2008-06-22 22:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-22 19:19 Shrink the git binary a bit by avoiding unnecessary inline functions Linus Torvalds
2008-06-22 21:32 ` Christian MICHON
2008-06-23 1:01 ` Christian MICHON
2008-06-23 4:54 ` Linus Torvalds
2008-06-23 5:26 ` Christian MICHON
2008-06-22 22:20 ` Matthieu Moy [this message]
2008-06-22 22:40 ` Linus Torvalds
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=vpqej6p9ko2.fsf@bauges.imag.fr \
--to=matthieu.moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/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