Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop b43a21f38 -> afc5fcafb


newtmgr; clean up nmgr API use a bit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/afc5fcaf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/afc5fcaf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/afc5fcaf

Branch: refs/heads/develop
Commit: afc5fcafb45e677a0008bb4aa2426b57ee8a5e7f
Parents: b43a21f
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Sep 20 16:42:12 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Sep 20 16:42:12 2016 -0700

----------------------------------------------------------------------
 libs/newtmgr/include/newtmgr/newtmgr.h |  2 --
 libs/newtmgr/src/newtmgr.c             |  4 ++--
 sys/log/src/log_nmgr.c                 | 10 +++++-----
 sys/stats/src/stats_nmgr.c             | 20 ++++++++++----------
 4 files changed, 17 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/afc5fcaf/libs/newtmgr/include/newtmgr/newtmgr.h
----------------------------------------------------------------------
diff --git a/libs/newtmgr/include/newtmgr/newtmgr.h 
b/libs/newtmgr/include/newtmgr/newtmgr.h
index ab84806..176a006 100644
--- a/libs/newtmgr/include/newtmgr/newtmgr.h
+++ b/libs/newtmgr/include/newtmgr/newtmgr.h
@@ -80,9 +80,7 @@ struct nmgr_jbuf {
     uint16_t njb_off;
     uint16_t njb_end;
 };
-int nmgr_jbuf_init(struct nmgr_jbuf *njb);
 int nmgr_jbuf_setoerr(struct nmgr_jbuf *njb, int errcode);
-extern struct nmgr_jbuf nmgr_task_jbuf;
 
 typedef int (*nmgr_handler_func_t)(struct nmgr_jbuf *);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/afc5fcaf/libs/newtmgr/src/newtmgr.c
----------------------------------------------------------------------
diff --git a/libs/newtmgr/src/newtmgr.c b/libs/newtmgr/src/newtmgr.c
index 2bd88b4..f9d3846 100644
--- a/libs/newtmgr/src/newtmgr.c
+++ b/libs/newtmgr/src/newtmgr.c
@@ -41,7 +41,7 @@ STAILQ_HEAD(, nmgr_group) g_nmgr_group_list =
 
 /* JSON buffer for NMGR task
  */
-struct nmgr_jbuf nmgr_task_jbuf;
+static struct nmgr_jbuf nmgr_task_jbuf;
 
 int
 nmgr_group_list_lock(void)
@@ -259,7 +259,7 @@ err:
     return (rc);
 }
 
-int
+static int
 nmgr_jbuf_init(struct nmgr_jbuf *njb)
 {
     memset(njb, 0, sizeof(*njb));

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/afc5fcaf/sys/log/src/log_nmgr.c
----------------------------------------------------------------------
diff --git a/sys/log/src/log_nmgr.c b/sys/log/src/log_nmgr.c
index b1e90a0..b3e7bb9 100644
--- a/sys/log/src/log_nmgr.c
+++ b/sys/log/src/log_nmgr.c
@@ -263,7 +263,7 @@ log_nmgr_read(struct nmgr_jbuf *njb)
         return rc;
     }
 
-    encoder = (struct json_encoder *) &nmgr_task_jbuf.njb_enc;
+    encoder = (struct json_encoder *) &njb->njb_enc;
 
     json_encode_object_start(encoder);
     json_encode_array_name(encoder, "logs");
@@ -325,7 +325,7 @@ log_nmgr_module_list(struct nmgr_jbuf *njb)
     int module;
     char *str;
 
-    encoder = (struct json_encoder *) &nmgr_task_jbuf.njb_enc;
+    encoder = (struct json_encoder *) &njb->njb_enc;
 
     json_encode_object_start(encoder);
     JSON_VALUE_INT(&jv, NMGR_ERR_EOK);
@@ -366,7 +366,7 @@ log_nmgr_logs_list(struct nmgr_jbuf *njb)
     struct json_encoder *encoder;
     struct log *log;
 
