/* See LICENSE file for copyright and license details. */ #include "common.h" #ifndef TEST RASTER * rtgrpblib_create_raster(size_t width, size_t height) { RASTER *raster; if (!width || !height) { errno = EINVAL; return NULL; } if (width > (SIZE_MAX - offsetof(RASTER, cells)) / sizeof(*raster->cells) / height) goto enomem; raster = calloc(1, offsetof(RASTER, cells) + height * width * sizeof(*raster->cells)); if (!raster) { enomem: errno = ENOMEM; return NULL; } raster->width = width; raster->height = height; raster->draftness = 0.5; return raster; } #else int main(void) { return 0; /* TODO add test */ } #endif