* CodingStyle: provide good example
@ 2008-02-04 23:43 Pavel Machek
2008-02-04 23:51 ` Andrew Morton
2008-02-05 0:21 ` Jan Engelhardt
0 siblings, 2 replies; 3+ messages in thread
From: Pavel Machek @ 2008-02-04 23:43 UTC (permalink / raw)
To: Andrew Morton, kernel list
if (!buffer) is actually prefered style, so lets use it in example.
Pavel
Signed-off-by: Pavel Machek <pavel@suse.cz>
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: CodingStyle: provide good example
2008-02-04 23:43 CodingStyle: provide good example Pavel Machek
@ 2008-02-04 23:51 ` Andrew Morton
2008-02-05 0:21 ` Jan Engelhardt
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2008-02-04 23:51 UTC (permalink / raw)
To: Pavel Machek; +Cc: linux-kernel
On Tue, 5 Feb 2008 00:43:43 +0100
Pavel Machek <pavel@ucw.cz> wrote:
> if (!buffer) is actually prefered style, so lets use it in example.
>
> Pavel
>
> Signed-off-by: Pavel Machek <pavel@suse.cz>
>
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: CodingStyle: provide good example
2008-02-04 23:43 CodingStyle: provide good example Pavel Machek
2008-02-04 23:51 ` Andrew Morton
@ 2008-02-05 0:21 ` Jan Engelhardt
1 sibling, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2008-02-05 0:21 UTC (permalink / raw)
To: Pavel Machek; +Cc: Andrew Morton, kernel list
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!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-05 0:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-04 23:43 CodingStyle: provide good example Pavel Machek
2008-02-04 23:51 ` Andrew Morton
2008-02-05 0:21 ` Jan Engelhardt
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.