shithub: gpufs

ref: d128c76aca17cf3b340c48175d8cdfaaeff40657
dir: /names.c/

View raw version
#include <u.h>
#include <libc.h>
#include "names.h"

Name *names = nil;

void
nameadd(uint id, char *name)
{
	Name *n;
	
	n = malloc(sizeof(Name));
	n->name = strdup(name);
	n->id = id;
	n->next = names;
	names = n;
}

char*
namelookup(uint id)
{
	Name *n;
	
	for (n = names; n; n = n->next) {
		if (n->id == id)
			return n->name;
	}
	return nil;
}