mtu discovery padding added
FossilOrigin-Name: 391a17b2ab460b54a220c3e128578a37610e71f524b3d127316f201bf4dfd4af
This commit is contained in:
31
src/cw/mlist_append.c
Normal file
31
src/cw/mlist_append.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "mlist.h"
|
||||
|
||||
struct mlistelem *mlist_append(mlist_t l, void *data)
|
||||
{
|
||||
struct mlistelem *e;
|
||||
|
||||
e = malloc(sizeof(struct mlistelem) + l->data_size);
|
||||
|
||||
if (e == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy(mlistelem_dataptr(e), data, l->data_size);
|
||||
|
||||
if (l->first == NULL) {
|
||||
l->first = e;
|
||||
l->last = e;
|
||||
e->prev=NULL;
|
||||
e->next=NULL;
|
||||
l->count++;
|
||||
return e;
|
||||
}
|
||||
|
||||
l->last->next=e;
|
||||
e->prev=l->last;
|
||||
e->next=NULL;
|
||||
l->last=e;
|
||||
l->count++;
|
||||
return e;
|
||||
}
|
Reference in New Issue
Block a user