shithub: lpa

ref: ad872eeb19b4fcc41a5d34750ca6cdcf88a39795
dir: /util.c/

View raw version
#include <u.h>
#include <libc.h>
#include <thread.h>

#include "dat.h"
#include "fns.h"

Enumeration *
allocenum(uvlong count)
{
	Enumeration *e = alloc(DataEnumeration);
	setroot(e, 1);
	e->count = count;
	e->items = allocextra(e, sizeof(void *) * count);
	return e;
}

void
trim(char *str)
{
	for(int i = strlen(str)-1; i > 0; i--){
		if(str[i] != '\n')
			break;
		else
			str[i] = 0;
	}
}