diff options
author | Thomas Haller <thaller@redhat.com> | 2021-04-26 09:51:45 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-04-26 09:53:11 +0200 |
commit | 23a200d19e25fb760a69dd818dad1b780352b8c4 (patch) | |
tree | 4d905361b4a0f4fa75ddf029af5b3db43bdf3faa | |
parent | 4d3de2721d9f1507ef45fc15fbbf92a20ccda421 (diff) | |
download | NetworkManager-23a200d19e25fb760a69dd818dad1b780352b8c4.tar.gz |
checkpatch: warn about uses of strcmp()/g_strcmp0()
Using strcmp()/g_strcmp0() for checking for string equality is hard
to read. We should prefer our streq variants -- unless, you really
mean cmp.
-rwxr-xr-x | contrib/scripts/checkpatch.pl | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl index 805b7075ce..c64f69db9b 100755 --- a/contrib/scripts/checkpatch.pl +++ b/contrib/scripts/checkpatch.pl @@ -190,6 +190,7 @@ complain ("XXX marker are reserved for development while work-in-progress. Use T complain ("This gtk-doc annotation looks wrong") if $line =~ /\*.*\( *(transfer-(none|container|full)|allow none) *\) *(:|\()/; complain ("Prefer nm_assert() or g_return*() to g_assert*()") if $line =~ /g_assert/ and (not $filename =~ /\/tests\//) and (not $filename =~ /\/nm-test-/); complain ("Use gs_free_error with GError variables") if $line =~ /\bgs_free\b +GError *\*/; +complain ("Don't use strcmp/g_strcmp0 unless you need to sort. Consider nm_streq()/nm_streq0(),NM_IN_STRSET() for testing equality") if $line =~ /\b(strcmp|g_strcmp0)\b/; #complain ("Use spaces instead of tabs") if $line =~ /\t/; # Further on we process stuff without comments. |