lkml.org 
[lkml]   [2005]   [Jan]   [9]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
FromArnd Bergmann <>
SubjectRe: [PATCH] futex: s/0/NULL/ in pointer context
DateSun, 9 Jan 2005 15:19:28 +0100
On Sünndag 09 Januar 2005 10:23, Alexey Dobriyan wrote:
> @@ -236,7 +236,7 @@
>   */
>  static inline void get_key_refs(union futex_key *key)
>  {
> -	if (key->both.ptr != 0) {
> +	if (key->both.ptr != NULL) {
>  		if (key->both.offset & 1)
>  			atomic_inc(&key->shared.inode->i_count);
>  		else

Actually, many consider the preferred way to write this

	if (key->both.ptr) {
instead, since the condition you want to check is 'is key->both.ptr
a valid pointer', not 'is key->both.ptr inequal to the invalid
pointer'. The normal use for NULL is only in assignments and 
initializations, not in comparisons.

	Arnd <><
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:09    [from the cache]
©2003-2008