The macro got a little strange, but it's better than using the MEM_mallocN inside a loop, or repeat the lines