示例#1
0
文件: set_tab.c 项目: elhmn/fdf
void		set_tab(char ***map, t_fdf *fdf)
{
	int		i;
	int		j;
	int		len;

	i = -1;
	if (fdf)
	{
		if (!fdf->tab)
			if (!(fdf->tab = (t_coord**)malloc(sizeof(t_coord*)
					* (fdf->tab_h))))
				check_errors(MALLOC, "fdf->tab", "set_tab.c");
		while (*(map + ++i))
		{
			if ((len = line_size(*(map + i))) > fdf->tab_w)
				fdf->tab_w = len;
			*(fdf->tab + i) = (t_coord*)malloc(sizeof(t_coord) * (len + 1));
			if (!(fdf->tab + i))
				check_errors(MALLOC, "fdf->tab + i", "set_tab.c");
			j = -1;
			while (*(*(map + i) + ++j))
				fill_coord(fdf, map[i][j], i, j);
			fdf->tab[i][j].end = 0;
		}
	}
}
示例#2
0
文件: scene_bis.c 项目: jazalizil/rt
int		get_coord(char *info, t_v3D **coord, t_materiau *mater)
{
  int		*coor;

  if (!info)
    return (write(2, MALLOC_ERR, 21));
  if (!(coor = parse_it(info, 3)))
    return (write(2, MALLOC_ERR, 21));
  if (!(*coord = fill_coord(coor)))
    return (write(2, MALLOC_ERR, 21));
  free(info);
  return (0);
}