From: Matthieu Moy Date: Sun, 22 Jun 2008 22:20:13 GMT Subject: Re: Shrink the git binary a bit by avoiding unnecessary inline functions Message-ID: In-Reply-To: Linus Torvalds 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