diff mbox series

test-path-utils: use a C89 compatible format for double printf

Message ID 20210809072551.94391-1-carenas@gmail.com (mailing list archive)
State New, archived
Headers show
Series test-path-utils: use a C89 compatible format for double printf | expand

Commit Message

Carlo Marcelo Arenas Belón Aug. 9, 2021, 7:25 a.m. UTC
a62f9d1ace (test-path-utils: offer to run a protectNTFS/protectHFS
benchmark, 2019-09-04) add a tool for testing that uses a double
variable to keep track of time but prints them with "%lf".

while correct for newer C standards, it is not defined in C89 and
it is not needed, since both float and double will be promoted to
double by printf and should therefore use "%f"; change it accordingly.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 t/helper/test-path-utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index 229ed416b0..3d33d2a3e7 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -275,18 +275,18 @@  static int protect_ntfs_hfs_benchmark(int argc, const char **argv)
 				for (j = 0; j < nr; j++)
 					verify_path(names[j], file_mode);
 				end = getnanotime();
-				printf("protect_ntfs = %d, protect_hfs = %d: %lfms\n", protect_ntfs, protect_hfs, (end-begin) / (double)1e6);
+				printf("protect_ntfs = %d, protect_hfs = %d: %fms\n", protect_ntfs, protect_hfs, (end-begin) / (double)1e6);
 				cumul += end - begin;
 				cumul2 += (end - begin) * (end - begin);
 			}
 			m[protect_ntfs][protect_hfs] = cumul / (double)repetitions;
 			v[protect_ntfs][protect_hfs] = my_sqrt(cumul2 / (double)repetitions - m[protect_ntfs][protect_hfs] * m[protect_ntfs][protect_hfs]);
-			printf("mean: %lfms, stddev: %lfms\n", m[protect_ntfs][protect_hfs] / (double)1e6, v[protect_ntfs][protect_hfs] / (double)1e6);
+			printf("mean: %fms, stddev: %fms\n", m[protect_ntfs][protect_hfs] / (double)1e6, v[protect_ntfs][protect_hfs] / (double)1e6);
 		}
 
 	for (protect_ntfs = 0; protect_ntfs < 2; protect_ntfs++)
 		for (protect_hfs = 0; protect_hfs < 2; protect_hfs++)
-			printf("ntfs=%d/hfs=%d: %lf%% slower\n", protect_ntfs, protect_hfs, (m[protect_ntfs][protect_hfs] - m[0][0]) * 100 / m[0][0]);
+			printf("ntfs=%d/hfs=%d: %f%% slower\n", protect_ntfs, protect_hfs, (m[protect_ntfs][protect_hfs] - m[0][0]) * 100 / m[0][0]);
 
 	return 0;
 }