From f431bf9c4826af08d1186b52970b2d3ec94b523f Mon Sep 17 00:00:00 2001
From: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
Date: Sun, 5 Sep 2021 13:16:00 +0100
Subject: [PATCH] Align with latest bbf changes

---
 src/Makefile    |  2 +-
 src/datamodel.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 72570a1..dc54cee 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,7 +8,7 @@ LIB = libswmodd.so
 OBJS = swmod.o swmod_host.o swmod_opkg.o swmod_uci.o tools.o
 LIB_OBJS = datamodel.o
 
-PROG_CFLAGS = $(CFLAGS) -fstrict-aliasing -Wall -fPIC
+PROG_CFLAGS = $(CFLAGS) -fstrict-aliasing -Wall -Werror -fPIC
 PROG_LDFLAGS = $(LDFLAGS) -luci -lubus -lubox -lblobmsg_json -luuid
 
 ifeq ($(SWMOD_LXC),yes)
diff --git a/src/datamodel.c b/src/datamodel.c
index 2d7b2a9..43fb0d2 100644
--- a/src/datamodel.c
+++ b/src/datamodel.c
@@ -40,12 +40,12 @@ static int get_du_linker(char *refparam, struct dmctx *dmctx, void *data, char *
 static int browseSoftwareModulesExecEnvInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
 {
 	json_object *res = NULL, *du_obj = NULL, *arrobj = NULL;
-	char *inst = NULL, *max_inst = NULL;
+	char *inst = NULL;
 	int id = 0, env = 0;
 
 	dmubus_call("swmodules", "environment", UBUS_ARGS{}, 0, &res);
 	dmjson_foreach_obj_in_array(res, arrobj, du_obj, env, 1, "environment") {
-		inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
+		inst = handle_instance_without_section(dmctx, parent_node, ++id);
 		if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)du_obj, inst) == DM_STOP)
 			break;
 	}
@@ -55,12 +55,12 @@ static int browseSoftwareModulesExecEnvInst(struct dmctx *dmctx, DMNODE *parent_
 static int browseSoftwareModulesDeploymentUnitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
 {
 	json_object *res = NULL, *du_obj = NULL, *arrobj = NULL;
-	char *inst = NULL, *max_inst = NULL;
+	char *inst = NULL;
 	int id = 0, du = 0;
 
 	dmubus_call("swmodules", "du_list", UBUS_ARGS{}, 0, &res);
 	dmjson_foreach_obj_in_array(res, arrobj, du_obj, du, 1, "deployment_unit") {
-		inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
+		inst = handle_instance_without_section(dmctx, parent_node, ++id);
 		if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)du_obj, inst) == DM_STOP)
 			break;
 	}
@@ -70,12 +70,12 @@ static int browseSoftwareModulesDeploymentUnitInst(struct dmctx *dmctx, DMNODE *
 static int browseSoftwareModulesExecutionUnitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
 {
 	json_object *res = NULL, *du_obj = NULL, *arrobj = NULL;
-	char *inst = NULL, *max_inst = NULL;
+	char *inst = NULL;
 	int id = 0, eu = 0;
 
 	dmubus_call("swmodules", "eu_list", UBUS_ARGS{}, 0, &res);
 	dmjson_foreach_obj_in_array(res, arrobj, du_obj, eu, 1, "execution_unit") {
-		inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
+		inst = handle_instance_without_section(dmctx, parent_node, ++id);
 		if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)du_obj, inst) == DM_STOP)
 			break;
 	}
-- 
GitLab