PengZheng commented on code in PR #727:
URL: https://github.com/apache/celix/pull/727#discussion_r1495788685


##########
libs/utils/include/celix_array_list.h:
##########
@@ -468,11 +868,48 @@ CELIX_UTILS_EXPORT
 void celix_arrayList_sortEntries(celix_array_list_t *list, 
celix_array_list_compare_entries_fp compare);
 
 /**
- * @warning Never use this function with array of doubles, since on some 
32-bit platform (sizeof(double)==8 && sizeof(void*)==4)
- * @deprecated This function is deprecated, use celix_arrayList_sortEntries 
instead.
+ * @brief Sort the array list using the array list configured compare function.
+ * Note that undefined the array list compare function can be NULL and in that 
case the array list will not be sorted.
  */
-CELIX_UTILS_DEPRECATED_EXPORT
-void celix_arrayList_sort(celix_array_list_t *list, celix_arrayList_sort_fp 
sortFp);
+CELIX_UTILS_EXPORT
+void celix_arrayList_sort(celix_array_list_t *list);
+
+/**
+ * @brief Check if the array list are equal.
+ *
+ * Equal is defined as:
+ * - The array list have the same size
+ * - The array list have the same element type
+ * - The array list have the same equals callback
+ * - The array list have the same values at the same index
+ *
+ * Note that the remove callback and compare callback are ignored.
+ *
+ * If both array list are NULL, they are considered equal.
+ *
+ * @param listA The first array list.
+ * @param listB The second array list.
+ * @return true if the array list are equal, false otherwise.
+ */
+CELIX_UTILS_EXPORT
+bool celix_arrayList_equals(const celix_array_list_t* listA, const 
celix_array_list_t* listB);
+
+/**
+ * @Brief Copy the array list to a new array list.
+ *
+ * The new array list will have the same element type and the same callbacks 
as the original array list.
+ * If the element type is CELIX_ARRAY_LIST_ELEMENT_TYPE_STRING, the strings 
will be copied and
+ * if the element type is CELIX_ARRAY_LIST_ELEMENT_TYPE_VERSION, the versions 
will be copied.
+ * For all other element types the values will be copied.
+ *
+ * If a NULL is returned and the original array list is not NULL, a error 
message is logged to celix_err.
+ *
+ * @param[in] list The array list to copy.
+ * @return A new array list with the same element type and values as the 
original array list or NULL if the original
+ * array list is NULL or out of memory.
+ */
+CELIX_UTILS_EXPORT
+celix_array_list_t* celix_arrayList_copy(const celix_array_list_t* list);

Review Comment:
   IIRC, `CELIX_ARRAY_LIST_ELEMENT_TYPE_POINTER` is used for user-defined type. 
Now they can only be shallow-copied.
   
   I think the copy operation for user-defined type 
(`CELIX_ARRAY_LIST_ELEMENT_TYPE_POINTER`) can be left for future PR if really 
needed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to