]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: fix build problem with ancient json-c versions 8985/head
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 12 Jul 2021 12:29:06 +0000 (09:29 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Thu, 16 Sep 2021 15:26:48 +0000 (12:26 -0300)
Some CI VMs are using really old versions of json-c (pre 2013 [1])
that expect filenames to be passed as "char *" instead of "const char *".

Add some explicit casts to fix the resulting compiler errors on those
VMs (passing "char *" when the API expects "const char *" is fine).
Hopefully this commit should be reverted once the CI is updated to use
newer versions of json-c.

[1] https://github.com/json-c/json-c/commit/20e4708c

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ospf6d/ospf6_gr.c

index c1d345d5416d0c3fdfae7cd376a9df16b0897022..40893ed998245059e0459ba45f49c68ff0109315 100644 (file)
@@ -478,7 +478,7 @@ static void ospf6_gr_nvm_update(struct ospf6 *ospf6)
 
        inst_name = ospf6->name ? ospf6->name : VRF_DEFAULT_NAME;
 
-       json = json_object_from_file(OSPF6D_GR_STATE);
+       json = json_object_from_file((char *)OSPF6D_GR_STATE);
        if (json == NULL)
                json = json_object_new_object();
 
@@ -506,7 +506,8 @@ static void ospf6_gr_nvm_update(struct ospf6 *ospf6)
        json_object_int_add(json_instance, "timestamp",
                            time(NULL) + ospf6->gr_info.grace_period);
 
-       json_object_to_file_ext(OSPF6D_GR_STATE, json, JSON_C_TO_STRING_PRETTY);
+       json_object_to_file_ext((char *)OSPF6D_GR_STATE, json,
+                               JSON_C_TO_STRING_PRETTY);
        json_object_free(json);
 }
 
@@ -522,7 +523,7 @@ static void ospf6_gr_nvm_delete(struct ospf6 *ospf6)
 
        inst_name = ospf6->name ? ospf6->name : VRF_DEFAULT_NAME;
 
-       json = json_object_from_file(OSPF6D_GR_STATE);
+       json = json_object_from_file((char *)OSPF6D_GR_STATE);
        if (json == NULL)
                json = json_object_new_object();
 
@@ -534,7 +535,8 @@ static void ospf6_gr_nvm_delete(struct ospf6 *ospf6)
 
        json_object_object_del(json_instances, inst_name);
 
-       json_object_to_file_ext(OSPF6D_GR_STATE, json, JSON_C_TO_STRING_PRETTY);
+       json_object_to_file_ext((char *)OSPF6D_GR_STATE, json,
+                               JSON_C_TO_STRING_PRETTY);
        json_object_free(json);
 }
 
@@ -553,7 +555,7 @@ void ospf6_gr_nvm_read(struct ospf6 *ospf6)
 
        inst_name = ospf6->name ? ospf6->name : VRF_DEFAULT_NAME;
 
-       json = json_object_from_file(OSPF6D_GR_STATE);
+       json = json_object_from_file((char *)OSPF6D_GR_STATE);
        if (json == NULL)
                json = json_object_new_object();
 
@@ -597,7 +599,8 @@ void ospf6_gr_nvm_read(struct ospf6 *ospf6)
 
        json_object_object_del(json_instances, inst_name);
 
-       json_object_to_file_ext(OSPF6D_GR_STATE, json, JSON_C_TO_STRING_PRETTY);
+       json_object_to_file_ext((char *)OSPF6D_GR_STATE, json,
+                               JSON_C_TO_STRING_PRETTY);
        json_object_free(json);
 }