mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-03-04 09:04:39 -07:00
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>
This commit is contained in:
parent
798d8ec0da
commit
dfdb4f3c28
1 changed files with 2 additions and 2 deletions
|
|
@ -2831,8 +2831,8 @@ sub process {
|
|||
}
|
||||
|
||||
# check for pointless casting of g_malloc return
|
||||
if ($line =~ /\*\s*\)\s*g_(try)?(m|re)alloc(0?)(_n)?\b/) {
|
||||
if ($2 == 'm') {
|
||||
if ($line =~ /\*\s*\)\s*g_(try|)(m|re)alloc(0?)(_n)?\b/) {
|
||||
if ($2 eq 'm') {
|
||||
ERROR("unnecessary cast may hide bugs, use g_$1new$3 instead\n" . $herecurr);
|
||||
} else {
|
||||
ERROR("unnecessary cast may hide bugs, use g_$1renew$3 instead\n" . $herecurr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue