Skip to content

Commit f18a1f4

Browse files
committed
Use 'int' type for backtrace() return value
The libc backtrace() API uses 'int' type for "number of pointers" return value, and backtrace_symbols_fd() accepts this value as argument in 'int' type, too. Using size_t would unnecessarily generate a "-Wshorten-64-to-32" warning in Clang 19.
1 parent 5c6339b commit f18a1f4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

CRT.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,8 @@ static void print_backtrace(void) {
12601260
#elif defined(HAVE_EXECINFO_H)
12611261
void* backtraceArray[256];
12621262

1263-
size_t size = backtrace(backtraceArray, ARRAYSIZE(backtraceArray));
1264-
backtrace_symbols_fd(backtraceArray, size, STDERR_FILENO);
1263+
int nptrs = backtrace(backtraceArray, ARRAYSIZE(backtraceArray));
1264+
backtrace_symbols_fd(backtraceArray, nptrs, STDERR_FILENO);
12651265
#else
12661266
#error No implementation for print_backtrace()!
12671267
#endif

0 commit comments

Comments
 (0)