[PATCH 4/6] jshn.c: use size_t instead of int
Sergey Ponomarev
stokito at gmail.com
Tue Feb 23 08:36:56 EST 2021
This fixes Clang-Tidy warnings
Signed-off-by: Sergey Ponomarev <stokito at gmail.com>
---
jshn.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/jshn.c b/jshn.c
index 7a2f935..43a82e0 100644
--- a/jshn.c
+++ b/jshn.c
@@ -36,7 +36,7 @@ static struct avl_tree env_vars;
static struct blob_buf b = { 0 };
static const char *var_prefix = "";
-static int var_prefix_len = 0;
+static size_t var_prefix_len = 0;
static int add_json_element(const char *key, json_object *obj);
@@ -62,11 +62,11 @@ static int add_json_object(json_object *obj)
static int add_json_array(struct array_list *a)
{
char seq[12];
- int i, len;
+ size_t i, len;
int ret;
for (i = 0, len = array_list_length(a); i < len; i++) {
- snprintf(seq, sizeof(seq), "%d", i);
+ snprintf(seq, sizeof(seq), "%zu", i);
ret = add_json_element(seq, array_list_get_idx(a, i));
if (ret)
return ret;
@@ -78,7 +78,7 @@ static int add_json_array(struct array_list *a)
static void add_json_string(const char *str)
{
char *ptr = (char *) str;
- int len;
+ size_t len;
char *c;
while ((c = strchr(ptr, '\'')) != NULL) {
--
2.27.0
More information about the openwrt-devel
mailing list