int get_next_line(int const fd, char **line) { static char *str; char *buf; char *tmp; int ret; buf = ft_strnew(GET_SIZE); while (ft_strchr(buf, '\n') == NULL && (ret = read(fd, buf, GET_SIZE)) > 0) { buf[ret] = '\0'; str = in_read(buf, str); } if (ret == -1) return (-1); if ((tmp = ft_strchr(str, '\n')) != NULL) make_line(line, &str, tmp); else if (ret == 0 && str != NULL && str[0] != '\0') make_end(line, &str); else { free(buf); return (0); } free(buf); return (1); }
//! Get the next fast_discrete_assignment fast_discrete_assignment& operator++() { // Update the discrete_assignments for(size_t i = 0; i < num_vars(); ++i) { if (_asgs[i] < (_vars[i].size() - 1)) { _asgs[i] = (_asgs[i] + 1); _index += _increment_step[i]; return *this; } else { _index -= _asgs[i] * _increment_step[i]; _asgs[i] = 0; } } // Reached end make_end(); return *this; }