summaryrefslogtreecommitdiffstats
path: root/gl/xmalloc.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2026-03-26 12:53:53 +0100
committerGitHub <noreply@github.com>2026-03-26 12:53:53 +0100
commit13e14a6bfd9f29cbfeab0c5161d2a994f97532e7 (patch)
tree3aa7186fe092e42783dc7e981dc39a74ea61c466 /gl/xmalloc.c
parent9d8503f90ef25b2cecd324dc118e441f40233ea8 (diff)
downloadmonitoring-plugins-13e14a6bfd9f29cbfeab0c5161d2a994f97532e7.tar.gz
Update/gnulib 2026 03 (#2247)HEADmaster
* Sync with the 202601-stable Gnulib code (4a3650d887) * Ignore more deps stuff in gnulib * Remove autogenerated gnulib files * Ignore more gnulib generated headers
Diffstat (limited to 'gl/xmalloc.c')
-rw-r--r--gl/xmalloc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gl/xmalloc.c b/gl/xmalloc.c
index 8a715807..6adc43c0 100644
--- a/gl/xmalloc.c
+++ b/gl/xmalloc.c
@@ -1,6 +1,6 @@
1/* xmalloc.c -- malloc with out of memory checking 1/* xmalloc.c -- malloc with out of memory checking
2 2
3 Copyright (C) 1990-2000, 2002-2006, 2008-2025 Free Software Foundation, Inc. 3 Copyright (C) 1990-2000, 2002-2006, 2008-2026 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -15,10 +15,8 @@
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#include <config.h>
19
20#define XALLOC_INLINE _GL_EXTERN_INLINE 18#define XALLOC_INLINE _GL_EXTERN_INLINE
21 19#include <config.h>
22#include "xalloc.h" 20#include "xalloc.h"
23 21
24#include "ialloc.h" 22#include "ialloc.h"
@@ -29,7 +27,13 @@
29#include <stdint.h> 27#include <stdint.h>
30#include <string.h> 28#include <string.h>
31 29
32static void * _GL_ATTRIBUTE_PURE 30/* Pacify GCC up to at least 15.2, which otherwise would incorrectly
31 complain about check_nonnull. */
32#if _GL_GNUC_PREREQ (4, 6)
33# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
34#endif
35
36static void *
33check_nonnull (void *p) 37check_nonnull (void *p)
34{ 38{
35 if (!p) 39 if (!p)
@@ -224,13 +228,13 @@ x2nrealloc (void *p, size_t *pn, size_t s)
224void * 228void *
225xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s) 229xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s)
226{ 230{
227 idx_t n0 = *pn;
228
229 /* The approximate size to use for initial small allocation 231 /* The approximate size to use for initial small allocation
230 requests. This is the largest "small" request for the GNU C 232 requests. This is the largest "small" request for the GNU C
231 library malloc. */ 233 library malloc. */
232 enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; 234 enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 };
233 235
236 idx_t n0 = *pn;
237
234 /* If the array is tiny, grow it to about (but no greater than) 238 /* If the array is tiny, grow it to about (but no greater than)
235 DEFAULT_MXFAST bytes. Otherwise, grow it by about 50%. 239 DEFAULT_MXFAST bytes. Otherwise, grow it by about 50%.
236 Adjust the growth according to three constraints: N_INCR_MIN, 240 Adjust the growth according to three constraints: N_INCR_MIN,