[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090804133517.58429f31@bike.lwn.net>
Date: Tue, 4 Aug 2009 13:35:17 -0600
From: Jonathan Corbet <corbet@....net>
To: Dave Hansen <dave@...ux.vnet.ibm.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH] flex_array: remove unneeded index calculation
flex_array_get() calculates an index value, then drops it on the floor;
simply remove it.
Signed-off-by: Jonathan Corbet <corbet@....net>
diff --git a/lib/flex_array.c b/lib/flex_array.c
index 0e7894c..08f1636 100644
--- a/lib/flex_array.c
+++ b/lib/flex_array.c
@@ -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;
@@ -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)];
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists