Quick and dirty malloc() support for realpath.

Mike Frysinger vapier at gentoo.org
Mon Oct 26 12:20:23 UTC 2009


On Sunday 25 October 2009 15:19:49 Rob Landley wrote:
> -	int readlinks = 0;
> +	int readlinks = 0, allocated = 0;
> ...
> +	if (!got_path) {
> +		got_path = alloca(PATH_MAX);
> +		allocated++;
> +	}
> ...
> +	if (allocated) got_path = strdup(got_path);

it doesnt make any sense to treat "allocated" as an integer that gets 
incremented.  you're pointlessly forcing gcc to generate load/update/store 
instructions when it only needs a store instruction.  i.e. use stdbool like 
evolution intended.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20091026/8eda54df/attachment.pgp>


More information about the uClibc mailing list