#88 new bson_merge3 with supporting of 'fpaths'
authoradam <adamansky@gmail.com>
Wed, 31 Jul 2013 16:07:17 +0000 (23:07 +0700)
committeradam <adamansky@gmail.com>
Wed, 31 Jul 2013 16:07:17 +0000 (23:07 +0700)
tcejdb/bson.c
tcejdb/bson.h

index b277e0a..73a0215 100644 (file)
@@ -1445,7 +1445,6 @@ typedef struct {
     const void *bsdata2; //bsdata to merge with
     int nstack; //nested object stack pos
     int matched; //number of matched merge fields
-    bson_bool_t overwrite; //overwrite bson1 fields with merged
 } _BSON_MERGE3_CTX;
 
 static bson_visitor_cmd_t _bson_merge3_visitor(const char *ipath, int ipathlen, const char *key, int keylen,
@@ -1524,7 +1523,7 @@ static bson_visitor_cmd_t _bson_merge3_visitor(const char *ipath, int ipathlen,
 
 
 //merge with fpath support
-int bson_merge3(const void *bsdata1, const void *bsdata2, bson_bool_t overwrite, bson *out) {
+int bson_merge3(const void *bsdata1, const void *bsdata2, bson *out) {
     assert(bsdata1 && bsdata2 && out);
     bson_iterator it1, it2;
     bson_type bt;
@@ -1537,8 +1536,7 @@ int bson_merge3(const void *bsdata1, const void *bsdata2, bson_bool_t overwrite,
         .mfields = mfields,
         .bsdata2 = bsdata2,
         .matched = 0,
-        .nstack = 0,
-        .overwrite = overwrite
+        .nstack = 0
     };
     //collect fpaths of active bsons
     while ((bt = bson_iterator_next(&it2)) != BSON_EOO) {
index 86d7a66..acdbc77 100644 (file)
@@ -1105,12 +1105,11 @@ EJDB_EXPORT int bson_merge2(const void *b1data, const void *b2data, bson_bool_t
  * `bsdata2` may contain field path keys (eg: 'foo.bar').
  * @param bsdata1 BSON data to to be merged in `out`
  * @param bsdata2 Second BSON data to to be merged in `out`
- * @param overwrite if `true` all `bsdata1` fields will be overwriten by corresponding `bsdata2` fields
  * @param out Resulting `out` bson must be allocated and not finished.
  *
  * @return BSON_OK or BSON_ERROR.
  */
-EJDB_EXPORT int bson_merge3(const void *bsdata1, const void *bsdata2, bson_bool_t overwrite, bson *out);
+EJDB_EXPORT int bson_merge3(const void *bsdata1, const void *bsdata2, bson *out);
 
 EJDB_EXPORT int bson_inplace_set_bool(bson_iterator *pos, bson_bool_t val);
 EJDB_EXPORT int bson_inplace_set_long(bson_iterator *pos, int64_t val);