![]() |
|
| << Previous | Next >> | |
| | |
long pxnext( Pool_t * p, long e );
Description
- Get the next allocated element in an xmem pool. The pool MUST be set to being a linked pool using
pool_link(p, <non-zero>); otherwise, the results are undefined.
- You can easily iterate through all of the allocated elements of a root pool using the following construct:
long e;
Pool_t * p;for (e = pxfirst(p); e; e = pxnext(p, e)) {
...
}Parameters
- p
- Pool handle structure, as previously passed to
pool_xinit().
- e
- Previous element address, obtained by e.g.
pxfirst(). This must be an allocated element in the given pool, otherwise the results are undefined. Be careful when iterating through a list and deleting elements usingpxfree(): once the element is deleted, is is no longer valid to pass its address to this function. If this parameter is zero, then the result is the same aspxfirst(). This ensures the invariant
pxnext(p, pxprev(p, e)) == e.Return value
0: There are no more elements
!0: Pointer to the next allocated elementLibrary
- POOL.LIB
See Also
- pool_xinit, pool_link, pxalloc, pxfree, pxfirst, pxprev
| Dynamic C Functions | << Previous | Next >> | rabbit.com |