Skip to content

Commit 5e07cf7

Browse files
committed
fix: correct strtol0x signature
Building with older compilers, such as Xcode's gcc 4.2, triggered "different width due to prototype" warnings. This occurs because character literals (e.g., 'X') are promoted to `int` when passed as function arguments, but the `strtol0X` function signature expected a `char`. This change corrects the function signature to accept an `int`, which resolves the compiler warnings and improves portability.
1 parent b50c6c8 commit 5e07cf7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/arg_int.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static void arg_int_resetfn(void* parent_) {
5656
/* eg: to parse oct str="+0o12324", specify X='O' and base=8. */
5757
/* eg: to parse bin str="-0B01010", specify X='B' and base=2. */
5858
/* Failure of conversion is indicated by result where *endptr==str. */
59-
static long int strtol0X(const char* str, const char** endptr, char X, int base) {
59+
static long int strtol0X(const char* str, const char** endptr, int X, int base) {
6060
long int val; /* stores result */
6161
int s = 1; /* sign is +1 or -1 */
6262
const char* ptr = str; /* ptr to current position in str */

0 commit comments

Comments
 (0)