diff options
author | Aaron Marcher <me@drkhsh.at> | 2018-07-07 11:08:26 +0200 |
---|---|---|
committer | Aaron Marcher <me@drkhsh.at> | 2018-07-07 11:08:26 +0200 |
commit | acfa1f50c24add6b9a78d94af21f9350150fb9c2 (patch) | |
tree | 2153a871d07704dcae0eec15b1d8ceab04724fbd /components/ram.c | |
parent | c2492c3f99d9d434a6f935dea8e97fa27cdd2adc (diff) |
Simplify format specifiers for uintmax_t
Diffstat (limited to 'components/ram.c')
-rw-r--r-- | components/ram.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/components/ram.c b/components/ram.c index a2fff95..d2fbce9 100644 --- a/components/ram.c +++ b/components/ram.c @@ -4,7 +4,7 @@ #include "../util.h" #if defined(__linux__) - #include <inttypes.h> + #include <stdint.h> const char * ram_free(void) @@ -12,9 +12,9 @@ uintmax_t free; if (pscanf("/proc/meminfo", - "MemTotal: %" PRIuMAX " kB\n" - "MemFree: %" PRIuMAX " kB\n" - "MemAvailable: %" PRIuMAX " kB\n", + "MemTotal: %ju kB\n" + "MemFree: %ju kB\n" + "MemAvailable: %ju kB\n", &free, &free, &free) != 3) { return NULL; } @@ -28,10 +28,10 @@ uintmax_t total, free, buffers, cached; if (pscanf("/proc/meminfo", - "MemTotal: %" PRIuMAX " kB\n" - "MemFree: %" PRIuMAX " kB\n" - "MemAvailable: %" PRIuMAX " kB\nBuffers: %ld kB\n" - "Cached: %" PRIuMAX " kB\n", + "MemTotal: %ju kB\n" + "MemFree: %ju kB\n" + "MemAvailable: %ju kB\nBuffers: %ju kB\n" + "Cached: %ju kB\n", &total, &free, &buffers, &buffers, &cached) != 5) { return NULL; } @@ -49,7 +49,7 @@ { uintmax_t total; - if (pscanf("/proc/meminfo", "MemTotal: %" PRIuMAX " kB\n", + if (pscanf("/proc/meminfo", "MemTotal: %ju kB\n", &total) != 1) { return NULL; } @@ -63,10 +63,10 @@ uintmax_t total, free, buffers, cached; if (pscanf("/proc/meminfo", - "MemTotal: %" PRIuMAX " kB\n" - "MemFree: %" PRIuMAX " kB\n" - "MemAvailable: %" PRIuMAX " kB\nBuffers: %" PRIuMAX " kB\n" - "Cached: %" PRIuMAX " kB\n", + "MemTotal: %ju kB\n" + "MemFree: %ju kB\n" + "MemAvailable: %ju kB\nBuffers: %ju kB\n" + "Cached: %ju kB\n", &total, &free, &buffers, &buffers, &cached) != 5) { return NULL; } |