summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2025-01-08 19:22:16 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2025-01-09 11:19:01 +0100
commit56cd779a7a48465714d69b4a22ae66ee894b15ce (patch)
treed1c1e44cf3c9b0d1fcca135495e5c28e4405c980
parent6854b5655a4dbc71a19b25f7226b559f6eba6365 (diff)
package: json-c: Fix for compiling with gcc-14
Wrong ordering in calloc() is bad, mkay? Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--package/json-c/patches/patch-arraylist_c17
-rw-r--r--package/json-c/patches/patch-json_object_c17
2 files changed, 34 insertions, 0 deletions
diff --git a/package/json-c/patches/patch-arraylist_c b/package/json-c/patches/patch-arraylist_c
new file mode 100644
index 000000000..6143e8fd8
--- /dev/null
+++ b/package/json-c/patches/patch-arraylist_c
@@ -0,0 +1,17 @@
+ Fix for gcc-14
+
+ Upstream did not just fix this, but delay (the implicit) memset() in
+ commit 4a546e7b2f471 ("In arraylist, use malloc instead of calloc,
+ avoid clearing with memeset until we really need to, and micro-optimize
+ array_list_add().") which is not suitable for a backport.
+--- json-c-0.13.orig/arraylist.c 2017-11-30 05:41:30.000000000 +0100
++++ json-c-0.13/arraylist.c 2025-01-08 02:21:28.914179381 +0100
+@@ -46,7 +46,7 @@ array_list_new(array_list_free_fn *free_
+ arr->size = ARRAY_LIST_DEFAULT_SIZE;
+ arr->length = 0;
+ arr->free_fn = free_fn;
+- if(!(arr->array = (void**)calloc(sizeof(void*), arr->size))) {
++ if(!(arr->array = (void**)calloc(arr->size, sizeof(void*)))) {
+ free(arr);
+ return NULL;
+ }
diff --git a/package/json-c/patches/patch-json_object_c b/package/json-c/patches/patch-json_object_c
new file mode 100644
index 000000000..09b93743e
--- /dev/null
+++ b/package/json-c/patches/patch-json_object_c
@@ -0,0 +1,17 @@
+ Fix for gcc-14
+
+ Upstream did not just fix this, but delay (the implicit) memset() in
+ commit 4a546e7b2f471 ("In arraylist, use malloc instead of calloc,
+ avoid clearing with memeset until we really need to, and micro-optimize
+ array_list_add().") which is not suitable for a backport.
+--- json-c-0.13.orig/json_object.c 2017-12-05 05:44:03.000000000 +0100
++++ json-c-0.13/json_object.c 2025-01-08 02:21:42.515180709 +0100
+@@ -218,7 +218,7 @@ static struct json_object* json_object_n
+ {
+ struct json_object *jso;
+
+- jso = (struct json_object*)calloc(sizeof(struct json_object), 1);
++ jso = (struct json_object*)calloc(1, sizeof(struct json_object));
+ if (!jso)
+ return NULL;
+ jso->o_type = o_type;