diff options
author | Anton Adamansky <adamansky@gmail.com> | 2015-04-30 00:39:48 +0600 |
---|---|---|
committer | Anton Adamansky <adamansky@gmail.com> | 2015-04-30 00:39:48 +0600 |
commit | cb830573fc825af02e3f97181802d025fdb782a4 (patch) | |
tree | 185324bcce1a4c79bd16af413eb1b345d6245860 /src | |
parent | 11bd810745583961c07872d962c77843c119dd08 (diff) | |
download | ejdb-cb830573fc825af02e3f97181802d025fdb782a4.tar.gz ejdb-cb830573fc825af02e3f97181802d025fdb782a4.tar.bz2 ejdb-cb830573fc825af02e3f97181802d025fdb782a4.zip |
Codestyle
Diffstat (limited to 'src')
-rw-r--r-- | src/ejdb/ejdb.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/ejdb/ejdb.c b/src/ejdb/ejdb.c index 8571d53..5915a5a 100644 --- a/src/ejdb/ejdb.c +++ b/src/ejdb/ejdb.c @@ -3198,7 +3198,7 @@ static bool _qryupdate(_QRYCTX *ctx, void *bsbuf, int bsbufsz) { } } - for (int i = 0; i < 2; ++i) { //$pull $pullAll + for (int i = 0; i < 2; ++i) { // $pull $pullAll const EJQF *qf = pullqf[i]; if (!qf) continue; char *inbuf = (bsout.finished) ? bsout.data : bsbuf; @@ -3209,7 +3209,7 @@ static bool _qryupdate(_QRYCTX *ctx, void *bsbuf, int bsbufsz) { assert(bsout.data == NULL); bson_init_size(&bsout, bsbufsz); } - //$pull $pullAll merge + // $pull $pullAll merge if (bson_merge_arrays(bson_data(qf->updateobj), inbuf, BSON_MERGE_ARRAY_PULL, (qf->flags & EJCONDALL), &bsout)) { rv = false; @@ -3226,7 +3226,7 @@ static bool _qryupdate(_QRYCTX *ctx, void *bsbuf, int bsbufsz) { } } - for (int i = 0; i < 2; ++i) { //$push $pushAll + for (int i = 0; i < 2; ++i) { // $push $pushAll const EJQF *qf = pushqf[i]; if (!qf) continue; char *inbuf = (bsout.finished) ? bsout.data : bsbuf; @@ -3236,7 +3236,7 @@ static bool _qryupdate(_QRYCTX *ctx, void *bsbuf, int bsbufsz) { assert(bsout.data == NULL); bson_init_size(&bsout, bsbufsz); } - //$push $pushAll merge + // $push $pushAll merge if (bson_merge_arrays(bson_data(qf->updateobj), inbuf, BSON_MERGE_ARRAY_PUSH, (qf->flags & EJCONDALL), &bsout)) { rv = false; @@ -3249,19 +3249,19 @@ static bool _qryupdate(_QRYCTX *ctx, void *bsbuf, int bsbufsz) { update++; } - for (int i = 0; i < 2; ++i) { //$addToSet $addToSetAll + for (int i = 0; i < 2; ++i) { // $addToSet $addToSetAll const EJQF *qf = addsetqf[i]; if (!qf) continue; char *inbuf = (bsout.finished) ? bsout.data : bsbuf; if ((qf->flags & EJCONDALL) || bson_find_unmerged_arrays(bson_data(qf->updateobj), inbuf)) { - //Missing $addToSet element in some array field found + // Missing $addToSet element in some array field found if (bsout.finished) { bson_init_size(&bsout, bson_size(&bsout)); } else { assert(bsout.data == NULL); bson_init_size(&bsout, bsbufsz); } - //$addToSet $addToSetAll merge + // $addToSet $addToSetAll merge if (bson_merge_arrays(bson_data(qf->updateobj), inbuf, BSON_MERGE_ARRAY_ADDSET, (qf->flags & EJCONDALL), &bsout)) { rv = false; @@ -3278,19 +3278,19 @@ static bool _qryupdate(_QRYCTX *ctx, void *bsbuf, int bsbufsz) { } } - //Finishing document update + // Finishing document update if (!update || !rv) { goto finish; } - if (bsout.err) { //Resulting BSON is OK? + if (bsout.err) { // Resulting BSON is OK? rv = false; _ejdbsetecode(coll->jb, JBEQUPDFAILED, __FILE__, __LINE__, __func__); goto finish; } - if (bson_size(&bsout) == 0) { //Record was not updated + if (bson_size(&bsout) == 0) { // Record was not updated goto finish; } - //Perform updating + // Perform updating bt = bson_find_from_buffer(&it, bsbuf, JDBIDKEYNAME); if (bt != BSON_OID) { rv = false; @@ -3336,18 +3336,18 @@ static TCLIST* _qryexecute(EJCOLL *coll, const EJQ *_q, _qryctxclear(&ctx); return NULL; } - bool all = false; //if True we need all records to fetch (sorting) + bool all = false; // If True we need all records to fetch (sorting) TCHDB *hdb = coll->tdb->hdb; TCLIST *res = ctx.res; EJQF *mqf = ctx.mqf; - int sz = 0; //generic size var - int anum = 0; //number of active conditions - int ofsz = 0; //order fields count - int aofsz = 0; //active order fields count - const int qfsz = TCLISTNUM(q->qflist); //number of all condition fields - EJQF **ofs = NULL; //order fields - EJQF **qfs = NULL; //condition fields array + int sz = 0; // Generic size var + int anum = 0; // Number of active conditions + int ofsz = 0; // Order fields count + int aofsz = 0; // Active order fields count + const int qfsz = TCLISTNUM(q->qflist); // Number of all condition fields + EJQF **ofs = NULL; // Order fields + EJQF **qfs = NULL; // Condition fields array if (qfsz > 0) { TCMALLOC(qfs, qfsz * sizeof (EJQF*)); } @@ -3357,12 +3357,12 @@ static TCLIST* _qryexecute(EJCOLL *coll, const EJQ *_q, const void *vbuf; int vbufsz; - uint32_t count = 0; //current count + uint32_t count = 0; // Current count uint32_t max = (q->max > 0) ? q->max : UINT_MAX; uint32_t skip = q->skip; const TDBIDX *midx = mqf ? mqf->idx : NULL; - if (midx) { //Main index used for ordering + if (midx) { // Main index used for ordering if (mqf->orderseq == 1 && !(mqf->tcop == TDBQCSTRAND || mqf->tcop == TDBQCSTROR || mqf->tcop == TDBQCSTRNUMOR)) { |