void ft_map(char ***tetro, char **map, int i, int j) { char ***tmp; int count; count = 0; tmp = (char ***)malloc(sizeof(char **) * (j + 1)); tmp[j] = NULL; while (map[count]) count = count + 1; tmp = ft_malloctmp(tmp, count, j); ft_cpy(tmp, tetro, count, j); while (tetro[i] && i >= 0) { if (ft_checkmap(tetro, map, tmp, i)) i = i + 1; else { ft_reload(tmp[i], tetro[i], count); i = i - 1; } } free(tmp); if (i < 0) ft_remap(tetro, map, i, j); else ft_printmap(map, j); }
char *ft_realloc(char *buf, size_t size) { char *ret; int len; if (size == 0) return (buf); else { len = ft_strlen(buf); ret = malloc(len + size + 1); ft_cpy(ret, buf, size + len + 1); free(buf); } return (ret); }