From 2bcb629e0405f8a74cabb6c87c430ca1b859dfd2 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 9 Feb 2019 19:47:21 +0100 Subject: [PATCH] mescc: Mes C Library: Support gcc-4.6.4: Allow larger qsort entries. * lib/stdlib/qsort.c (qswap): Increase buffer to 128 bytes (gmp needs 36) and add assert. --- lib/stdlib/qsort.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/stdlib/qsort.c b/lib/stdlib/qsort.c index 4f3e61cb..24ab9a48 100644 --- a/lib/stdlib/qsort.c +++ b/lib/stdlib/qsort.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -18,13 +18,15 @@ * along with GNU Mes. If not, see . */ +#include #include #include void qswap (void *a, void *b, size_t size) { - char *buf[8]; + char buf[128]; + assert (size <= sizeof (buf)); memcpy (buf, a, size); memcpy (a, b, size); memcpy (b, buf, size);