-    encoder = (struct json_encoder *) &nmgr_task_jbuf.njb_enc;
+    encoder = (struct json_encoder *) &njb->njb_enc;
 
     json_encode_object_start(encoder);
     JSON_VALUE_INT(&jv, NMGR_ERR_EOK);
@@ -408,7 +408,7 @@ log_nmgr_level_list(struct nmgr_jbuf *njb)
     int level;
     char *str;
 
-    encoder = (struct json_encoder *) &nmgr_task_jbuf.njb_enc;
+    encoder = (struct json_encoder *) &njb->njb_enc;
 
     json_encode_object_start(encoder);
     JSON_VALUE_INT(&jv, NMGR_ERR_EOK);
@@ -465,7 +465,7 @@ log_nmgr_clear(struct nmgr_jbuf *njb)
         }
     }
 
-    encoder = (struct json_encoder *) &nmgr_task_jbuf.njb_enc;
+    encoder = (struct json_encoder *) &njb->njb_enc;
 
     json_encode_object_start(encoder);
     json_encode_object_finish(encoder);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/afc5fcaf/sys/stats/src/stats_nmgr.c
----------------------------------------------------------------------
diff --git a/sys/stats/src/stats_nmgr.c b/sys/stats/src/stats_nmgr.c
index c7b8dff..c8d62c5 100644
--- a/sys/stats/src/stats_nmgr.c
+++ b/sys/stats/src/stats_nmgr.c
@@ -124,14 +124,14 @@ stats_nmgr_read(struct nmgr_jbuf *njb)
 
     json_encode_object_start(&njb->njb_enc);
     JSON_VALUE_INT(&jv, NMGR_ERR_EOK);
-    json_encode_object_entry(&nmgr_task_jbuf.njb_enc, "rc", &jv);
+    json_encode_object_entry(&njb->njb_enc, "rc", &jv);
     JSON_VALUE_STRINGN(&jv, stats_name, strlen(stats_name));
-    json_encode_object_entry(&nmgr_task_jbuf.njb_enc, "name", &jv);
+    json_encode_object_entry(&njb->njb_enc, "name", &jv);
     JSON_VALUE_STRINGN(&jv, "sys", sizeof("sys")-1);
-    json_encode_object_entry(&nmgr_task_jbuf.njb_enc, "group", &jv);
-    json_encode_object_key(&nmgr_task_jbuf.njb_enc, "fields");
-    json_encode_object_start(&nmgr_task_jbuf.njb_enc);
-    stats_walk(hdr, stats_nmgr_walk_func, &nmgr_task_jbuf.njb_enc);
+    json_encode_object_entry(&njb->njb_enc, "group", &jv);
+    json_encode_object_key(&njb->njb_enc, "fields");
+    json_encode_object_start(&njb->njb_enc);
+    stats_walk(hdr, stats_nmgr_walk_func, &njb->njb_enc);
     json_encode_object_finish(&njb->njb_enc);
     json_encode_object_finish(&njb->njb_enc);
 
@@ -149,10 +149,10 @@ stats_nmgr_list(struct nmgr_jbuf *njb)
 
     json_encode_object_start(&njb->njb_enc);
     JSON_VALUE_INT(&jv, NMGR_ERR_EOK);
-    json_encode_object_entry(&nmgr_task_jbuf.njb_enc, "rc", &jv);
-    json_encode_array_name(&nmgr_task_jbuf.njb_enc, "stat_list");
-    json_encode_array_start(&nmgr_task_jbuf.njb_enc);
-    stats_group_walk(stats_nmgr_encode_name, &nmgr_task_jbuf.njb_enc);
+    json_encode_object_entry(&njb->njb_enc, "rc", &jv);
+    json_encode_array_name(&njb->njb_enc, "stat_list");
+    json_encode_array_start(&njb->njb_enc);
+    stats_group_walk(stats_nmgr_encode_name, &njb->njb_enc);
     json_encode_array_finish(&njb->njb_enc);
     json_encode_object_finish(&njb->njb_enc);
 

Reply via email to