summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-09-22 17:24:01 +0200
committerThomas Haller <thaller@redhat.com>2021-09-22 17:26:02 +0200
commitb9ff90c87d56455f04637289ebb0763f2b8a0bfd (patch)
tree99aff1a660015e7fe240e3287d8741721802fe86
parent642c160e59b47e10715e6b1ae05f93c37f538075 (diff)
downloadNetworkManager-b9ff90c87d56455f04637289ebb0763f2b8a0bfd.tar.gz
checkpatch: discourage use of g_clear_pointer()
We have nm_clear_pointer() instead, which does not cast the function argument, and thus the compiler is better at checking the arguments.
-rwxr-xr-xcontrib/scripts/checkpatch.pl1
1 files changed, 1 insertions, 0 deletions
diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl
index 6c44946e0e..8ec581b543 100755
--- a/contrib/scripts/checkpatch.pl
+++ b/contrib/scripts/checkpatch.pl
@@ -193,6 +193,7 @@ complain ("Use gs_free_error with GError variables") if $line =~ /\bgs_free\b +G
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 ("Don't use API that uses the numeric source id. Instead, use GSource and API like nm_g_idle_add(), nm_g_idle_add_source(), nm_clear_g_source_inst(), etc.") if $line =~ /\b(g_idle_add|g_idle_add_full|g_timeout_add|g_timeout_add_seconds|g_source_remove|nm_clear_g_source)\b/;
complain ("Prefer g_snprintf() over snprintf() (for consistency)") if $line =~ /\b(snprintf)\b/;
+complain ("Avoid g_clear_pointer() and use nm_clear_pointer() (or nm_clear_g_free(), g_clear_object(), etc.)") if $line =~ /\b(g_clear_pointer)\b/;
#complain ("Use spaces instead of tabs") if $line =~ /\t/;
# Further on we process stuff without comments.