You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/04/18 20:04:21 UTC

[03/14] incubator-mynewt-core git commit: sys/config; convert some of the arguments to conf_save_one() to be const.

sys/config; convert some of the arguments to conf_save_one() to be const.


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/782dc454
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/782dc454
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/782dc454

Branch: refs/heads/develop
Commit: 782dc45460a38cf686e72bc75f686f3a1b0762e2
Parents: c56aca4
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Apr 13 15:53:26 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Apr 18 10:45:51 2016 -0700

----------------------------------------------------------------------
 sys/config/include/config/config.h | 3 ++-
 sys/config/src/config_fcb.c        | 8 ++++----
 sys/config/src/config_file.c       | 8 ++++----
 sys/config/src/config_line.c       | 4 ++--
 sys/config/src/config_priv.h       | 8 ++++----
 sys/config/src/config_store.c      | 2 +-
 6 files changed, 17 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/782dc454/sys/config/include/config/config.h
----------------------------------------------------------------------
diff --git a/sys/config/include/config/config.h b/sys/config/include/config/config.h
index a7956da..5ddf83a 100644
--- a/sys/config/include/config/config.h
+++ b/sys/config/include/config/config.h
@@ -57,7 +57,7 @@ int conf_register(struct conf_handler *);
 int conf_load(void);
 
 int conf_save(void);
-int conf_save_one(struct conf_handler *, char *name, char *var);
+int conf_save_one(const struct conf_handler *, const char *name, char *var);
 
 /*
   XXXX for later
@@ -74,6 +74,7 @@ int conf_value_from_str(char *val_str, enum conf_type type, void *vp,
 int conf_bytes_from_str(char *val_str, void *vp, int *len);
 char *conf_str_from_value(enum conf_type type, void *vp, char *buf,
   int buf_len);
+#define CONF_STR_FROM_BYTES_LEN(len) (((len) * 4 / 3) + 4)
 char *conf_str_from_bytes(void *vp, int vp_len, char *buf, int buf_len);
 
 #define CONF_VALUE_SET(str, type, val)                                  \

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/782dc454/sys/config/src/config_fcb.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_fcb.c b/sys/config/src/config_fcb.c
index f872894..208eee1 100644
--- a/sys/config/src/config_fcb.c
+++ b/sys/config/src/config_fcb.c
@@ -36,8 +36,8 @@ struct conf_fcb_load_cb_arg {
 
 static int conf_fcb_load(struct conf_store *, load_cb cb, void *cb_arg);
 static int conf_fcb_save_start(struct conf_store *);
-static int conf_fcb_save(struct conf_store *, struct conf_handler *,
-  char *name, char *value);
+static int conf_fcb_save(struct conf_store *, const struct conf_handler *,
+  const char *name, const char *value);
 static int conf_fcb_save_end(struct conf_store *);
 
 static struct conf_store_itf conf_fcb_itf = {
@@ -251,8 +251,8 @@ conf_fcb_append(struct conf_fcb *cf, char *buf, int len)
 }
 
 static int
-conf_fcb_save(struct conf_store *cs, struct conf_handler *ch,
-  char *name, char *value)
+conf_fcb_save(struct conf_store *cs, const struct conf_handler *ch,
+  const char *name, const char *value)
 {
     struct conf_fcb *cf = (struct conf_fcb *)cs;
     char buf[CONF_MAX_NAME_LEN + CONF_MAX_VAL_LEN + 32];

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/782dc454/sys/config/src/config_file.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_file.c b/sys/config/src/config_file.c
index ff627d0..402038c 100644
--- a/sys/config/src/config_file.c
+++ b/sys/config/src/config_file.c
@@ -31,8 +31,8 @@
 
 static int conf_file_load(struct conf_store *, load_cb cb, void *cb_arg);
 static int conf_file_save_start(struct conf_store *);
-static int conf_file_save(struct conf_store *, struct conf_handler *ch,
-  char *name, char *value);
+static int conf_file_save(struct conf_store *, const struct conf_handler *ch,
+  const char *name, const char *value);
 static int conf_file_save_end(struct conf_store *);
 
 static struct conf_store_itf conf_file_itf = {
@@ -178,8 +178,8 @@ conf_file_save_start(struct conf_store *cs)
 }
 
 static int
-conf_file_save(struct conf_store *cs, struct conf_handler *ch,
-  char *name, char *value)
+conf_file_save(struct conf_store *cs, const struct conf_handler *ch,
+  const char *name, const char *value)
 {
     struct conf_file *cf = (struct conf_file *)cs;
     struct fs_file *file;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/782dc454/sys/config/src/config_line.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_line.c b/sys/config/src/config_line.c
index 7a18c9f..631e470 100644
--- a/sys/config/src/config_line.c
+++ b/sys/config/src/config_line.c
@@ -72,8 +72,8 @@ conf_line_parse(char *buf, char **namep, char **valp)
 }
 
 int
-conf_line_make(char *dst, int dlen, struct conf_handler *ch, char *name,
-  char *value)
+conf_line_make(char *dst, int dlen, const struct conf_handler *ch,
+  const char *name, const char *value)
 {
     int clen;
     int nlen;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/782dc454/sys/config/src/config_priv.h
----------------------------------------------------------------------
diff --git a/sys/config/src/config_priv.h b/sys/config/src/config_priv.h
index 7358133..6d5ea1a 100644
--- a/sys/config/src/config_priv.h
+++ b/sys/config/src/config_priv.h
@@ -28,8 +28,8 @@ int conf_json_line(struct json_buffer *jb, char *name, int nlen, char *value,
   int vlen);
 
 int conf_line_parse(char *buf, char **namep, char **valp);
-int conf_line_make(char *dst, int dlen, struct conf_handler *ch, char *name,
-  char *val);
+int conf_line_make(char *dst, int dlen, const struct conf_handler *ch,
+  const char *name, const char *val);
 
 /*
  * API for config storage.
@@ -38,8 +38,8 @@ typedef void (*load_cb)(char *name, char *val, void *cb_arg);
 struct conf_store_itf {
     int (*csi_load)(struct conf_store *cs, load_cb cb, void *cb_arg);
     int (*csi_save_start)(struct conf_store *cs);
-    int (*csi_save)(struct conf_store *cs, struct conf_handler *ch, char *name,
-      char *value);
+    int (*csi_save)(struct conf_store *cs, const struct conf_handler *ch,
+      const char *name, const char *value);
     int (*csi_save_end)(struct conf_store *cs);
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/782dc454/sys/config/src/config_store.c
----------------------------------------------------------------------
diff --git a/sys/config/src/config_store.c b/sys/config/src/config_store.c
index 887dfaa..728581a 100644
--- a/sys/config/src/config_store.c
+++ b/sys/config/src/config_store.c
@@ -78,7 +78,7 @@ conf_load(void)
  * Append a sigle value to persisted config.
  */
 int
-conf_save_one(struct conf_handler *ch, char *name, char *value)
+conf_save_one(const struct conf_handler *ch, const char *name, char *value)
 {
     struct conf_store *cs;