src/plugins/yajl/iterator.c
/**
 * @brief Go to the previous element
 *
 * @param it the iterator to iterate
 *
 * @return 
 */
@brief Go to the previous element
@param it the iterator to iterate

@return
@brief Go to the previous element @param it the iterator to iterate @return
int elektraKeyNameReverseNext (keyNameReverseIterator * it)
{
	if (it->current == it->rend) 
	{
		return 0;
	}
	const char * real = it->current - 1; 
	int endReached = 0;
	while (*real == KDB_PATH_SEPARATOR)
	{
		--real;
	}
	if (*real == KDB_PATH_ESCAPE)
	{
		++real; 
	}
	const char * currentEnd = real; 
	while (real != it->rend && !endReached)
	{
		--real;
		if (real != it->rend && *real == KDB_PATH_SEPARATOR)
		{
			--real;
			if (*real != KDB_PATH_ESCAPE)
			{
				endReached = 1;
				real += 2; 
			}
		}
	}
	it->size = currentEnd - real + 1;
	it->current = real;
	return 1;
}
int elektraKeyNameReverseNext ( keyNameReverseIterator * it ) { if ( it -> current == it -> rend ) { return 0 ; } const char * real = it -> current - 1 ; int endReached = 0 ; while ( * real == KDB_PATH_SEPARATOR ) { -- real ; } if ( * real == KDB_PATH_ESCAPE ) { ++ real ; } const char * currentEnd = real ; while ( real != it -> rend && ! endReached ) { -- real ; if ( real != it -> rend && * real == KDB_PATH_SEPARATOR ) { -- real ; if ( * real != KDB_PATH_ESCAPE ) { endReached = 1 ; real += 2 ; } } } it -> size = currentEnd - real + 1 ; it -> current = real ; return 1 ; }
@brief Go to the previous element
 @param it the iterator to iterate
@brief Go to the previous element @param it the iterator to iterate
// we are at the end (move that to hasNext?) // start at one position left // skip all repeating '/' in the "beginning" of string // we skipped to much // now we know where the string will end // now see where this basename begins // also handles escaped chars with '\' // only decrement if we have not send the end // fix for lookahead // update iterator and return it