Re: [PATCH v4] setup: don't die if realpath(3) fails on getcwd(3)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 25, 2022, 05:11 UTC
- Message-ID
- <xmqq7d6ab3i0.fsf@gitster.g>
- In-Reply-To
- <CABPp-BHZQXt-=XtTk7Ez463rhbcQQBNGUVkbbWiavZT+Rsjn_A@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 16 quoted lines
>> diff --git i/git-compat-util.h w/git-compat-util.h
>> index 58fd813bd0..56c6c48461 100644
>> --- i/git-compat-util.h
>> +++ w/git-compat-util.h
>> @@ -976,7 +976,7 @@ int xstrncmpz(const char *s, const char *t, size_t len);
>> * FREE_AND_NULL(ptr) is like free(ptr) followed by ptr = NULL. Note
>> * that ptr is used twice, so don't pass e.g. ptr++.
>> */
>> -#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
>> +#define FREE_AND_NULL(p) do { free((void*)p); (p) = NULL; } while (0)
>>
>> #define ALLOC_ARRAY(x, alloc) (x) = xmalloc(st_mult(sizeof(*(x)), (alloc)))
>> #define CALLOC_ARRAY(x, alloc) (x) = xcalloc((alloc), sizeof(*(x)))
>
> I also like this change, even if it feels like it should be part of a
> separate patch.Sorry, but I did fail to make it clear that I didn't mean the above to be anything related to Kevin's patch. It was "if FREE_AND_NULL() were defined like this, then we could have used it". I didn't mean to say "let's update FREE_AND_NULL() this way so that we can use it".
Thanks.