Re: [PATCH] Clean up compatibility definitions.

From: Junio C Hamano <junkio@cox.net>
Date: 2005-12-06 19:11:57
Alex Riesen <raa.lkml@gmail.com> writes:

> On 12/6/05, Junio C Hamano <junkio@cox.net> wrote:
>> > ... return MAP_FAILED if error, do not
>> > exit process, do no output.
>> Ah, that is what you meant.  I agree.
>
> now, while we agree, how about the patch removing "user interface"
> from gitfakemmap altogether?

> 311da12b7aaca9b7329a07807e1ce4afba4bff77
> diff --git a/compat/mmap.c b/compat/mmap.c
> index 55cb120..32d7a30 100644
> --- a/compat/mmap.c
> +++ b/compat/mmap.c
> @@ -8,15 +8,17 @@ void *gitfakemmap(void *start, size_t le
>  {
>  	int n = 0;
>  
> -	if (start != NULL || !(flags & MAP_PRIVATE))
> -		die("Invalid usage of gitfakemmap.");
> +	if (start != NULL || !(flags & MAP_PRIVATE)) {
> +		errno = ENOTSUP;
> +		return MAP_FAILED;
> +	}

I've considered this one after hearing what you meant by your
previous comment, but I am slightly in favor of keeping this
die(); what would trigger this is a programmer error, and the
extra error message from die() makes it obvious, although I
agree that it is unclean from purist point of view.

On the other hand,

> -	start = xmalloc(length);
> +	start = malloc(length);

This one I'd agree with 100%.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Tue Dec 06 19:12:43 2005

This archive was generated by hypermail 2.1.8 : 2005-12-06 19:12:50 EST