add single instance mode
[uwplayer.git] / ucx / cx / allocator.h
index cd28934..45f47a9 100644 (file)
@@ -133,39 +133,20 @@ typedef void (*cx_destructor_func2)(
 ) __attribute__((__nonnull__(2)));
 
 /**
- * Structure holding an advanced destructor function and the desired payload.
- * Invocations of func should use data as first argument.
- */
-typedef struct {
-    /**
-     * A pointer to the data that SHALL be used to invoke func.
-     */
-    void *data;
-    /**
-     * A pointer to the function to invoke.
-     */
-    cx_destructor_func2 func;
-} cx_advanced_destructor;
-
-/**
- * Specifies the type of destructor to use.
+ * Re-allocate a previously allocated block and changes the pointer in-place, if necessary.
+ *
+ * \par Error handling
+ * \c errno will be set by realloc() on failure.
+ *
+ * @param mem pointer to the pointer to allocated block
+ * @param n the new size in bytes
+ * @return zero on success, non-zero on failure
  */
-enum cx_destructor_type {
-    /**
-     * Do not use a destructor function.
-     */
-    CX_DESTRUCTOR_NONE,
-    /**
-     * Use a simple destructor.
-     * @see cx_destructor_func
-     */
-    CX_DESTRUCTOR_SIMPLE,
-    /**
-     * Use an advanced destructor.
-     * @see cx_advanced_destructor
-     */
-    CX_DESTRUCTOR_ADVANCED
-};
+int cx_reallocate(
+        void **mem,
+        size_t n
+)
+__attribute__((__nonnull__));
 
 /**
  * Allocate \p n bytes of memory.
@@ -204,7 +185,6 @@ __attribute__((__alloc_size__(3)));
 /**
  * Re-allocate a previously allocated block and changes the pointer in-place, if necessary.
  * This function acts like cxRealloc() using the pointer pointed to by \p mem.
- * On success, the pointer is changed to the new location (in case the
  *
  * \note Re-allocating a block allocated by a different allocator is undefined.
  *