wm: teppich

ref: 3cc6c38f1347e3a9d61f27d28dbafad7fe4cae7b
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 = malloc(sizeof(ll_t*));

	temp->val = data;
	temp->next = nil;

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

	last->next = temp;
	return OK;
}