[PATCH] Improved handling of git syntax names with no git repository

Linus Torvalds torvalds at linux-foundation.org
Fri Mar 14 18:15:13 PDT 2014


On Fri, Mar 14, 2014 at 6:10 PM, Thiago Macieira <thiago at macieira.org> wrote:
> Em sex 14 mar 2014, às 18:00:13, Linus Torvalds escreveu:
>> +#define dummy_git_repository ((git_repository *) 8ul) /* Random bogus
>> pointer, not NULL */
>
> Out of curiosity, why 8?
>
> 8 could technically be a valid pointer, if someone were crazy enough to mmap a
> page at 0x0 (like the old Solaris library lib0 at 0.so).
>
> Values from -3 to 3 are definitely not valid, though.

It's a random value that you'll never really see. But I don't really
care deeply what the random value is, except that it be a small
integer that is cheap to generate for comparisons etc.

And no, no sane OS will have anything in the NULL pointer page. People
used to do it. They don't do it any more. People who used to do it are
morons, since they won't get SIGSEGV on NULL pointers.

But any value in the range -128 to 127 is fine by me (that's the magic
"easy to generate on all halfway sane architectures" numeric range)

          Linus


More information about the subsurface mailing list