[ovs-dev] [PATCH 1/2] ovsdb-client: Refactor table code to save original json during formatting.

Ben Pfaff blp at nicira.com
Thu Nov 4 00:11:20 UTC 2010


On Wed, Nov 03, 2010 at 04:58:54PM -0700, Ethan Jackson wrote:
> Ah my bad. sounds good then.

You had no way to know, except by guessing.

Here's a proposed addition to CodingStyle to mention it:

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <blp at nicira.com>
Date: Wed, 3 Nov 2010 17:07:33 -0700
Subject: [PATCH] CodingStyle: Mention that "free" functions should accept a null pointer.

I've always written OVS code this way, so this just codifies it so that
others know.
---
 CodingStyle |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/CodingStyle b/CodingStyle
index bbb492e..2ee189f 100644
--- a/CodingStyle
+++ b/CodingStyle
@@ -156,6 +156,12 @@ parameters and their corresponding size parameters should be paired.
         ...
     }
 
+Functions that destroy an instance of a dynamically-allocated type
+should accept and ignore a null pointer argument.  Code that calls
+such a function (including the C standard library function free())
+should omit a null-pointer check.  We find that this usually makes
+code easier to read.
+
 
 FUNCTION PROTOTYPES
 
-- 
1.7.1





More information about the dev mailing list