Skip to content

Commit

Permalink
flex_array: remove unneeded index calculation
Browse files Browse the repository at this point in the history
flex_array_get() calculates an index value, then drops it on the floor;
simply remove it.

Signed-off-by: Jonathan Corbet <[email protected]>
Acked-by: Dave Hansen <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Jonathan Corbet authored and torvalds committed Aug 4, 2009
1 parent a40694a commit 0786820
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/flex_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ void *flex_array_get(struct flex_array *fa, int element_nr)
{
int part_nr = fa_element_to_part_nr(fa, element_nr);
struct flex_array_part *part;
int index;

if (element_nr >= fa->total_nr_elements)
return NULL;
Expand All @@ -264,6 +263,5 @@ void *flex_array_get(struct flex_array *fa, int element_nr)
part = (struct flex_array_part *)&fa->parts[0];
else
part = fa->parts[part_nr];
index = index_inside_part(fa, element_nr);
return &part->elements[index_inside_part(fa, element_nr)];
}

0 comments on commit 0786820

Please sign in to comment.