patch-arraylist_c 737 B

1234567891011121314151617
  1. Fix for gcc-14
  2. Upstream did not just fix this, but delay (the implicit) memset() in
  3. commit 4a546e7b2f471 ("In arraylist, use malloc instead of calloc,
  4. avoid clearing with memeset until we really need to, and micro-optimize
  5. array_list_add().") which is not suitable for a backport.
  6. --- json-c-0.13.orig/arraylist.c 2017-11-30 05:41:30.000000000 +0100
  7. +++ json-c-0.13/arraylist.c 2025-01-08 02:21:28.914179381 +0100
  8. @@ -46,7 +46,7 @@ array_list_new(array_list_free_fn *free_
  9. arr->size = ARRAY_LIST_DEFAULT_SIZE;
  10. arr->length = 0;
  11. arr->free_fn = free_fn;
  12. - if(!(arr->array = (void**)calloc(sizeof(void*), arr->size))) {
  13. + if(!(arr->array = (void**)calloc(arr->size, sizeof(void*)))) {
  14. free(arr);
  15. return NULL;
  16. }