bo_legacy->validated = 0;
}
+static void inline clean_handles(struct bo_manager_legacy *bom)
+{
+ while (bom->cfree_handles > 0 &&
+ !bom->free_handles[bom->cfree_handles - 1])
+ bom->cfree_handles--;
+
+}
static int legacy_new_handle(struct bo_manager_legacy *bom, uint32_t *handle)
{
uint32_t tmp;
}
if (bom->cfree_handles > 0) {
tmp = bom->free_handles[--bom->cfree_handles];
- while (!bom->free_handles[bom->cfree_handles - 1]) {
- bom->cfree_handles--;
- if (bom->cfree_handles <= 0) {
- bom->cfree_handles = 0;
- }
- }
+ clean_handles(bom);
} else {
bom->cfree_handles = 0;
tmp = bom->nhandle++;
bom->free_handles[i] = 0;
}
}
- while (!bom->free_handles[bom->cfree_handles - 1]) {
- bom->cfree_handles--;
- if (bom->cfree_handles <= 0) {
- bom->cfree_handles = 0;
- }
- }
+ clean_handles(bom);
return 0;
}
if (bom->cfree_handles < bom->nfree_handles) {