yin parser OPTIMIZE optimize usage of LY_TREE_FOR* loops
yin parser OPTIMIZE optimize usage of LY_TREE_FOR* loops

It is not always possible, but if we can use LY_TREE_FOR instead of
LY_TREE_FOR_SAFE and postpone lyxml_free_elem() to the superior node,
it is more efficient.

There are also several other code optimization.

PavolVican/libyang,PavolVican/libyang,PavolVican/libyang,lukasmacko/libyang,lukasmacko/libyang,PavolVican/libyang,PavolVican/libyang