mirror of https://github.com/proxmox/mirror_qemu
checkpatch: fix g_malloc check
Use the string equality operator "eq", and ensure that $1 is defined by using "(try|)" instead of "(try)?". The alternative "((?:try)?)" is longer and less readable. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>master
parent
798d8ec0da
commit
dfdb4f3c28
|
@ -2831,8 +2831,8 @@ sub process {
|
||||||
}
|
}
|
||||||
|
|
||||||
# check for pointless casting of g_malloc return
|
# check for pointless casting of g_malloc return
|
||||||
if ($line =~ /\*\s*\)\s*g_(try)?(m|re)alloc(0?)(_n)?\b/) {
|
if ($line =~ /\*\s*\)\s*g_(try|)(m|re)alloc(0?)(_n)?\b/) {
|
||||||
if ($2 == 'm') {
|
if ($2 eq 'm') {
|
||||||
ERROR("unnecessary cast may hide bugs, use g_$1new$3 instead\n" . $herecurr);
|
ERROR("unnecessary cast may hide bugs, use g_$1new$3 instead\n" . $herecurr);
|
||||||
} else {
|
} else {
|
||||||
ERROR("unnecessary cast may hide bugs, use g_$1renew$3 instead\n" . $herecurr);
|
ERROR("unnecessary cast may hide bugs, use g_$1renew$3 instead\n" . $herecurr);
|
||||||
|
|
Loading…
Reference in New Issue