From: Ben Pfaff Date: Thu, 4 Nov 2010 00:07:33 +0000 (-0700) Subject: CodingStyle: Mention that "free" functions should accept a null pointer. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b93e69830a5606712f1ec0132e250839afbd87c4;p=openvswitch 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. --- diff --git a/CodingStyle b/CodingStyle index bbb492e3..2ee189fa 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