Max has uploaded this change for review. ( https://gerrit.osmocom.org/12705


Change subject: Drop unused parameter
......................................................................

Drop unused parameter

value_node_add() ignores it's first argument - let's drop it to make
code more compact.

Change-Id: I17c2fed4049e1c83307feda001aefc006dfbe6a3
---
M src/osysmon_ctrl.c
M src/osysmon_file.c
M src/osysmon_main.c
M src/osysmon_rtnl.c
M src/osysmon_sysinfo.c
M src/value_node.c
M src/value_node.h
7 files changed, 21 insertions(+), 21 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sysmon refs/changes/05/12705/1

diff --git a/src/osysmon_ctrl.c b/src/osysmon_ctrl.c
index 25c2b4c..4aa7a1d 100644
--- a/src/osysmon_ctrl.c
+++ b/src/osysmon_ctrl.c
@@ -266,7 +266,7 @@
 static int ctrl_client_poll(struct ctrl_client *cc, struct value_node *parent)
 {
        struct ctrl_client_get_var *ccgv;
-       struct value_node *vn_clnt = value_node_add(parent, parent, 
cc->cfg.name, NULL);
+       struct value_node *vn_clnt = value_node_add(parent, cc->cfg.name, NULL);

        /* attempt to re-connect */
        if (!cc->sch)
@@ -288,7 +288,7 @@
                        return 0;
                }

-               value_node_add(vn_clnt, vn_clnt, ccgv->cfg.name, value);
+               value_node_add(vn_clnt, ccgv->cfg.name, value);
                free(value); /* no talloc, this is from sscanf() */
        }
        return 0;
diff --git a/src/osysmon_file.c b/src/osysmon_file.c
index 3a228fa..1dec3db 100644
--- a/src/osysmon_file.c
+++ b/src/osysmon_file.c
@@ -82,19 +82,19 @@

        f = fopen(of->cfg.path, "r");
        if (!f) {
-               value_node_add(parent, parent, of->cfg.name, "<NOTFOUND>");
+               value_node_add(parent, of->cfg.name, "<NOTFOUND>");
                return;
        }
        s = fgets(buf, sizeof(buf), f);
        fclose(f);
        if (s == NULL) {
-               value_node_add(parent, parent, of->cfg.name, "<EMPTY>");
+               value_node_add(parent, of->cfg.name, "<EMPTY>");
                return;
        }
        buf[sizeof(buf)-1] = '\0';
        while ((nl = strrchr(buf, '\n')))
                *nl = '\0';
