diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-10-12 23:39:40 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-10-12 23:43:20 +0200 |
commit | a889303e3e0488b25015bcb5ee0bc2804873506a (patch) | |
tree | 97f2935e1090015f7e3fffdd4344e98def7324fb /source4 | |
parent | 325dc960df55bf48fbb2150a5d5663a01dde8949 (diff) | |
download | samba-a889303e3e0488b25015bcb5ee0bc2804873506a.tar.gz samba-a889303e3e0488b25015bcb5ee0bc2804873506a.tar.bz2 samba-a889303e3e0488b25015bcb5ee0bc2804873506a.zip |
s4:ldb_tdb - Revert some introduced "trivial gotos"
I hope that this makes abartlet & simo happy again (consider mailing list).
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 4943f81df5..63ce6e7aec 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -234,7 +234,7 @@ int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flg int ret = LDB_SUCCESS; tdb_key = ltdb_key(module, msg->dn); - if (!tdb_key.dptr) { + if (tdb_key.dptr == NULL) { return LDB_ERR_OTHER; } @@ -271,12 +271,11 @@ static int ltdb_add_internal(struct ldb_module *module, ret = ltdb_check_special_dn(module, msg); if (ret != LDB_SUCCESS) { - goto done; + return ret; } if (ltdb_cache_load(module) != 0) { - ret = LDB_ERR_OPERATIONS_ERROR; - goto done; + return LDB_ERR_OPERATIONS_ERROR; } for (i=0;i<msg->num_elements;i++) { @@ -286,15 +285,13 @@ static int ltdb_add_internal(struct ldb_module *module, if (el->num_values == 0) { ldb_asprintf_errstring(ldb, "attribute %s on %s specified, but with 0 values (illegal)", el->name, ldb_dn_get_linearized(msg->dn)); - ret = LDB_ERR_CONSTRAINT_VIOLATION; - goto done; + return LDB_ERR_CONSTRAINT_VIOLATION; } if (a && a->flags & LDB_ATTR_FLAG_SINGLE_VALUE) { if (el->num_values > 1) { ldb_asprintf_errstring(ldb, "SINGLE-VALUE attribute %s on %s specified more than once", el->name, ldb_dn_get_linearized(msg->dn)); - ret = LDB_ERR_CONSTRAINT_VIOLATION; - goto done; + return LDB_ERR_CONSTRAINT_VIOLATION; } } } @@ -306,20 +303,16 @@ static int ltdb_add_internal(struct ldb_module *module, "Entry %s already exists", ldb_dn_get_linearized(msg->dn)); } - goto done; + return ret; } ret = ltdb_index_one(module, msg, 1); if (ret != LDB_SUCCESS) { - goto done; + return ret; } ret = ltdb_modified(module, msg->dn); - if (ret != LDB_SUCCESS) { - goto done; - } -done: return ret; } @@ -864,8 +857,7 @@ static int ltdb_rename(struct ltdb_context *ctx) msg = talloc(ctx, struct ldb_message); if (msg == NULL) { - ret = LDB_ERR_OPERATIONS_ERROR; - goto done; + return LDB_ERR_OPERATIONS_ERROR; } /* in case any attribute of the message was indexed, we need @@ -873,13 +865,12 @@ static int ltdb_rename(struct ltdb_context *ctx) ret = ltdb_search_dn1(module, req->op.rename.olddn, msg); if (ret != LDB_SUCCESS) { /* not finding the old record is an error */ - goto done; + return ret; } msg->dn = ldb_dn_copy(msg, req->op.rename.newdn); if (msg->dn == NULL) { - ret = LDB_ERR_OPERATIONS_ERROR; - goto done; + return LDB_ERR_OPERATIONS_ERROR; } /* Always delete first then add, to avoid conflicts with @@ -888,12 +879,11 @@ static int ltdb_rename(struct ltdb_context *ctx) */ ret = ltdb_delete_internal(module, req->op.rename.olddn); if (ret != LDB_SUCCESS) { - goto done; + return ret; } ret = ltdb_add_internal(module, msg); -done: return ret; } |