summaryrefslogtreecommitdiff
path: root/lib/safe-alloc.c
Commit message (Collapse)AuthorAgeFilesLines
* Put LGPLv2+ notices in source files where appropriate.Bruno Haible2021-06-041-0/+18
| | | | | * lib/**.{h,c,gperf}: Use LGPLv2+ notice whenever the module description says so.
* safe-alloc: fix pointer implementationPaul Eggert2021-04-181-89/+1
| | | | | | | | | | | | | | | | | | | | | | | The old implementation assumed that all pointers use the same internal representation, but the C standard doesn’t guarantee this. Use void * (pointer) not void ** (pointer-to-pointer) for the internal functions’ API. The internal functions now return NULL if and only if they failed, and the macros translate that into -1 or 0 to satisfy the existing API. * doc/safe-alloc.texi (Safe Allocation Macros): Mention overflow. * lib/safe-alloc.c: Major rewrite. Now this simply defines SAFE_ALLOC_INLINE and includes safe-alloc.h. * lib/safe-alloc.h: Include stddef.h, not stdlib.h. (SAFE_ALLOC_INLINE): New macro; use Gnulib inline function style. (safe_alloc_realloc_n): New API, which passes and returns the pointer, and which returns NULL if and only if failure occurs. (safe_alloc_check): New function. (ALLOC, ALLOC_N, ALLOC_N_UNINITIALIZED, REALLOC_N): Redo using the new API for internal functions, and using calloc which is good enough since it’s GNU-compatible now. (FREE): Expand to an expression rather than merely to something that needs a following ‘;’ to become a statement. * modules/safe-alloc (Depends-on): Add calloc-gnu.
* safe-alloc: simplify via reallocarrayPaul Eggert2021-04-181-15/+2
| | | | | | | | | | | * lib/safe-alloc.c: Do not include xalloc-oversized.h. (safe_alloc_alloc_n, safe_alloc_realloc_n): Use reallocarray to check for size or ptrdiff_t overflow. * modules/reallocarray (License): Switch from LGPL to LGPLv2+, as this is needed for safe-alloc and anyway is more appropriate for this library function common with BSD. * modules/safe-alloc (Depends-on): Depend on reallocarray rather than xalloc-oversized.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* safe-alloc: use xalloc-oversizedPaul Eggert2016-12-151-21/+4
| | | | | | * lib/safe-alloc.c: Include xalloc-oversized.h. (safe_alloc_oversized): Remove. All uses changed to xalloc_oversized. * modules/safe-alloc (Depends-on): Add xalloc-oversized.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* misc: don't limit commentary to inline functionsPaul Eggert2012-09-221-1/+1
| | | | | | | * lib/binary-io.h, lib/malloca.h, lib/safe-alloc.c: * lib/xalloc-oversized.h, lib/xsize.h: Contrast macros to functions in general, not just to inline functions, when the commentary does not apply only to inline functions.
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* Use the standard header with GPL copyright.Bruno Haible2009-09-191-6/+6
|
* Use the standard header with LGPL copyright.Bruno Haible2009-09-191-20/+16
|
* Cosmetic tweaks in the safe-alloc module.Bruno Haible2009-02-221-2/+3
|
* New module 'safe-alloc'.David Lutterkort2009-02-211-0/+124