-       value_node_add(parent, parent, of->cfg.name, buf);
+       value_node_add(parent, of->cfg.name, buf);
 }

 /***********************************************************************
@@ -153,7 +153,7 @@
        struct value_node *vn_file;
        struct osysmon_file *of;

-       vn_file = value_node_add(parent, parent, "file", NULL);
+       vn_file = value_node_add(parent, "file", NULL);

        llist_for_each_entry(of, &g_oss->files, list)
                osysmon_file_read(of, vn_file);
diff --git a/src/osysmon_main.c b/src/osysmon_main.c
index 486ee8f..82df61f 100644
--- a/src/osysmon_main.c
+++ b/src/osysmon_main.c
@@ -229,7 +229,7 @@
        }

        while (1) {
-               struct value_node *root = value_node_add(g_oss, NULL, "root", 
NULL);
+               struct value_node *root = value_node_add(NULL, "root", NULL);
                osysmon_sysinfo_poll(root);
                osysmon_ctrl_poll(root);
                osysmon_rtnl_poll(root);
diff --git a/src/osysmon_rtnl.c b/src/osysmon_rtnl.c
index 94d8bf9..9fd4251 100644
--- a/src/osysmon_rtnl.c
+++ b/src/osysmon_rtnl.c
@@ -216,17 +216,17 @@
                uint8_t *hwaddr = mnl_attr_get_payload(tb[IFLA_ADDRESS]);
                snprintf(buf, sizeof(buf), "%02x:%02x:%02x:%02x:%02x:%02x",
                         hwaddr[0], hwaddr[1], hwaddr[2], hwaddr[3], hwaddr[4], 
hwaddr[5]);
-               value_node_add(vn_if, vn_if, "hwaddr", buf);
+               value_node_add(vn_if, "hwaddr", buf);
        }
        if (ifm->ifi_flags & IFF_RUNNING)
-               value_node_add(vn_if, vn_if, "running", "true");
+               value_node_add(vn_if, "running", "true");
        else
-               value_node_add(vn_if, vn_if, "running", "false");
+               value_node_add(vn_if, "running", "false");

        if (ifm->ifi_flags & IFF_UP)
-               value_node_add(vn_if, vn_if, "up", "true");
+               value_node_add(vn_if, "up", "true");
        else
-               value_node_add(vn_if, vn_if, "up", "false");
+               value_node_add(vn_if, "up", "false");

        return MNL_CB_OK;
 }
@@ -313,7 +313,7 @@
                struct in_addr *addr = mnl_attr_get_payload(tb[IFA_ADDRESS]);
                char out[INET_ADDRSTRLEN+32];
                snprintf(out, sizeof(out), "%s/%u", inet_ntoa(*addr), 
ifa->ifa_prefixlen);
-               value_node_add(vn_if, vn_if, "ip", out);
+               value_node_add(vn_if, "ip", out);
        }

        return MNL_CB_OK;
@@ -404,7 +404,7 @@
        if (!g_oss->rcs)
                g_oss->rcs = rtnl_init(NULL);

-       vn_net = value_node_add(parent, parent, "netdev", NULL);
+       vn_net = value_node_add(parent, "netdev", NULL);

        if (!g_oss->rcs)
                return -1;
diff --git a/src/osysmon_sysinfo.c b/src/osysmon_sysinfo.c
index 50616bc..85d9ee9 100644
--- a/src/osysmon_sysinfo.c
+++ b/src/osysmon_sysinfo.c
@@ -63,7 +63,7 @@
        char buf[32];
        int rc;

-       vn_sysinfo = value_node_add(parent, parent, "sysinfo", NULL);
+       vn_sysinfo = value_node_add(parent, "sysinfo", NULL);

        rc = sysinfo(&si);
        if (rc < 0)
@@ -72,17 +72,17 @@
        /* Load Factor 1/5/15min */
        snprintf(buf, sizeof(buf), "%.2f/%.2f/%.2f",
                 loadfac(si.loads[0]), loadfac(si.loads[1]), 
loadfac(si.loads[2]));
-       value_node_add(vn_sysinfo, vn_sysinfo, "load", buf);
+       value_node_add(vn_sysinfo, "load", buf);

        /* RAM information (total/free/sared) in megabytes */
        snprintf(buf, sizeof(buf), "%lu/%lu/%lu",
                to_mbytes(si.totalram), to_mbytes(si.freeram), 
to_mbytes(si.sharedram));
-       value_node_add(vn_sysinfo, vn_sysinfo, "ram", buf);
+       value_node_add(vn_sysinfo, "ram", buf);

        /* uptime in days/hours/minutes/seconds */
        snprintf(buf, sizeof(buf), "%lud %02lu:%02lu:%02lu", to_days(si.uptime),
                 to_hours(si.uptime), to_minutes(si.uptime), 
to_seconds(si.uptime));
-       value_node_add(vn_sysinfo, vn_sysinfo, "uptime", buf);
+       value_node_add(vn_sysinfo, "uptime", buf);

        return 0;
 }
diff --git a/src/value_node.c b/src/value_node.c
index 38fb5c7..9143451 100644
--- a/src/value_node.c
+++ b/src/value_node.c
@@ -27,7 +27,7 @@

 #include "value_node.h"

-struct value_node *value_node_add(void *ctx, struct value_node *parent,
+struct value_node *value_node_add(struct value_node *parent,
                                  const char *name, const char *value)
 {
        struct value_node *vn = talloc_zero(parent, struct value_node);
@@ -67,7 +67,7 @@
        struct value_node *vn;
        vn = value_node_find(parent, name);
        if (!vn)
-               vn = value_node_add(parent, parent, name, NULL);
+               vn = value_node_add(parent, name, NULL);
        return vn;
 }

diff --git a/src/value_node.h b/src/value_node.h
index b8183ba..84c3d7b 100644
--- a/src/value_node.h
+++ b/src/value_node.h
@@ -16,7 +16,7 @@
        struct llist_head children;
 };

-struct value_node *value_node_add(void *ctx, struct value_node *parent,
+struct value_node *value_node_add(struct value_node *parent,
                                  const char *name, const char *value);
 struct value_node *value_node_find(struct value_node *parent, const char 
*name);
 struct value_node *value_node_find_by_idx(struct value_node *parent, int idx);

--
To view, visit https://gerrit.osmocom.org/12705
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sysmon
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I17c2fed4049e1c83307feda001aefc006dfbe6a3
Gerrit-Change-Number: 12705
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msur...@sysmocom.de>

Reply via email to