svn commit: samba r20731 - in branches/SAMBA_4_0/source/lib/ldb/common: .

metze at samba.org metze at samba.org
Sat Jan 13 15:03:02 GMT 2007


Author: metze
Date: 2007-01-13 15:03:00 +0000 (Sat, 13 Jan 2007)
New Revision: 20731

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20731

Log:
we need the complex memmove() handling for removing an attribute only in one place

metze
Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c	2007-01-13 15:01:39 UTC (rev 20730)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c	2007-01-13 15:03:00 UTC (rev 20731)
@@ -728,23 +728,7 @@
 	return ldb_msg_rename_attr(msg, attr, replace);
 }
 
-
 /*
-  remove the specified attribute in a search result
-*/
-void ldb_msg_remove_attr(struct ldb_message *msg, const char *attr)
-{
-	struct ldb_message_element *el = ldb_msg_find_element(msg, attr);
-	if (el) {
-		int n = (el - msg->elements);
-		if (n != msg->num_elements-1) {
-			memmove(el, el+1, ((msg->num_elements-1) - n)*sizeof(*el));
-		}
-		msg->num_elements--;
-	}
-}
-
-/*
   remove the specified element in a search result
 */
 void ldb_msg_remove_element(struct ldb_message *msg, struct ldb_message_element *el)
@@ -756,7 +740,19 @@
 	msg->num_elements--;
 }
 
+
 /*
+  remove the specified attribute in a search result
+*/
+void ldb_msg_remove_attr(struct ldb_message *msg, const char *attr)
+{
+	struct ldb_message_element *el = ldb_msg_find_element(msg, attr);
+	if (el) {
+		ldb_msg_remove_element(msg, el);
+	}
+}
+
+/*
   return a LDAP formatted GeneralizedTime string
 */
 char *ldb_timestring(TALLOC_CTX *mem_ctx, time_t t)



More information about the samba-cvs mailing list