diff options
author | Simo Sorce <idra@samba.org> | 2007-12-23 22:03:31 -0600 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-24 01:51:04 -0600 |
commit | 2d400c1dd1ba1c5a49d2d79bdf7593d430da92e8 (patch) | |
tree | 4cfa2fe773ad1759f91c7255376324934832a3ad /source4/lib/ldb/ldb_tdb | |
parent | de9c8930a679fcff1d0f0632d4f5b03e6b54722d (diff) | |
download | samba-2d400c1dd1ba1c5a49d2d79bdf7593d430da92e8.tar.gz samba-2d400c1dd1ba1c5a49d2d79bdf7593d430da92e8.tar.bz2 samba-2d400c1dd1ba1c5a49d2d79bdf7593d430da92e8.zip |
r26574: Do not call functions in the variable declaration, fix checking for tmp_ctx,
and also makes code more readable and debuggable.
Eliminate silly parenthesys.
Simo.
(This used to be commit 166195b487ffa51933f772a56f47f7f0d4c867eb)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 949164a505..45a8109584 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -961,16 +961,20 @@ static int ltdb_request(struct ldb_module *module, struct ldb_request *req) */ static int ltdb_sequence_number(struct ldb_module *module, struct ldb_request *req) { - TALLOC_CTX *tmp_ctx = talloc_new(req); + TALLOC_CTX *tmp_ctx; struct ldb_message *msg = NULL; - struct ldb_dn *dn = ldb_dn_new(tmp_ctx, module->ldb, LTDB_BASEINFO); + struct ldb_dn *dn; + const char *date; int tret; + tmp_ctx = talloc_new(req); if (tmp_ctx == NULL) { talloc_free(tmp_ctx); return LDB_ERR_OPERATIONS_ERROR; } + dn = ldb_dn_new(tmp_ctx, module->ldb, LTDB_BASEINFO); + msg = talloc(tmp_ctx, struct ldb_message); if (msg == NULL) { talloc_free(tmp_ctx); @@ -996,8 +1000,7 @@ static int ltdb_sequence_number(struct ldb_module *module, struct ldb_request *r req->op.seq_num.seq_num++; break; case LDB_SEQ_HIGHEST_TIMESTAMP: - { - const char *date = ldb_msg_find_attr_as_string(msg, LTDB_MOD_TIMESTAMP, NULL); + date = ldb_msg_find_attr_as_string(msg, LTDB_MOD_TIMESTAMP, NULL); if (date) { req->op.seq_num.seq_num = ldb_string_to_time(date); } else { @@ -1006,7 +1009,6 @@ static int ltdb_sequence_number(struct ldb_module *module, struct ldb_request *r } break; } - } talloc_free(tmp_ctx); return LDB_SUCCESS; } |