summaryrefslogtreecommitdiff
path: root/doc/safe-alloc.texi
Commit message (Collapse)AuthorAgeFilesLines
* safe-alloc: fix pointer implementationPaul Eggert2021-04-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | 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: improve docPaul Eggert2021-04-181-5/+9
| | | | | | * doc/safe-alloc.texi: Clarify that reallocating an array appends uninitialized storage. Say ‘sizeof *p’ rather than ‘sizeof(*p)’ which would need a space before the paren to follow GNU style.
* Hyphen and dash fixes.Paul Eggert2012-12-271-4/+4
|
* Cosmetic tweaks in the safe-alloc module.Bruno Haible2009-02-221-26/+26
|
* New module 'safe-alloc'.David Lutterkort2009-02-211-0/+83