filter/LoadChain: use IterableSplitString()
This commit is contained in:
		@@ -21,12 +21,10 @@
 | 
				
			|||||||
#include "Factory.hxx"
 | 
					#include "Factory.hxx"
 | 
				
			||||||
#include "Prepared.hxx"
 | 
					#include "Prepared.hxx"
 | 
				
			||||||
#include "plugins/ChainFilterPlugin.hxx"
 | 
					#include "plugins/ChainFilterPlugin.hxx"
 | 
				
			||||||
 | 
					#include "util/IterableSplitString.hxx"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <algorithm>
 | 
					 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
filter_chain_append_new(PreparedFilter &chain, FilterFactory &factory,
 | 
					filter_chain_append_new(PreparedFilter &chain, FilterFactory &factory,
 | 
				
			||||||
			const char *template_name)
 | 
								const char *template_name)
 | 
				
			||||||
@@ -40,18 +38,11 @@ filter_chain_parse(PreparedFilter &chain,
 | 
				
			|||||||
		   FilterFactory &factory,
 | 
							   FilterFactory &factory,
 | 
				
			||||||
		   const char *spec)
 | 
							   const char *spec)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *const end = spec + strlen(spec);
 | 
						for (const std::string_view i : IterableSplitString(spec, ',')) {
 | 
				
			||||||
 | 
							if (i.empty())
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (true) {
 | 
							const std::string name(i);
 | 
				
			||||||
		const char *comma = std::find(spec, end, ',');
 | 
					 | 
				
			||||||
		if (comma > spec) {
 | 
					 | 
				
			||||||
			const std::string name(spec, comma);
 | 
					 | 
				
			||||||
		filter_chain_append_new(chain, factory, name.c_str());
 | 
							filter_chain_append_new(chain, factory, name.c_str());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (comma == end)
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		spec = comma + 1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user