src/cx/list.h

changeset 524
e98b09018d32
parent 519
79d14e821b3a
child 525
536646d1575b
     1.1 --- a/src/cx/list.h	Mon Apr 18 14:41:19 2022 +0200
     1.2 +++ b/src/cx/list.h	Mon Apr 18 15:29:52 2022 +0200
     1.3 @@ -71,10 +71,6 @@
     1.4       */
     1.5      CxAllocator const *allocator;
     1.6      /**
     1.7 -     * A mandatory destructor for the list structure.
     1.8 -     */
     1.9 -    cx_destructor_func list_destructor;
    1.10 -    /**
    1.11       * An optional destructor for the list contents.
    1.12       */
    1.13      cx_destructor_func content_destructor;
    1.14 @@ -95,11 +91,6 @@
    1.15       */
    1.16      size_t capacity;
    1.17      /**
    1.18 -     * Flag indicating whether cxListDestroy() shall free the list structure,
    1.19 -     * even if cx_list_s.list_destructor did not do that.
    1.20 -     */
    1.21 -    bool autofree;
    1.22 -    /**
    1.23       * Flag indicating whether cxListDestroy() shall free each list element,
    1.24       * even if cx_list_s.content_destructor did not do that.
    1.25       */
    1.26 @@ -111,6 +102,11 @@
    1.27   */
    1.28  struct cx_list_class_s {
    1.29      /**
    1.30 +     * Destructor function.
    1.31 +     */
    1.32 +    void (*destructor)(struct cx_list_s *list);
    1.33 +
    1.34 +    /**
    1.35       * Member function for adding an element.
    1.36       */
    1.37      int (*add)(
    1.38 @@ -193,25 +189,6 @@
    1.39  typedef struct cx_list_s CxList;
    1.40  
    1.41  /**
    1.42 - * Convenience function to configure the memory management for this list.
    1.43 - *
    1.44 - * @param list the list to configure
    1.45 - * @param list_destructor an alternative list destructor to use (if \c NULL, the current destructor remains unchanged)
    1.46 - * @param content_destructor the content destructor to use (if \c NULL, no content destructor is used)
    1.47 - * @param list_autofree a flag indicating, if the list allocator shall free the list, if the destructor did not do that
    1.48 - * @param content_autofree a flag indicating, if the list allocator shall free an element,
    1.49 - * if the content destructor did not do that or no content destructor exists
    1.50 - */
    1.51 -__attribute__((__nonnull__(1)))
    1.52 -void cxListMemoryMgmt(
    1.53 -        CxList *list,
    1.54 -        cx_destructor_func list_destructor,
    1.55 -        cx_destructor_func content_destructor,
    1.56 -        bool list_autofree,
    1.57 -        bool content_autofree
    1.58 -);
    1.59 -
    1.60 -/**
    1.61   * Adds an item to the end of the list.
    1.62   *
    1.63   * @param list the list

mercurial