зеркало из https://github.com/microsoft/git.git
contrib/coccinnelle: add equals-null.cocci
Add a coccinelle semantic patch necessary to reinforce the git coding style guideline: "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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
2f0dde7852
Коммит
7a618493fa
|
@ -0,0 +1,30 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
@@
|
||||
expression e;
|
||||
statement s;
|
||||
@@
|
||||
if (
|
||||
(
|
||||
!e
|
||||
|
|
||||
- e == NULL
|
||||
+ !e
|
||||
)
|
||||
)
|
||||
{...}
|
||||
else s
|
||||
|
||||
@@
|
||||
expression e;
|
||||
statement s;
|
||||
@@
|
||||
if (
|
||||
(
|
||||
e
|
||||
|
|
||||
- e != NULL
|
||||
+ e
|
||||
)
|
||||
)
|
||||
{...}
|
||||
else s
|
Загрузка…
Ссылка в новой задаче