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 2020/04/03 16:02:46 UTC

[mynewt-core] branch master updated: const correctness log name

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 98cb076  const correctness log name
98cb076 is described below

commit 98cb07656920a360f141a38dc32c97f9f2d042e9
Author: Simon Frank <52...@users.noreply.github.com>
AuthorDate: Fri Apr 3 16:01:41 2020 +0200

    const correctness log name
    
    const recently added to struct os_dev name (which is great) but using
    that name with the log module currently gives compile error.
---
 sys/log/full/include/log/log.h | 4 ++--
 sys/log/full/src/log.c         | 2 +-
 sys/log/stub/include/log/log.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/log/full/include/log/log.h b/sys/log/full/include/log/log.h
index 7a1f98f..7ca34c1 100644
--- a/sys/log/full/include/log/log.h
+++ b/sys/log/full/include/log/log.h
@@ -202,7 +202,7 @@ STATS_SECT_END
 #endif
 
 struct log {
-    char *l_name;
+    const char *l_name;
     const struct log_handler *l_log;
     void *l_arg;
     STAILQ_ENTRY(log) l_next;
@@ -248,7 +248,7 @@ uint8_t log_module_register(uint8_t id, const char *name);
 const char *log_module_get_name(uint8_t id);
 
 /* Log functions, manipulate a single log */
-int log_register(char *name, struct log *log, const struct log_handler *,
+int log_register(const char *name, struct log *log, const struct log_handler *,
                  void *arg, uint8_t level);
 
 /**
diff --git a/sys/log/full/src/log.c b/sys/log/full/src/log.c
index 13e4a3d..473618e 100644
--- a/sys/log/full/src/log.c
+++ b/sys/log/full/src/log.c
@@ -371,7 +371,7 @@ log_read_last_hdr(struct log *log, struct log_entry_hdr *out_hdr)
  * Associate an instantiation of a log with the logging infrastructure
  */
 int
-log_register(char *name, struct log *log, const struct log_handler *lh,
+log_register(const char *name, struct log *log, const struct log_handler *lh,
              void *arg, uint8_t level)
 {
     struct log_entry_hdr hdr;
diff --git a/sys/log/stub/include/log/log.h b/sys/log/stub/include/log/log.h
index 2b1a17f..0729c1d 100644
--- a/sys/log/stub/include/log/log.h
+++ b/sys/log/stub/include/log/log.h
@@ -40,7 +40,7 @@ struct log_handler {
 };
 
 static inline int
-log_register(char *name, struct log *log, const struct log_handler *h,
+log_register(const char *name, struct log *log, const struct log_handler *h,
              void *arg, uint8_t level)
 {
     return 0;