bionic: add __system_property_foreach
find_nth() will be inefficient on a trie. Since find_nth() is only used
internally and only for enumerating properties, we can add a foreach()
function to do this directly.
Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit 577418403d)
Change-Id: Iaca97d1182ce2c28863ba85241cbb5cf6185eb2f
This commit is contained in:
committed by
Colin Cross
parent
c656d732c7
commit
c6ff844d75
@@ -159,6 +159,22 @@ cleanup:
|
||||
return result;
|
||||
}
|
||||
|
||||
int __system_property_foreach(
|
||||
void (*propfn)(const prop_info *pi, void *cookie),
|
||||
void *cookie)
|
||||
{
|
||||
prop_area *pa = __system_property_area__;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < pa->count; i++) {
|
||||
unsigned entry = pa->toc[i];
|
||||
prop_info *pi = TOC_TO_INFO(pa, entry);
|
||||
propfn(pi, cookie);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const prop_info *__system_property_find_nth(unsigned n)
|
||||
{
|
||||
prop_area *pa = __system_property_area__;
|
||||
|
||||
Reference in New Issue
Block a user