You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/02/18 00:47:59 UTC

[5/6] incubator-mynewt-larva git commit: (MYNEWT-121) sys/stats - issues with name maps.

(MYNEWT-121) sys/stats - issues with name maps.


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

Branch: refs/heads/develop
Commit: 8e1aef719d531cff61a7b3722e3bbd160c3ef8d8
Parents: e422f61
Author: Christopher Collins <cc...@gmail.com>
Authored: Wed Feb 17 15:00:42 2016 -0800
Committer: Christopher Collins <cc...@gmail.com>
Committed: Wed Feb 17 15:11:16 2016 -0800

----------------------------------------------------------------------
 sys/stats/include/stats/stats.h | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/8e1aef71/sys/stats/include/stats/stats.h
----------------------------------------------------------------------
diff --git a/sys/stats/include/stats/stats.h b/sys/stats/include/stats/stats.h
index 5fe0e33..acc27a0 100644
--- a/sys/stats/include/stats/stats.h
+++ b/sys/stats/include/stats/stats.h
@@ -51,7 +51,7 @@ STATS_SECT_DECL(__name) {                   \
 #define STATS_SECT_VAR(__var) \
     s##__var
 
-#define STATS_HDR(__varname) &(__varname).s_hdr
+#define STATS_HDR(__sectname) &(__sectname).s_hdr
 
 #define STATS_SIZE_16 (sizeof(uint16_t))
 #define STATS_SIZE_32 (sizeof(uint32_t))
@@ -62,31 +62,32 @@ STATS_SECT_DECL(__name) {                   \
 #define STATS_SECT_ENTRY32(__var) uint32_t STATS_SECT_VAR(__var);
 #define STATS_SECT_ENTRY64(__var) uint64_t STATS_SECT_VAR(__var);
 
-#define STATS_SIZE_INIT_PARMS(__varname, __size)                            \
+#define STATS_SIZE_INIT_PARMS(__sectvarname, __size)                        \
     (__size),                                                               \
-    ((sizeof (__varname)) - sizeof (struct stats_hdr)) / (__size)
+    ((sizeof (__sectvarname)) - sizeof (struct stats_hdr)) / (__size)
 
-#define STATS_INC(__varname, __var) \
-    ((__varname).STATS_SECT_VAR(__var)++)
+#define STATS_INC(__sectvarname, __var)        \
+    ((__sectvarname).STATS_SECT_VAR(__var)++)
 
-#define STATS_INCN(__varname, __var, __n) \
-    ((__varname).STATS_SECT_VAR(__var) += (__n))
+#define STATS_INCN(__sectvarname, __var, __n)  \
+    ((__sectvarname).STATS_SECT_VAR(__var) += (__n))
 
 #ifdef STATS_NAME_ENABLE
 
-#define STATS_NAME_MAP_NAME(__name) g_stats_map_ ## __name
+#define STATS_NAME_MAP_NAME(__sectname) g_stats_map_ ## __sectname
 
-#define STATS_NAME_START(__name)                      \
-struct stats_name_map STATS_NAME_MAP_NAME(__name)[] = {
+#define STATS_NAME_START(__sectname)                                        \
+struct stats_name_map STATS_NAME_MAP_NAME(__sectname)[] = {
 
-#define STATS_NAME(__name, __entry)                   \
-    { &STATS_SECT_NAME(__name).(__entry), #__entry },
+#define STATS_NAME(__sectname, __entry)                                     \
+    { &((STATS_SECT_DECL(__sectname) *) NULL)->STATS_SECT_VAR(__entry),     \
+      #__entry },
 
-#define STATS_NAME_END(__name)                        \
+#define STATS_NAME_END(__sectname)                                          \
 };
 
-#define STATS_NAME_INIT_PARMS(__name)                                    \
-    &(STATS_NAME_MAP_NAME(__name)[0]),                                   \
+#define STATS_NAME_INIT_PARMS(__name)                                       \
+    &(STATS_NAME_MAP_NAME(__name)[0]),                                      \
     (sizeof(STATS_NAME_MAP_NAME(__name)) / sizeof(struct stats_name_map))
 
 #else /* STATS_NAME_ENABLE */