src/cx/list.h

changeset 1604
68b75c091028
parent 1482
6769cb72521b
child 1605
55b13f583356
equal deleted inserted replaced
1603:ffea41207599 1604:68b75c091028
982 * @param clone_func the clone function for the elements 982 * @param clone_func the clone function for the elements
983 * @param clone_allocator the allocator that is passed to the clone function 983 * @param clone_allocator the allocator that is passed to the clone function
984 * @param data optional additional data that is passed to the clone function 984 * @param data optional additional data that is passed to the clone function
985 * @retval zero when all elements were successfully cloned 985 * @retval zero when all elements were successfully cloned
986 * @retval non-zero when an allocation error occurred 986 * @retval non-zero when an allocation error occurred
987 * @see cxListCloneSimple() 987 * @see cxListCloneShallow()
988 */ 988 */
989 cx_attr_nonnull_arg(1, 2, 3) 989 cx_attr_nonnull_arg(1, 2, 3)
990 CX_EXPORT int cxListClone(CxList *dst, const CxList *src, 990 CX_EXPORT int cxListClone(CxList *dst, const CxList *src,
991 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); 991 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
992 992
1005 * @param clone_func the clone function for the elements 1005 * @param clone_func the clone function for the elements
1006 * @param clone_allocator the allocator that is passed to the clone function 1006 * @param clone_allocator the allocator that is passed to the clone function
1007 * @param data optional additional data that is passed to the clone function 1007 * @param data optional additional data that is passed to the clone function
1008 * @retval zero when the elements were successfully cloned 1008 * @retval zero when the elements were successfully cloned
1009 * @retval non-zero when an allocation error occurred 1009 * @retval non-zero when an allocation error occurred
1010 * @see cxListDifferenceSimple() 1010 * @see cxListDifferenceShallow()
1011 */ 1011 */
1012 cx_attr_nonnull_arg(1, 2, 3, 4) 1012 cx_attr_nonnull_arg(1, 2, 3, 4)
1013 CX_EXPORT int cxListDifference(CxList *dst, 1013 CX_EXPORT int cxListDifference(CxList *dst,
1014 const CxList *minuend, const CxList *subtrahend, 1014 const CxList *minuend, const CxList *subtrahend,
1015 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); 1015 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
1029 * @param clone_func the clone function for the elements 1029 * @param clone_func the clone function for the elements
1030 * @param clone_allocator the allocator that is passed to the clone function 1030 * @param clone_allocator the allocator that is passed to the clone function
1031 * @param data optional additional data that is passed to the clone function 1031 * @param data optional additional data that is passed to the clone function
1032 * @retval zero when the elements were successfully cloned 1032 * @retval zero when the elements were successfully cloned
1033 * @retval non-zero when an allocation error occurred 1033 * @retval non-zero when an allocation error occurred
1034 * @see cxListIntersectionSimple() 1034 * @see cxListIntersectionShallow()
1035 */ 1035 */
1036 cx_attr_nonnull_arg(1, 2, 3, 4) 1036 cx_attr_nonnull_arg(1, 2, 3, 4)
1037 CX_EXPORT int cxListIntersection(CxList *dst, const CxList *src, const CxList *other, 1037 CX_EXPORT int cxListIntersection(CxList *dst, const CxList *src, const CxList *other,
1038 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); 1038 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
1039 1039
1054 * @param clone_func the clone function for the elements 1054 * @param clone_func the clone function for the elements
1055 * @param clone_allocator the allocator that is passed to the clone function 1055 * @param clone_allocator the allocator that is passed to the clone function
1056 * @param data optional additional data that is passed to the clone function 1056 * @param data optional additional data that is passed to the clone function
1057 * @retval zero when the elements were successfully cloned 1057 * @retval zero when the elements were successfully cloned
1058 * @retval non-zero when an allocation error occurred 1058 * @retval non-zero when an allocation error occurred
1059 * @see cxListUnionSimple() 1059 * @see cxListUnionShallow()
1060 */ 1060 */
1061 cx_attr_nonnull_arg(1, 2, 3, 4) 1061 cx_attr_nonnull_arg(1, 2, 3, 4)
1062 CX_EXPORT int cxListUnion(CxList *dst, const CxList *src, const CxList *other, 1062 CX_EXPORT int cxListUnion(CxList *dst, const CxList *src, const CxList *other,
1063 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); 1063 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
1064 1064
1080 * @retval zero when all elements were successfully cloned 1080 * @retval zero when all elements were successfully cloned
1081 * @retval non-zero when an allocation error occurred 1081 * @retval non-zero when an allocation error occurred
1082 * @see cxListClone() 1082 * @see cxListClone()
1083 */ 1083 */
1084 cx_attr_nonnull 1084 cx_attr_nonnull
1085 CX_EXPORT int cxListCloneSimple(CxList *dst, const CxList *src); 1085 CX_EXPORT int cxListCloneShallow(CxList *dst, const CxList *src);
1086 1086
1087 /** 1087 /**
1088 * Clones elements from a list only if they are not present in another list. 1088 * Clones elements from a list only if they are not present in another list.
1089 * 1089 *
1090 * This function uses the default allocator, if needed, and performs 1090 * This function uses the default allocator, if needed, and performs
1102 * @retval zero when the elements were successfully cloned 1102 * @retval zero when the elements were successfully cloned
1103 * @retval non-zero when an allocation error occurred 1103 * @retval non-zero when an allocation error occurred
1104 * @see cxListDifference() 1104 * @see cxListDifference()
1105 */ 1105 */
1106 cx_attr_nonnull 1106 cx_attr_nonnull
1107 CX_EXPORT int cxListDifferenceSimple(CxList *dst, 1107 CX_EXPORT int cxListDifferenceShallow(CxList *dst,
1108 const CxList *minuend, const CxList *subtrahend); 1108 const CxList *minuend, const CxList *subtrahend);
1109 1109
1110 /** 1110 /**
1111 * Clones elements from a list only if they are also present in another list. 1111 * Clones elements from a list only if they are also present in another list.
1112 * 1112 *
1125 * @retval zero when the elements were successfully cloned 1125 * @retval zero when the elements were successfully cloned
1126 * @retval non-zero when an allocation error occurred 1126 * @retval non-zero when an allocation error occurred
1127 * @see cxListIntersection() 1127 * @see cxListIntersection()
1128 */ 1128 */
1129 cx_attr_nonnull 1129 cx_attr_nonnull
1130 CX_EXPORT int cxListIntersectionSimple(CxList *dst, const CxList *src, const CxList *other); 1130 CX_EXPORT int cxListIntersectionShallow(CxList *dst, const CxList *src, const CxList *other);
1131 1131
1132 /** 1132 /**
1133 * Performs a deep clone of one list into another, skipping duplicates. 1133 * Performs a deep clone of one list into another, skipping duplicates.
1134 * 1134 *
1135 * This function uses the default allocator, if needed, and performs 1135 * This function uses the default allocator, if needed, and performs
1149 * @retval zero when the elements were successfully cloned 1149 * @retval zero when the elements were successfully cloned
1150 * @retval non-zero when an allocation error occurred 1150 * @retval non-zero when an allocation error occurred
1151 * @see cxListUnion() 1151 * @see cxListUnion()
1152 */ 1152 */
1153 cx_attr_nonnull 1153 cx_attr_nonnull
1154 CX_EXPORT int cxListUnionSimple(CxList *dst, const CxList *src, const CxList *other); 1154 CX_EXPORT int cxListUnionShallow(CxList *dst, const CxList *src, const CxList *other);
1155 1155
1156 /** 1156 /**
1157 * Asks the list to reserve enough memory for a given total number of elements. 1157 * Asks the list to reserve enough memory for a given total number of elements.
1158 * 1158 *
1159 * List implementations are free to choose if reserving memory upfront makes 1159 * List implementations are free to choose if reserving memory upfront makes

mercurial