if (!buffer) is actually prefered style, so lets use it in example.
Pavel
Signed-off-by: Pavel Machek <[email protected]>
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 6caa146..9bb2d8a 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -406,7 +415,7 @@ int fun(int a)
int result = 0;
char *buffer = kmalloc(SIZE);
- if (buffer == NULL)
+ if (!buffer)
return -ENOMEM;
if (condition1) {
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Tue, 5 Feb 2008 00:43:43 +0100
Pavel Machek <[email protected]> wrote:
> if (!buffer) is actually prefered style, so lets use it in example.
>
> Pavel
>
> Signed-off-by: Pavel Machek <[email protected]>
>
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> index 6caa146..9bb2d8a 100644
> --- a/Documentation/CodingStyle
> +++ b/Documentation/CodingStyle
> @@ -406,7 +415,7 @@ int fun(int a)
> int result = 0;
> char *buffer = kmalloc(SIZE);
>
> - if (buffer == NULL)
> + if (!buffer)
> return -ENOMEM;
>
> if (condition1) {
I tend to avoid preferring one over the other unless the extra seven
columns is needed to prevent wraparound nasties.
On Feb 5 2008 00:43, Pavel Machek wrote:
>Subject: CodingStyle: provide good example
>
>if (!buffer) is actually prefered style, so lets use it in example.
Just because it is "preferred" by some does not mean it is bad.
I vote for diversity!