mkiiskila commented on a change in pull request #1339: sys/config: Add API to 
use FCB as generic key-value storage
URL: https://github.com/apache/mynewt-core/pull/1339#discussion_r211565343
 
 

 ##########
 File path: sys/config/src/config_fcb.c
 ##########
 @@ -255,14 +262,84 @@ conf_fcb_append(struct conf_fcb *cf, char *buf, int len)
     if (rc) {
         return OS_EINVAL;
     }
-    fcb_append_finish(&cf->cf_fcb, &loc);
+    fcb_append_finish(fcb, &loc);
     return OS_OK;
 }
 
 static int
 conf_fcb_save(struct conf_store *cs, const char *name, const char *value)
 {
     struct conf_fcb *cf = (struct conf_fcb *)cs;
+
+    return conf_fcb_kv_save(&cf->cf_fcb, name, value);
+}
+
+void
+conf_fcb_compress(struct conf_fcb *cf,
+                  int (*copy_or_not)(const char *name, const char *val,
+                                     void *cn_arg),
+                  void *cn_arg)
+{
+    return conf_fcb_compress_internal(&cf->cf_fcb, copy_or_not, cn_arg);
+}
+
+static int
+conf_kv_load_cb(struct fcb_entry *loc, void *arg)
+{
+    struct conf_kv_load_cb_arg *cb_arg = arg;
+    char buf[CONF_MAX_NAME_LEN + CONF_MAX_VAL_LEN + 32];
 
 Review comment:
   FCB does not use extra space. config uses key=value'\0'. So therefore 2 
extra. I don't think we check CONF_MAX_NAME_LEN nor CONF_MAX_VAL_LEN separately 
either; only together. Those numbers are there just to guide the user. 
sys/config tries to accomodate what it can.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to