grid_utils.h
void resize_grid_cust(CELL_TYPE*** grid, size_t old_r, size_t old_c, size_t new_r, size_t new_c,
    void (*copyfunc)(CELL_TYPE***, CELL_TYPE***, const size_t, const size_t) )
{
    CELL_TYPE** resized = new_grid(new_r, new_c);
    size_t row_copylimit = MIN(old_r, new_r);
    size_t col_copylimit = MIN(old_c, new_c);
    copyfunc(&resized, grid, row_copylimit, col_copylimit);
    free_grid(*grid, old_r);
    *grid = resized;
}
/**
 * Resize a grid with a custom copy function. Useful for when the terminal is resized and/or when
 * a SIGWINCH is caught. A user may wish not to begin copying from the top left of the screen moving
 * left-to-right. For this reason we allow the user to define their own copy routine and pass it to
 * this function as a function pointer.
 * @param grid the grid to be resized
 * @param old_r the current (old) number of rows
 * @param old_c the current (old) number of columns
 * @param new_r the number of rows in the resized grid
 * @param new_c the number of columns in the resized grid
 * @param copyfunc a function pointer to a user-defined function to perform the array copying
 */
Resize a grid with a custom copy function. Useful for when the terminal is resized and/or when
a SIGWINCH is caught. A user may wish not to begin copying from the top left of the screen moving
left-to-right. For this reason we allow the user to define their own copy routine and pass it to
this function as a function pointer.
Resize a grid with a custom copy function . Useful for when the terminal is resized and / or when a SIGWINCH is caught . A user may wish not to begin copying from the top left of the screen moving left - to - right . For this reason we allow the user to define their own copy routine and pass it to this function as a function pointer .
void resize_grid_cust(CELL_TYPE*** grid, size_t old_r, size_t old_c, size_t new_r, size_t new_c,
    void (*copyfunc)(CELL_TYPE***, CELL_TYPE***, const size_t, const size_t) )
{
    CELL_TYPE** resized = new_grid(new_r, new_c);
    size_t row_copylimit = MIN(old_r, new_r);
    size_t col_copylimit = MIN(old_c, new_c);
    copyfunc(&resized, grid, row_copylimit, col_copylimit);
    free_grid(*grid, old_r);
    *grid = resized;
}
void resize_grid_cust ( CELL_TYPE * * * grid , size_t old_r , size_t old_c , size_t new_r , size_t new_c , void ( * copyfunc ) ( CELL_TYPE * * * , CELL_TYPE * * * , const size_t , const size_t ) ) { CELL_TYPE * * resized = new_grid ( new_r , new_c ) ; size_t row_copylimit = MIN ( old_r , new_r ) ; size_t col_copylimit = MIN ( old_c , new_c ) ; copyfunc ( & resized , grid , row_copylimit , col_copylimit ) ; free_grid ( * grid , old_r ) ; * grid = resized ; }
Resize a grid with a custom copy function.
Resize a grid with a custom copy function .