]> git.sesse.net Git - vlc/blobdiff - include/vlc_arrays.h
Fixed vlc_meta_SetXXX macros
[vlc] / include / vlc_arrays.h
index 11a8de8fa6c93baf0196c38c9715a2567361684c..cb3cbecb949c29799f278b7695a9c567ec89b411 100644 (file)
         }                                       \
   } while(0)
 
+#define TAB_INSERT_CAST( cast, count, tab, p, index ) do { \
+    if( (count) > 0 )                           \
+        (tab) = cast realloc( tab, sizeof( void ** ) * ( (count) + 1 ) ); \
+    else                                        \
+        (tab) = cast malloc( sizeof( void ** ) );       \
+    if( (count) - (index) > 0 )                 \
+        memmove( (void**)(tab) + (index) + 1,   \
+                 (void**)(tab) + (index),       \
+                 ((count) - (index)) * sizeof(*(tab)) );\
+    (tab)[(index)] = (p);                       \
+    (count)++;                                  \
+} while(0)
+
+#define TAB_INSERT( count, tab, p, index )      \
+    TAB_INSERT_CAST( , count, tab, p, index )
+
 /**
  * Binary search in a sorted array. The key must be comparable by < and >
  * \param entries array of entries