summaryrefslogtreecommitdiffstats
path: root/stdlib/op.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-01-16 17:17:13 -0800
committerKaz Kylheku <kaz@kylheku.com>2024-01-16 17:17:13 -0800
commitcb0e7a1ccc3940923f318db9b0d7022c4b176f55 (patch)
treed67084bd250bd7cf8d8c0602ff4ab8d25d8bf38c /stdlib/op.tl
parent9d4bdaa8a78859a007da379362112634897b93e4 (diff)
downloadtxr-cb0e7a1ccc3940923f318db9b0d7022c4b176f55.tar.gz
txr-cb0e7a1ccc3940923f318db9b0d7022c4b176f55.tar.bz2
txr-cb0e7a1ccc3940923f318db9b0d7022c4b176f55.zip
lib: avoid realloc with zero size.
I spotted in the N3096 draft of ISO C (April 2023) that a zero size in realloc is no longer defined behavior, like it used to be. I don't know exactly when it changed; in C99 it is not mentioned. We call realloc only in one place, so we can defend agains this. * lib.c (chk_realloc): If the new size is zero, we implement the C99 and older semantics: deallocate the object, and then behave like malloc(0). In other cases, we use realloc.
Diffstat (limited to 'stdlib/op.tl')
0 files changed, 0 insertions, 0 deletions