summaryrefslogtreecommitdiff
path: root/doc/posix-functions/realloc.texi
Commit message (Collapse)AuthorAgeFilesLines
* malloc-posix, realloc-posix, calloc-posix: Document affected platforms.Bruno Haible2021-04-181-1/+2
| | | | | | * doc/posix-functions/malloc.texi: Re-add platforms list. * doc/posix-functions/realloc.texi: Likewise. * doc/posix-functions/calloc.texi: Likewise.
* malloc, etc.: check for ptrdiff_t overflowPaul Eggert2021-04-171-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In glibc 2.30 and later, malloc, realloc and calloc reject attempts to create objects larger than PTRDIFF_MAX bytes. This patch changes malloc-gnu etc. to support this behavior on non-GNU hosts. It also makes this change for malloc-posix etc. since it’s a safety measure that ought to be in POSIX (perhaps we can talk them into that...). In writing this patch I found a complicated set of code that had accumulated over the years, some written by yours truly. I got rid of the code I couldn’t see the need for nowadays. Among other things, the GNU realloc behavior is no longer incompatible with the C standard, because in C17 the latter was relaxed to allow the former. If I went too far in cleaning up, the old stuff can be resurrected. This change is mostly for 32-bit platforms, since practical 64-bit platforms cannot create objects larger than PTRDIFF_MAX bytes anyway. * doc/posix-functions/calloc.texi: * doc/posix-functions/malloc.texi: * doc/posix-functions/realloc.texi: Mention ptrdiff_t issues, and go into more detail about what the gnu extension module does. * doc/posix-functions/realloc.texi: Fix now-obsolete commentary about C99 vs glibc, as C17 allows the glibc behavior and POSIX will follow suit when it gets around to it. * lib/calloc.c, lib/malloc.c, lib/realloc.c: Simplify by always supplying a GNU-compatible version, as that suffices for correctness and is good enough for performance. Include xalloc-oversized.h, and use xalloc_oversized to check for ptrdiff_t overflow. (NEED_CALLOC_GNU, NEED_MALLOC_GNU, NEED_REALLOC_GNU): Remove. * m4/calloc.m4 (_AC_FUNC_CALLOC_IF): * m4/malloc.m4 (_AC_FUNC_MALLOC_IF): * m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Don’t start with a newline. Fix message to match behavior. * m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Don’t test for size_t overflow, as the ptrdiff_t test is good enough. * m4/calloc.m4 (gl_FUNC_CALLOC_GNU): * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): * m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Do not define HAVE_CALLOC_GNU, HAVE_MALLOC_GNU, HAVE_REALLOC_GNU. It’s not worth the aggravation of maintaining these, as they are confusing (they don’t really mean GNU-compatible anyway). Don’t bother testing for GNU behavior if we have already decided to replace the function, since the replacement is always GNUish. * m4/calloc.m4 (gl_FUNC_CALLOC_POSIX): * m4/realloc.m4 (gl_FUNC_REALLOC_POSIX): Defer to gl_FUNC_MALLOC_POSIX. * m4/malloc.m4 (gl_FUNC_MALLOC_PTRDIFF, gl_CHECK_MALLOC_PTRDIFF): New macros. (gl_FUNC_MALLOC_POSIX): Use them to check for ptrdiff_t overflow. * modules/calloc-gnu, modules/malloc-gnu, modules/realloc-gnu: Remove no-longer-needed module indicators. * modules/calloc-posix, modules/malloc-posix, modules/realloc-posix: Depend on xalloc-oversized. * modules/malloc-posix: Require gl_FUNC_MALLOC_POSIX instead of calling it directly, so that other code can require it. * modules/realloc-posix: Depend on free-posix and malloc-posix.
* Update some URLsPaul Eggert2019-09-221-1/+1
| | | | | | This is a clerical change that mostly changes http: to https: in URLs where either will work. It also updates some URLs that have moved, removes some URLs that no longer work, and fixes related text.
* doc: Update for MSVC 14.Bruno Haible2017-07-061-1/+1
| | | | | | | | * doc/posix-headers/*.texi: Add info about MSVC 14. * doc/posix-functions/*.texi: Likewise. * doc/pastposix-functions/*.texi: Likewise. * doc/glibc-headers/*.texi: Likewise. * doc/glibc-functions/*.texi: Likewise.
* doc: Update regarding MSVC 9.Bruno Haible2011-09-111-1/+1
| | | | | | | | | | * doc/gnulib-intro.texi (Target Platforms): Classify MSVC as "rarely tested". * doc/posix-functions/*.texi: Update with info about MSVC 9. * doc/posix-headers/*.texi: Likewise. * doc/pastposix-functions/*.texi: Likewise. * doc/glibc-functions/*.texi: Likewise. * doc/glibc-headers/*.texi: Likewise.
* realloc: document portability problemEric Blake2011-03-241-0/+13
| | | | | | | * doc/posix-functions/realloc.texi (realloc): Mention pitfalls of passing 0 size to realloc. Signed-off-by: Eric Blake <eblake@redhat.com>
* Rename module 'realloc' -> 'realloc-gnu'.Bruno Haible2010-08-281-1/+1
|
* avoid some overlong lines from posix urls, etc.Karl Berry2010-08-131-1/+1
|
* Refer to new POSIX:2008 standard.Bruno Haible2008-12-141-1/+1
|
* Rename two directories: headers -> posix-headers, functions -> posix-functions.Bruno Haible2008-01-201-0/+22