]> git.ipfire.org Git - people/ric9/pakfire.git/commitdiff
src/string: implement macro for function pakfire_format_speed test-format_speed
authorRico Hoppe <rico.hoppe@ipfire.org>
Mon, 20 Jan 2025 16:55:32 +0000 (16:55 +0000)
committerRico Hoppe <rico.hoppe@ipfire.org>
Mon, 20 Jan 2025 16:55:32 +0000 (16:55 +0000)
Signed-off-by: Rico Hoppe <rico.hoppe@ipfire.org>
src/pakfire/string.c
src/pakfire/string.h

index a5de360d72fead7da81eabcd7645ce26b70940fc..16fd8c524acdafca6ded26b5e967343b5d01a14e 100644 (file)
@@ -575,7 +575,7 @@ int __pakfire_format_size(char* dst, size_t length, double value) {
        return __pakfire_string_format(dst, length, *unit, value);
 }
 
-int pakfire_format_speed(char* dst, size_t length, double value) {
+int __pakfire_format_speed(char* dst, size_t length, double value) {
        const char* units[] = {
                "%4.0fB/s",
                "%4.0fkB/s",
index 481b6b278444d3af121afba310c26f8ff3b0063c..0757894c6240cd0f7551fdfe8185dc2e33869147 100644 (file)
@@ -110,7 +110,10 @@ int pakfire_strings_dump(char** array);
 #define pakfire_format_size(dst, value) \
        __pakfire_format_size(dst, sizeof(dst), value)
 int __pakfire_format_size(char* dst, size_t length, double value);
-int pakfire_format_speed(char* dst, size_t length, double value);
+
+#define pakfire_format_speed(dst, value) \
+       __pakfire_format_speed(dst, sizeof(dst), value)
+int __pakfire_format_speed(char* dst, size_t length, double value);
 
 #define pakfire_strftime(buffer, format, t) \
        __pakfire_strftime(buffer, sizeof(buffer), format, t)