All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] coding-style: add rule about checking NULL pointer
@ 2010-11-27 19:38 Lucas De Marchi
  2010-11-27 19:38 ` [PATCH 2/9] drivers: explicitly compare pointers to NULL Lucas De Marchi
                   ` (8 more replies)
  0 siblings, 9 replies; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 19:38 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

---
 doc/coding-style.txt |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/doc/coding-style.txt b/doc/coding-style.txt
index eccdacc..9dfdc09 100644
--- a/doc/coding-style.txt
+++ b/doc/coding-style.txt
@@ -209,6 +209,27 @@ However if the enum comes from an external header file outside ofono
 we cannot make any assumption of how the enum is defined and this
 rule might not apply.
 
+M13: Check for pointer being NULL
+=================================
+
+When checking if a pointer or a return value is NULL, explicitly compare to
+NULL rather than use the shorter check with "!" operator.
+
+Example:
+1)
+array = g_try_new0(int, 20);
+if (!array)	// Wrong
+	return;
+
+2)
+if (!g_at_chat_get_slave(chat))	// Wrong
+	return -EINVAL;
+
+3)
+array = g_try_new0(int, 20);
+if (array == NULL)	// Correct
+	return;
+
 O1: Shorten the name
 ====================
 Better to use abbreviation, rather than full name, to name a variable,
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [PATCH 0/9] coding-style: explicitly compare pointers to NULL
@ 2010-11-27 15:38 Lucas De Marchi
  2010-11-27 15:39 ` [PATCH 6/9] gatchat: " Lucas De Marchi
  0 siblings, 1 reply; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 15:38 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 126 bytes --]

This patch series creates a new coding style rule about checking pointers to
NULL and change the source code accordingly.


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2010-12-08 15:35 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
2010-11-27 19:38 ` [PATCH 2/9] drivers: explicitly compare pointers to NULL Lucas De Marchi
2010-11-29 20:48   ` Denis Kenzior
2010-11-27 19:38 ` [PATCH 3/9] unit: " Lucas De Marchi
2010-11-29 20:49   ` Denis Kenzior
2010-11-27 19:38 ` [PATCH 4/9] gisi: " Lucas De Marchi
2010-11-29 20:49   ` Denis Kenzior
2010-11-27 19:38 ` [PATCH 5/9] examples: " Lucas De Marchi
2010-11-29 20:49   ` Denis Kenzior
2010-11-27 19:39 ` [PATCH 6/9] gatchat: " Lucas De Marchi
2010-11-29 20:50   ` Denis Kenzior
2010-11-27 19:39 ` [PATCH 7/9] gdbus: " Lucas De Marchi
2010-11-29 20:50   ` Denis Kenzior
2010-12-08 15:35   ` Marcel Holtmann
2010-11-27 19:39 ` [PATCH 8/9] plugins: " Lucas De Marchi
2010-11-29 20:51   ` Denis Kenzior
2010-11-27 19:39 ` [PATCH 9/9] core: " Lucas De Marchi
2010-11-29 20:52   ` Denis Kenzior
2010-11-29 17:49 ` [PATCH 1/9] coding-style: add rule about checking NULL pointer Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2010-11-27 15:38 [PATCH 0/9] coding-style: explicitly compare pointers to NULL Lucas De Marchi
2010-11-27 15:39 ` [PATCH 6/9] gatchat: " Lucas De Marchi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.