wm: teppich

ref: 0406ab471ab3c21903bd6c331cb75426b9e7fb1c
dir: /libc/lladd.c/

View raw version
#include <u.h>
#include <err.h>
#include <mem.h>

int
lladd(ll_t *last, void *data)
{
	ll_t *temp;

	if(last->next != nil)
		return LL_ERR;

	temp = (ll_t*)malloc(sizeof(ll_t));
	
	temp->val = data;
	temp->next = nil;
	
	last->next = temp;
	return OK;
}