- struct WinMeta * wmeta = malloc(sizeof(struct WinMeta));
- wmeta->screen = screen;
- uint32_t maxy_test = getmaxy(screen);
- uint32_t maxx_test = getmaxx(screen);
- if (maxy_test > UINT16_MAX || maxx_test > UINT16_MAX)
- {
- return 2;
- }
- wmeta->padsize.y = maxy_test;
- wmeta->padsize.x = maxx_test;
- wmeta->chain_start = 0;
- wmeta->chain_end = 0;
- wmeta->pad_offset = 0;
- WINDOW * pad_test = newpad(wmeta->padsize.y, 1);
- if (NULL == pad_test)
- {
- return 1;
- }
- wmeta->pad = pad_test;
- wmeta->active = 0;
- *wmp = wmeta;
- return 0;
+ char * f_name = "init_win_meta()";
+ char * err_s = "init_win_meta() creates virtual screen beyond legal size.";
+ char * err_m = "init_win_meta() triggers memory alloc error via newpad().";
+ world.wmeta = try_malloc(sizeof(struct WinMeta), f_name);
+ world.wmeta->screen = screen;
+ uint32_t maxy_test = getmaxy(screen);
+ uint32_t maxx_test = getmaxx(screen);
+ uint8_t test = (maxy_test > UINT16_MAX || maxx_test > UINT16_MAX);
+ exit_err(test, err_s);
+ world.wmeta->padsize.y = maxy_test;
+ world.wmeta->padsize.x = maxx_test;
+ world.wmeta->chain_start = 0;
+ world.wmeta->chain_end = 0;
+ world.wmeta->pad_offset = 0;
+ world.wmeta->pad = newpad(world.wmeta->padsize.y, 1);
+ exit_err(NULL == world.wmeta->pad, err_m);
+ world.wmeta->active = 0;