<commit_before>/* <x0/io/CompositeSource.cpp>
 *
 * This file is part of the x0 web server project and is released under LGPL-3.
 * http://www.xzero.ws/
 *
 * (c) 2009-2010 <NAME> <<EMAIL>>
 */

#include <x0/io/CompositeSource.h>
#include <deque>

namespace x0 {

ssize_t CompositeSource::sendto(Sink& sink)
{
	ssize_t result = 0;

	while (!empty()) {
		result = sources_.front()->sendto(sink);
		if (result < 0)
			return result;

		sources_.pop_front();
	}

	return result;
}

} // namespace x0<commit_msg>fixes a little bug in I/O code leaving some source nodes too early<commit_after>/* <x0/io/CompositeSource.cpp>
 *
 * This file is part of the x0 web server project and is released under LGPL-3.
 * http://www.xzero.ws/
 *
 * (c) 2009-2010 <NAME> <<EMAIL>>
 */

#include <x0/io/CompositeSource.h>
#include <deque>

namespace x0 {

ssize_t CompositeSource::sendto(Sink& sink)
{
	ssize_t result = 0;

	while (!empty()) {
		result = sources_.front()->sendto(sink);

		if (result == 0) // empty source
			sources_.pop_front();

		if (result < 0) // error in source
			return result;
	}

	return result;
}

} // namespace x0
{'fraction_non_alphanumeric': 0.152, 'fraction_numerical': 0.029333333333333333, 'mean_word_length': 3.450592885375494, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5078896', 'n_tokens_mistral': 453, 'n_tokens_neox': 416, 'n_words': 115}