ARM: dts: kirkwood: gpio-leds fixes for linkstation ls-wvl/vl
[linux/fpc-iii.git] / tools / perf / util / xyarray.c
blobc10ba41ef3f6298eb77e624f7f1b14f41555c36c
1 #include "xyarray.h"
2 #include "util.h"
4 struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size)
6 size_t row_size = ylen * entry_size;
7 struct xyarray *xy = zalloc(sizeof(*xy) + xlen * row_size);
9 if (xy != NULL) {
10 xy->entry_size = entry_size;
11 xy->row_size = row_size;
12 xy->entries = xlen * ylen;
15 return xy;
18 void xyarray__reset(struct xyarray *xy)
20 size_t n = xy->entries * xy->entry_size;
22 memset(xy->contents, 0, n);
25 void xyarray__delete(struct xyarray *xy)
27 free(xy);