mirror of
https://git.proxmox.com/git/libgit2
synced 2025-10-14 21:18:54 +00:00
signature: Fix warnings
Add extra braces to avoid ambiguous if-else. Also, free() doesn't need a check.
This commit is contained in:
parent
a01acc47bb
commit
9f86ec52fa
@ -33,12 +33,8 @@ void git_signature_free(git_signature *sig)
|
|||||||
if (sig == NULL)
|
if (sig == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sig->name)
|
free(sig->name);
|
||||||
free(sig->name);
|
free(sig->email);
|
||||||
|
|
||||||
if (sig->email)
|
|
||||||
free(sig->email);
|
|
||||||
|
|
||||||
free(sig);
|
free(sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,11 +62,12 @@ static int process_trimming(const char *input, char **storage, const char *input
|
|||||||
left = skip_leading_spaces(input, input_end);
|
left = skip_leading_spaces(input, input_end);
|
||||||
right = skip_trailing_spaces(input, input_end - 1);
|
right = skip_trailing_spaces(input, input_end - 1);
|
||||||
|
|
||||||
if (right <= left)
|
if (right <= left) {
|
||||||
if (fail_when_empty)
|
if (fail_when_empty)
|
||||||
return git__throw(GIT_EINVALIDARGS, "Failed to trim. Input is either empty or only contains spaces");
|
return git__throw(GIT_EINVALIDARGS, "Failed to trim. Input is either empty or only contains spaces");
|
||||||
else
|
else
|
||||||
right = left - 1;
|
right = left - 1;
|
||||||
|
}
|
||||||
|
|
||||||
trimmed_input_length = right - left + 1;
|
trimmed_input_length = right - left + 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user