mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2025-07-05 23:35:07 +03:00
Memory: restore CloneList() function which was removed in #608
This commit is contained in:
@ -1326,6 +1326,20 @@ QUEUE *NewQueueFast()
|
|||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clone the list
|
||||||
|
LIST *CloneList(LIST *o)
|
||||||
|
{
|
||||||
|
LIST *n = NewList(o->cmp);
|
||||||
|
|
||||||
|
// Memory reallocation
|
||||||
|
Free(n->p);
|
||||||
|
n->p = ToArray(o);
|
||||||
|
n->num_item = n->num_reserved = LIST_NUM(o);
|
||||||
|
n->sorted = o->sorted;
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
// Copy the list to an array
|
// Copy the list to an array
|
||||||
void CopyToArray(LIST *o, void *p)
|
void CopyToArray(LIST *o, void *p)
|
||||||
{
|
{
|
||||||
|
@ -380,6 +380,7 @@ LIST *NewListFast(COMPARE *cmp);
|
|||||||
LIST *NewListEx(COMPARE *cmp, bool fast);
|
LIST *NewListEx(COMPARE *cmp, bool fast);
|
||||||
LIST *NewListEx2(COMPARE *cmp, bool fast, bool fast_malloc);
|
LIST *NewListEx2(COMPARE *cmp, bool fast, bool fast_malloc);
|
||||||
LIST *NewListSingle(void *p);
|
LIST *NewListSingle(void *p);
|
||||||
|
LIST *CloneList(LIST *o);
|
||||||
void CopyToArray(LIST *o, void *p);
|
void CopyToArray(LIST *o, void *p);
|
||||||
void *ToArray(LIST *o);
|
void *ToArray(LIST *o);
|
||||||
void *ToArrayEx(LIST *o, bool fast);
|
void *ToArrayEx(LIST *o, bool fast);
|
||||||
|
Reference in New Issue
Block a user