PengZheng commented on a change in pull request #404:
URL: https://github.com/apache/celix/pull/404#discussion_r832133972



##########
File path: libs/utils/src/array_list.c
##########
@@ -409,61 +409,62 @@ size_t celix_arrayList_getSize(const celix_array_list_t 
*list, int index) { retu
 
 static void arrayList_addEntry(celix_array_list_t *list, 
celix_array_list_entry_t entry) {
     arrayList_ensureCapacity(list, (int)list->size + 1);
-    memset(&list->elementData[list->size], 0, sizeof(entry));
     list->elementData[list->size++] = entry;
 }
 
 void celix_arrayList_add(celix_array_list_t *list, void * element) {
-    celix_array_list_entry_t entry = { .voidPtrVal = element };

Review comment:
       Now that sizeof(void*) != sizeof(entry), it's buggy. 
   
   Mislead by https://en.cppreference.com/w/c/language/struct_initialization:
   
   >All members that are not initialized explicitly are 
[zero-initialized](https://en.cppreference.com/w/c/language/initialization#Zero_initialization)
   
   I thought `memset` in unnecessary, and almost reintroduced the bug you 
already solved once, @pnoltes 
   Thanks to our CI: 
https://github.com/apache/celix/runs/5643661568?check_suite_focus=true 




-- 
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