Re: Shrink the git binary a bit by avoiding unnecessary inline functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux