src/libs/elektra/keyset.c
/**
 * @internal
 * @brief Deeply copies from source to dest.
 *
 * The keyset as well as its containing keys are duplicated.
 * This means that you have to keyDel() the contained keys and
 * ksDel() the returned keyset..
 *
 * the sync status will be as in the original KeySet
 *
 * @param source has to be an initialized source KeySet
 * @return a deep copy of source on success
 * @retval 0 on NULL pointer
 * @see ksNew(), ksDel()
 * @see keyDup() for key duplication
 * @see ksDup() for flat copy
 */
@internal
@brief Deeply copies from source to dest.

The keyset as well as its containing keys are duplicated.
This means that you have to keyDel() the contained keys and
ksDel() the returned keyset

the sync status will be as in the original KeySet


@internal @brief Deeply copies from source to dest . The keyset as well as its containing keys are duplicated . This means that you have to keyDel () the contained keys and ksDel () the returned keyset the sync status will be as in the original KeySet
KeySet * ksDeepDup (const KeySet * source)
{
	if (!source) return 0;
	size_t s = source->size;
	size_t i = 0;
	KeySet * keyset = 0;
	keyset = ksNew (source->alloc, KS_END);
	for (i = 0; i < s; ++i)
	{
		Key * k = source->array[i];
		Key * d = keyDup (k);
		if (!test_bit (k->flags, KEY_FLAG_SYNC))
		{
			keyClearSync (d);
		}
		ksAppendKey (keyset, d);
	}
	return keyset;
}
KeySet * ksDeepDup ( const KeySet * source ) { if ( ! source ) return 0 ; size_t s = source -> size ; size_t i = 0 ; KeySet * keyset = 0 ; keyset = ksNew ( source -> alloc , KS_END ) ; for ( i = 0 ; i < s ; ++ i ) { Key * k = source -> array [ i ] ; Key * d = keyDup ( k ) ; if ( ! test_bit ( k -> flags , KEY_FLAG_SYNC ) ) { keyClearSync ( d ) ; } ksAppendKey ( keyset , d ) ; } return keyset ; }
@internal
 @brief Deeply copies from source to dest.
@internal @brief Deeply copies from source to dest .