From 34080b02024116c3ebf54051135e30db5fb46450 Mon Sep 17 00:00:00 2001
From: Bruce Cowan <bruce@bcowan.me.uk>
Date: Thu, 26 Dec 2019 10:28:36 +0000
Subject: [PATCH] A couple of realloc fixes and add warning options

---
 lib/utils/mem.c | 6 +++++-
 meson.build     | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/utils/mem.c b/lib/utils/mem.c
index 588afbc..e567512 100644
--- a/lib/utils/mem.c
+++ b/lib/utils/mem.c
@@ -17,6 +17,10 @@
  * SPDX-License-Identifier: Apache-2.0
  */
 
+#ifdef HAVE_REALLOCARRAY
+  #define _GNU_SOURCE
+#endif
+
 #include "config.h"
 #include "mem.h"
 
@@ -57,5 +61,5 @@ check_reallocarray (void   *ptr,
   if (!new)
     exit (EXIT_FAILURE);
 
-  return ptr;
+  return new;
 }
diff --git a/meson.build b/meson.build
index 5b05a65..2ede9cb 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
 project('stdlib', 'c',
-  default_options: ['c_std=gnu99'])
+  default_options: ['warning_level=3', 'c_std=gnu99'])
 
 cc = meson.get_compiler('c')
 libm = cc.find_library('m')
-- 
GitLab