[PATCH 7/9] coreutils: Replace ptrdiff_t with intptr_t

Steve Capper steve.capper at arm.com
Mon Apr 4 10:50:00 UTC 2022


From: Vincenzo Frascino <vincenzo.frascino at arm.com>

The use of ptrdiff_t can trigger a warning.

Replace it with intptr_t that does not require provenance since being an
integer is always valid.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino at arm.com>
Reviewed-by: Steve Capper <steve.capper at arm.com>
Signed-off-by: Steve Capper <steve.capper at arm.com>
---
 coreutils/printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/coreutils/printf.c b/coreutils/printf.c
index 2e672d15f..88bfc22e0 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -233,7 +233,7 @@ static void print_direc(char *format, unsigned fmt_length,
 	case 's':
 		/* Are char* and long long the same? */
 		if (sizeof(argument) == sizeof(llv)) {
-			llv = (long long)(ptrdiff_t)argument;
+			llv = (long long)(intptr_t)argument;
 			goto print_long;
 		} else {
 			/* Hope compiler will optimize it out by moving call
-- 
2.35.1



More information about the busybox mailing list