diff options
| author | Craig Barnes <craigbarnes@protonmail.com> | 2026-07-12 13:33:19 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2026-07-21 09:00:54 +0000 |
| commit | c8a4fc6e7ab9ac0e3194b61a966da2df4f050ba0 (patch) | |
| tree | 3d59a57c977ac17ef61360d266b020fcf2717763 /xsnprintf.c | |
| parent | xmalloc: avoid using reallocarray(3) to implement xreallocarray() (diff) | |
xmalloc/xsnprintf: simplify some code with new FATAL_ERROR_ON() macro
Diffstat (limited to 'xsnprintf.c')
| -rw-r--r-- | xsnprintf.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/xsnprintf.c b/xsnprintf.c index 2f6f8493..495f4539 100644 --- a/xsnprintf.c +++ b/xsnprintf.c @@ -38,9 +38,8 @@ static size_t xvsnprintf(char *restrict buf, size_t n, const char *restrict format, va_list ap) { int len = vsnprintf(buf, n, format, ap); - if (unlikely(len < 0 || len >= (int)n)) { - FATAL_ERROR(__func__, (len < 0) ? errno : ENOBUFS); - } + FATAL_ERROR_ON(len < 0, errno); + FATAL_ERROR_ON(len >= (int)n, ENOBUFS); return (size_t)len; } |
