swh:1:snp:c3bf2749e3476071fa748f67b0ffa2fdc5fe49d9
Raw File
Tip revision: 76e10d158efb6d4516018846f60c2ab5501900bc authored by Linus Torvalds on 20 May 2012, 22:29:13 UTC
Linux 3.4
Tip revision: 76e10d1
xyarray.c
#include "xyarray.h"
#include "util.h"

struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size)
{
	size_t row_size = ylen * entry_size;
	struct xyarray *xy = zalloc(sizeof(*xy) + xlen * row_size);

	if (xy != NULL) {
		xy->entry_size = entry_size;
		xy->row_size   = row_size;
	}

	return xy;
}

void xyarray__delete(struct xyarray *xy)
{
	free(xy);
}
back to top