static void load_index(t_object *obj, const char *line) { unsigned int n; if (obj->index_buffer_size >= MAX_INDEX) return ; line = ft_goto_next(line, ' '); n = obj->index_buffer_size * 3; obj->ve_index_buffer_data[n] = ft_uatoi(line) - 1; line = ft_goto_next_digit(line + 1); obj->te_index_buffer_data[n] = ft_uatoi(line) - 1; line = ft_goto_next_digit(line + 1); obj->no_index_buffer_data[n] = ft_uatoi(line) - 1; line = ft_goto_next(line + 1, ' '); obj->ve_index_buffer_data[n + 1] = ft_uatoi(line) - 1; line = ft_goto_next_digit(line + 1); obj->te_index_buffer_data[n + 1] = ft_uatoi(line) - 1; line = ft_goto_next_digit(line + 1); obj->no_index_buffer_data[n + 1] = ft_uatoi(line) - 1; line = ft_goto_next(line + 1, ' '); obj->ve_index_buffer_data[n + 2] = ft_uatoi(line) - 1; line = ft_goto_next_digit(line + 1); obj->te_index_buffer_data[n + 2] = ft_uatoi(line) - 1; line = ft_goto_next_digit(line + 1); obj->no_index_buffer_data[n + 2] = ft_uatoi(line) - 1; ++obj->index_buffer_size; }
int ft_atoi(const char *str) { int negative; negative = 1; if (!str || ((*str < 47 || *str > 58) && *str != '-' && *str != ' ' && *str != '\n' && *str != '\v' && *str != '\t' && *str != '\r' && *str != '\f' && *str != '+')) return (0); while (*str == ' ' || *str == '\n' || *str == '\v' || *str == '\t' || *str == '\r' || *str == '\f' || *str == '+') str++; if (*str == '-') { negative = -1; str++; } if (!str || ((*str < 47 || *str > 58) && *str != '-' && *str != ' ')) return (0); return (ft_uatoi(str) * negative); }