trees REFACTOR avoid implicit casts in macros available from public headers

C++ compilers do not like implicit cast (connected with void* and
allowed in C), and since the public headers are supposed to be usable
also by C++ code, refactor the code to avoid them.

The change is also connected with the de-duplication of the code, so 3
new generic macros are introduced: LY_ARRAY_NEW, LY_ARRAY_CREATE and
LY_LIST_NEW().
diff --git a/src/tree.h b/src/tree.h
index 6c11534..4b9ca8a 100644
--- a/src/tree.h
+++ b/src/tree.h
@@ -125,7 +125,7 @@
 #define LY_ARRAY_FOR_ITER(ARRAY, TYPE, ITER) \
     for (ITER = ARRAY; \
          (ARRAY) && ((void*)ITER - (void*)ARRAY)/(sizeof(TYPE)) < (*((LY_ARRAY_COUNT_TYPE*)(ARRAY) - 1)); \
-         ITER = (void*)((TYPE*)ITER + 1))
+         ITER = (TYPE*)ITER + 1)
 
 /**
  * @brief Helper macro to go through sized-arrays with a numeric iterator.