Strlist filter.
[apps/pfixtools.git] / common / array.h
index 6cb7619..f1c6925 100644 (file)
         ssize_t len;                                                           \
         ssize_t size;                                                          \
     }
-#define ARRAY(Type)                                                            \
-    typedef PRIV_ARRAY(Type) Type ## _array_t;                                 \
+
+#define PARRAY(Type)                                                           \
     typedef PRIV_ARRAY(Type*) Type ## _ptr_array_t;                            \
-                                                                               \
-    static inline Type ## _array_t *Type ## _array_new(void)                   \
+    static inline Type ## _ptr_array_t *Type ## _ptr_array_new(void)           \
     {                                                                          \
-        return p_new(Type ## _array_t, 1);                                     \
+        return p_new(Type ## _ptr_array_t, 1);                                 \
     }                                                                          \
                                                                                \
-    static inline void Type ## _array_delete(Type ## _array_t **array)         \
+    static inline void Type ## _ptr_array_delete(Type ## _ptr_array_t **array) \
     {                                                                          \
         if (*array) {                                                          \
             array_wipe(**array);                                               \
             p_delete(array);                                                   \
         }                                                                      \
-    }                                                                          \
+    }
+
+#define ARRAY(Type)                                                            \
+    typedef PRIV_ARRAY(Type) Type ## _array_t;                                 \
                                                                                \
-    static inline Type ## _ptr_array_t *Type ## _ptr_array_new(void)           \
+    static inline Type ## _array_t *Type ## _array_new(void)                   \
     {                                                                          \
-        return p_new(Type ## _ptr_array_t, 1);                                 \
+        return p_new(Type ## _array_t, 1);                                     \
     }                                                                          \
                                                                                \
-    static inline void Type ## _ptr_array_delete(Type ## _ptr_array_t **array) \
+    static inline void Type ## _array_delete(Type ## _array_t **array)         \
     {                                                                          \
         if (*array) {                                                          \
             array_wipe(**array);                                               \
             p_delete(array);                                                   \
         }                                                                      \
-    }
+    }                                                                          \
+                                                                               \
+    PARRAY(Type)
+
 #define A(Type) Type ## _array_t
 #define PA(Type) Type ## _ptr_array_t
 
 
 ARRAY(char)
 ARRAY(int)
+ARRAY(bool)
 ARRAY(uint32_t)
 
 #endif