fix(3p/cgit): Fix compilation under Clang
Clang treats function-like macros "correctly", in that, per the C11 spec: "Each subsequent instance of the function-like macro name followed by a ( [...] is replaced by the replacement list [...]". Additionally, fprintf is also permitted to be defined as a function-like macro rather than as a true function: "Any function declared in a header may be additionally implemented as a function-like macro defined in the header [...]". The specification then suggests surrounding the name of the function in parens to avoid this, which is the technique we use here to avoid the function-like macro being invoked. The other fix here is to use uintptr_t for some arithmetic, since Git is expecting an int as the value here and not a pointer.
This commit is contained in:
parent
76f4e27386
commit
54b9925b93
2 changed files with 2 additions and 2 deletions
2
third_party/cgit/filter.c
vendored
2
third_party/cgit/filter.c
vendored
|
@ -385,7 +385,7 @@ int cgit_close_filter(struct cgit_filter *filter)
|
|||
|
||||
void cgit_fprintf_filter(struct cgit_filter *filter, FILE *f, const char *prefix)
|
||||
{
|
||||
filter->fprintf(filter, f, prefix);
|
||||
(filter->fprintf)(filter, f, prefix);
|
||||
}
|
||||
|
||||
|
||||
|
|
2
third_party/cgit/parsing.c
vendored
2
third_party/cgit/parsing.c
vendored
|
@ -72,7 +72,7 @@ static void parse_user(const char *t, char **name, char **email, unsigned long *
|
|||
struct ident_split ident;
|
||||
unsigned email_len;
|
||||
|
||||
if (!split_ident_line(&ident, t, strchrnul(t, '\n') - t)) {
|
||||
if (!split_ident_line(&ident, t, (uintptr_t)strchrnul(t, '\n') - (uintptr_t)t)) {
|
||||
*name = substr(ident.name_begin, ident.name_end);
|
||||
|
||||
email_len = ident.mail_end - ident.mail_begin;
|
||||
|
|
Loading…
Reference in a new issue