aboutsummaryrefslogtreecommitdiff
path: root/xsnprintf.c (unfollow)
Commit message (Collapse)AuthorLines
2026-07-21xmalloc/xsnprintf: simplify some code with new FATAL_ERROR_ON() macroCraig Barnes-3/+2
2024-09-13xsnprintf: various improvements related to xvsnprintf() and xsnprintf()Craig Barnes-17/+36
Summary of changes: * Make xvsnprintf() static * restrict-qualify pointer arguments (as done by the libc equivalents) * Make comments and spec references more thorough * Remove pointless `n <= INT_MAX` assertion (see comment) * Use FATAL_ERROR() instead of xassert() (since the assertion is inside a shared util function but the caller is responsible for ensuring the condition holds true) * Change some callers to use size_t instead of int for the return value (negative returns are impossible and all subsequent uses are size_t) The updated comments and code were taken (and adapted) from: https://gitlab.com/craigbarnes/dte/-/blob/49260bb154bca0434462a41c061e512540ec2e49/src/util/xsnprintf.c#L6-50 This work was entirely authored by me and I hereby license this contribution under the MIT license (stated explicitly, so that there's no ambiguity w.r.t. the original license).
2021-01-21Add xsnprintf() and remove some unnecessary strlen(3) callsCraig Barnes-0/+36
2021-01-16debug: rename assert() to xassert(), to avoid clashing with <assert.h>Craig Barnes-3/+3
2021-01-16Print stack trace on assert() failure or when calling fatal_error()Craig Barnes-1/+1
Note: this uses the __sanitizer_print_stack_trace() function from the AddressSanitizer runtime, so it only works when AddressSanitizer is in use.
2021-01-14Add xsnprintf() and remove some unnecessary strlen(3) callsCraig Barnes-0/+36
2020-10-10selection: use appropriate check for PRIMARY pasteSergey Nazaryev-54/+0
Assume it could be a copy-paste typo. We should check PRIMARY, not CLIPBOARD. Without this fix, we can't use PRIMARY until we copy anything to CLIPBOARD.