You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2018/11/08 18:25:08 UTC

[mynewt-core] 01/02: sys/stats: Add missing consts

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit dcb5dba2885cddc22916f30a21e7bb860790a195
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Thu Nov 8 11:44:08 2018 +0100

    sys/stats: Add missing consts
---
 sys/stats/full/include/stats/stats.h | 8 ++++----
 sys/stats/full/src/stats.c           | 6 +++---
 sys/stats/stub/include/stats/stats.h | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sys/stats/full/include/stats/stats.h b/sys/stats/full/include/stats/stats.h
index 1763b6a..f5fa41a 100644
--- a/sys/stats/full/include/stats/stats.h
+++ b/sys/stats/full/include/stats/stats.h
@@ -33,7 +33,7 @@ struct stats_name_map {
 } __attribute__((packed));
 
 struct stats_hdr {
-    char *s_name;
+    const char *s_name;
     uint8_t s_size;
     uint8_t s_cnt;
     uint16_t s_pad1;
@@ -115,10 +115,10 @@ const struct stats_name_map STATS_NAME_MAP_NAME(__sectname)[] = {
 
 int stats_init(struct stats_hdr *shdr, uint8_t size, uint8_t cnt,
     const struct stats_name_map *map, uint8_t map_cnt);
-int stats_register(char *name, struct stats_hdr *shdr);
+int stats_register(const char *name, struct stats_hdr *shdr);
 int stats_init_and_reg(struct stats_hdr *shdr, uint8_t size, uint8_t cnt,
                        const struct stats_name_map *map, uint8_t map_cnt,
-                       char *name);
+                       const char *name);
 void stats_reset(struct stats_hdr *shdr);
 
 typedef int (*stats_walk_func_t)(struct stats_hdr *, void *, char *,
@@ -128,7 +128,7 @@ int stats_walk(struct stats_hdr *, stats_walk_func_t, void *);
 typedef int (*stats_group_walk_func_t)(struct stats_hdr *, void *);
 int stats_group_walk(stats_group_walk_func_t, void *);
 
-struct stats_hdr *stats_group_find(char *name);
+struct stats_hdr *stats_group_find(const char *name);
 
 /* Private */
 #if MYNEWT_VAL(STATS_NEWTMGR)
diff --git a/sys/stats/full/src/stats.c b/sys/stats/full/src/stats.c
index efff11e..2d601a9 100644
--- a/sys/stats/full/src/stats.c
+++ b/sys/stats/full/src/stats.c
@@ -263,7 +263,7 @@ err:
  * @return statistic structure if found, NULL if not found.
  */
 struct stats_hdr *
-stats_group_find(char *name)
+stats_group_find(const char *name)
 {
     struct stats_hdr *cur;
 
@@ -289,7 +289,7 @@ stats_group_find(char *name)
  * @return 0 on success, non-zero error code on failure.
  */
 int
-stats_register(char *name, struct stats_hdr *shdr)
+stats_register(const char *name, struct stats_hdr *shdr)
 {
     struct stats_hdr *cur;
     int rc;
@@ -332,7 +332,7 @@ err:
 int
 stats_init_and_reg(struct stats_hdr *shdr, uint8_t size, uint8_t cnt,
                    const struct stats_name_map *map, uint8_t map_cnt,
-                   char *name)
+                   const char *name)
 {
     int rc;
 
diff --git a/sys/stats/stub/include/stats/stats.h b/sys/stats/stub/include/stats/stats.h
index f91a63e..dc469a3 100644
--- a/sys/stats/stub/include/stats/stats.h
+++ b/sys/stats/stub/include/stats/stats.h
@@ -32,7 +32,7 @@ struct stats_name_map {
 } __attribute__((packed));
 
 struct stats_hdr {
-    char *s_name;
+    const char *s_name;
     uint8_t s_size;
     uint8_t s_cnt;
     uint16_t s_pad1;