trees REFACTOR get rid of __typeof__ from LY_LIST_INSERT() macro

__typeof__ is (widely used, but) compiler-specific extension, so
implement the functionality without it. Furthermore, also avoid implicit
cast connected with void* which is not welcome by C++ compilers.
diff --git a/src/tree_edit.h b/src/tree_edit.h
index 6233eaf..7c6cea7 100644
--- a/src/tree_edit.h
+++ b/src/tree_edit.h
@@ -225,13 +225,14 @@
  */
 #define LY_LIST_INSERT(LIST, NEW_ITEM, LINKER)\
     if (!(*LIST)) { \
-        *LIST = (__typeof__(*(LIST)))NEW_ITEM; \
+        memcpy(LIST, &(NEW_ITEM), sizeof NEW_ITEM); \
     } else { \
-        do { \
-            __typeof__(*(LIST)) iterator; \
-            for (iterator = *(LIST); iterator->LINKER; iterator = iterator->LINKER) {} \
-            iterator->LINKER = (__typeof__(*(LIST)))NEW_ITEM; \
-        } while (0); \
+        size_t offset__ = (void*)&(*LIST)->LINKER - (void*)(*LIST); \
+        void **iter__ = (void **)((size_t)(*LIST) + offset__); \
+        while (*iter__) { \
+            iter__ = (void **)((size_t)(*iter__) + offset__); \
+        } \
+        memcpy(iter__, &(NEW_ITEM), sizeof NEW_ITEM); \
     }
 
 /**