summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Bürk <admin@airblader.de>2020-05-01 09:41:56 +0200
committerGitHub <noreply@github.com>2020-05-01 09:41:56 +0200
commiteb6c840c38ebd2d7797ea599b9e8207a2e8e5033 (patch)
treedc631befd90ecd34ac2fac9ddf1199e0ca006bbb
parent57218e98de20ef2a779f4b33a6d742d52a0bf0f8 (diff)
parenta68524ee4a7cbf120382a7b678a7820f07b10bf5 (diff)
Merge pull request #412 from orestisfl/warnings
Fix various warnings
-rw-r--r--include/i3status.h4
-rw-r--r--src/print_mem.c5
-rw-r--r--src/print_path_exists.c1
3 files changed, 6 insertions, 4 deletions
diff --git a/include/i3status.h b/include/i3status.h
index e0dff2b..6e5278f 100644
--- a/include/i3status.h
+++ b/include/i3status.h
@@ -206,9 +206,9 @@ char *trim(const char *s);
/* src/format_placeholders.c */
typedef struct {
/* The placeholder to be replaced, e.g., "%title". */
- char *name;
+ const char *name;
/* The value this placeholder should be replaced with. */
- char *value;
+ const char *value;
} placeholder_t;
char *format_placeholders(const char *format, placeholder_t *placeholders, int num);
diff --git a/src/print_mem.c b/src/print_mem.c
index cbe42a9..941c9d9 100644
--- a/src/print_mem.c
+++ b/src/print_mem.c
@@ -23,7 +23,7 @@ static const char *const iec_symbols[] = {"B", "KiB", "MiB", "GiB", "TiB"};
*/
static int print_bytes_human(char *outwalk, unsigned long bytes, const char *unit, const int decimals) {
double base = bytes;
- int exponent = 0;
+ size_t exponent = 0;
while (base >= BINARY_BASE && exponent < MAX_EXPONENT) {
if (strcasecmp(unit, iec_symbols[exponent]) == 0) {
break;
@@ -86,7 +86,6 @@ void print_memory(yajl_gen json_gen, char *buffer, const char *format, const cha
#if defined(linux)
const char *selected_format = format;
- const char *walk;
const char *output_color = NULL;
int unread_fields = 6;
@@ -140,6 +139,8 @@ void print_memory(yajl_gen json_gen, char *buffer, const char *format, const cha
ram_used = ram_total - ram_available;
} else if (BEGINS_WITH(memory_used_method, "classical")) {
ram_used = ram_total - ram_free - ram_buffers - ram_cached;
+ } else {
+ die("Unexpected value: memory_used_method = %s", memory_used_method);
}
if (threshold_degraded) {
diff --git a/src/print_path_exists.c b/src/print_path_exists.c
index 504eb6c..a57cc7b 100644
--- a/src/print_path_exists.c
+++ b/src/print_path_exists.c
@@ -1,6 +1,7 @@
// vim:ts=4:sw=4:expandtab
#include <config.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <yajl/yajl_gen.h>
#include <yajl/yajl_version.h>