diff mbox series

[06/23] builtin/bisect--helper.c: Fix coding style

Message ID 20220430041406.164719-7-gitter.spiros@gmail.com (mailing list archive)
State New, archived
Headers show
Series add a new coccinelle semantic patch to enforce a | expand

Commit Message

Elia Pinto April 30, 2022, 4:13 a.m. UTC
Adhere to the git coding style which requires "Do not explicitly compute an
integral value with constant 0 or '\ 0', or a pointer value with constant NULL."

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 builtin/bisect--helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian Couder May 3, 2022, 9:54 a.m. UTC | #1
About the commit subject, I think something like the following would be better:

"bisect--helper: fix comparison with NULL"

This way it doesn't use an uppercase for "fix", the area part is
smaller, it's more specific about what the patch is doing.

On Tue, May 3, 2022 at 3:15 AM Elia Pinto <gitter.spiros@gmail.com> wrote:
>
> Adhere to the git coding style which requires "Do not explicitly compute an
> integral value with constant 0 or '\ 0', or a pointer value with constant NULL."

The actual wording is:

"Do not explicitly compare an integral value with constant 0 or '\0',
or a pointer value with constant NULL."

which is a bit different from what you wrote. (It's "compare" not
"compute" and "'\0'" not "'\ 0'".)

The rest looks fine.
diff mbox series

Patch

diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index 8b2b259ff0..e432e1b0ef 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -433,7 +433,7 @@  static int bisect_terms(struct bisect_terms *terms, const char *option)
 	if (get_terms(terms))
 		return error(_("no terms defined"));
 
-	if (option == NULL) {
+	if (!option) {
 		printf(_("Your current terms are %s for the old state\n"
 			 "and %s for the new state.\n"),
 		       terms->term_good, terms->term_bad);