[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Tue Oct 13 08:16:29 MDT 2009


The branch, master has been updated
       via  a889303... s4:ldb_tdb - Revert some introduced "trivial gotos"
      from  325dc96... Enhance ".gitignore" file for s4

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a889303e3e0488b25015bcb5ee0bc2804873506a
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Mon Oct 12 23:39:40 2009 +0200

    s4:ldb_tdb - Revert some introduced "trivial gotos"
    
    I hope that this makes abartlet & simo happy again (consider mailing list).

-----------------------------------------------------------------------

Summary of changes:
 source4/lib/ldb/ldb_tdb/ldb_tdb.c |   32 +++++++++++---------------------
 1 files changed, 11 insertions(+), 21 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 4943f81..63ce6e7 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;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list