add pbuf_appendall
This commit is contained in:
parent
9c9fa59e12
commit
34d88d8ec5
2 changed files with 13 additions and 0 deletions
10
src/pbuf.c
10
src/pbuf.c
|
|
@ -91,6 +91,16 @@ pbuf_append(pbuf_t* pbuf, void* ptr)
|
|||
pbuf->ptr[pbuf->used++] = ptr;
|
||||
}
|
||||
|
||||
void
|
||||
pbuf_appendall(pbuf_t* pbuf, const pbuf_t* tail)
|
||||
{
|
||||
if (!pbuf || !tail || (tail->used == 0))
|
||||
return;
|
||||
pbuf_ensure(pbuf, tail->used);
|
||||
memcpy(pbuf->ptr + pbuf->used, tail->ptr, tail->used * sizeof(void*));
|
||||
pbuf->used += tail->used;
|
||||
}
|
||||
|
||||
void
|
||||
pbuf_sort(pbuf_t* pbuf, pbuf_func_sort_t func)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ pbuf_clear(pbuf_t* pbuf);
|
|||
void
|
||||
pbuf_append(pbuf_t* pbuf, void* ptr);
|
||||
|
||||
void
|
||||
pbuf_appendall(pbuf_t* pbuf, const pbuf_t* tail);
|
||||
|
||||
void
|
||||
pbuf_putat(pbuf_t* pbuf, int ix, void* obj);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue