write_sensu plugin: fix implicit conversion
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Thu, 31 May 2018 13:29:08 +0000 (15:29 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Thu, 31 May 2018 13:29:08 +0000 (15:29 +0200)
  CC       src/write_sensu.lo
src/write_sensu.c:312:13: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
  int len = strlen(orig_name);
      ~~~   ^~~~~~~~~~~~~~~~~
1 warning generated.

src/write_sensu.c

index bda3327..4c9f42b 100644 (file)
@@ -309,8 +309,8 @@ static int sensu_format_name2(char *ret, int ret_len, const char *hostname,
 
 static void in_place_replace_sensu_name_reserved(char *orig_name) /* {{{ */
 {
-  int len = strlen(orig_name);
-  for (int i = 0; i < len; i++) {
+  size_t len = strlen(orig_name);
+  for (size_t i = 0; i < len; i++) {
     // some plugins like ipmi generate special characters in metric name
     switch (orig_name[i]) {
     case '(':