lkml.org 
[lkml]   [2006]   [Dec]   [4]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 04 Dec 2006 21:18:40 +1100
FromNick Piggin <>
SubjectRe: radix-tree.c:__lookup_slot() dead code removal
Frank van Maarseveen wrote:
> Most of the code suggests that it is valid to insert a NULL item,
> possibly a zero item with pointer cast. However, in __lookup_slot()
> whether or not the slot is found seems to depend on the actual value
> of the item in one special case. But further on it doesn't make any
> difference so to remove some dead code:
> 
> --- a/lib/radix-tree.c	2006-12-03 13:23:00.000000000 +0100
> +++ b/lib/radix-tree.c	2006-12-03 17:57:03.000000000 +0100
> @@ -319,9 +319,6 @@ static inline void **__lookup_slot(struc
>  	if (index > radix_tree_maxindex(height))
>  		return NULL;
> 
> -	if (height == 0 && root->rnode)
> -		return (void **)&root->rnode;
> -
>  	shift = (height-1) * RADIX_TREE_MAP_SHIFT;
>  	slot = &root->rnode;

I would say it is not valid to insert a NULL item (because NULL
means an unsuccessful lookup, you may as well just delete the
item).

Also, I don't see how this is dead code anyway. height == 0
radix-trees are a special case and do not have a radix_tree_node
at ->rnode.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-04 10:21    [from the cache]
©2003-2008