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