]> git.baikalelectronics.ru Git - kernel.git/commit
flex_array: add flex_array_clear function
authorDavid Rientjes <rientjes@google.com>
Tue, 22 Sep 2009 00:04:30 +0000 (17:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Sep 2009 14:17:47 +0000 (07:17 -0700)
commitaf87b1328537dfaff1967dc8901b0c1f706a618f
tree4a5dd6acac3e73049918c646bd977894335e5560
parent322b356ab1545afa1e57915307c139b244a89d81
flex_array: add flex_array_clear function

Add a new function to the flex_array API:

int flex_array_clear(struct flex_array *fa,
unsigned int element_nr)

This function will zero the element at element_nr in the flex_array.

Although this is equivalent to using flex_array_put() and passing a
pointer to zero'd memory, flex_array_clear() does not require such a
pointer to memory that would most likely need to be allocated on the
caller's stack which could be significantly large depending on
element_size.

Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/flex_array.h
lib/flex_array.c