table plugin: fix build warning
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Wed, 23 May 2018 13:39:23 +0000 (15:39 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Wed, 23 May 2018 13:39:23 +0000 (15:39 +0200)
src/table.c:399:11: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
    if (r >= sizeof(vl.type_instance))
        ~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

src/table.c

index ae26c78..189d605 100644 (file)
@@ -396,7 +396,7 @@ static int tbl_result_dispatch(tbl_t *tbl, tbl_result_t *res, char **fields,
     else
       r = snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s",
                    res->instance_prefix, instances_str);
-    if (r >= sizeof(vl.type_instance))
+    if ((size_t)r >= sizeof(vl.type_instance))
       log_warn("Truncated type instance: %s.", vl.type_instance);
   }