Skip to content

Commit 3cfc289

Browse files
Explorer09BenBE
authored andcommitted
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 81432ba commit 3cfc289

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)