scheduling using real slots number
This commit is contained in:
parent
8db4458375
commit
780e9fb313
22 changed files with 980 additions and 105 deletions
|
|
@ -86,6 +86,36 @@ int xlist_iter(xlist_t* l, xlist_iter_fn_t fn, void* data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void* xlist_find(xlist_t* l, xlist_find_fn_t fn, ...)
|
||||
{
|
||||
int i;
|
||||
va_list ap;
|
||||
void* it = NULL;
|
||||
|
||||
if ((l == NULL) || (fn == NULL)) {
|
||||
errno = EINVAL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va_start(ap, fn);
|
||||
for (i = 0; i < l->count; i++) {
|
||||
va_list ap1;
|
||||
int rc;
|
||||
|
||||
va_copy(ap1, ap);
|
||||
rc = fn((void*)l->data[i], ap1);
|
||||
va_end(ap1);
|
||||
|
||||
if (rc) {
|
||||
it = (void*)l->data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return it;
|
||||
}
|
||||
|
||||
void xlist_fini(xlist_t* l)
|
||||
{
|
||||
if (l == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue