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

abartlet at samba.org abartlet at samba.org
Sat Jul 29 01:23:51 GMT 2006


Author: abartlet
Date: 2006-07-29 01:23:50 +0000 (Sat, 29 Jul 2006)
New Revision: 17301

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

Log:
Add a new function to copy a list of attributes, while adding one to
the end.

Andrew Bartlett

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	2006-07-29 01:22:22 UTC (rev 17300)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c	2006-07-29 01:23:50 UTC (rev 17301)
@@ -611,6 +611,28 @@
 
 
 /*
+  copy an attribute list. This only copies the array, not the elements
+  (ie. the elements are left as the same pointers)
+*/
+const char **ldb_attr_list_copy_add(TALLOC_CTX *mem_ctx, const char * const *attrs, const char *new_attr)
+{
+	const char **ret;
+	int i;
+	for (i=0;attrs[i];i++) /* noop */ ;
+	ret = talloc_array(mem_ctx, const char *, i+2);
+	if (ret == NULL) {
+		return NULL;
+	}
+	for (i=0;attrs[i];i++) {
+		ret[i] = attrs[i];
+	}
+	ret[i] = new_attr;
+	ret[i+1] = NULL;
+	return ret;
+}
+
+
+/*
   return 1 if an attribute is in a list of attributes, or 0 otherwise
 */
 int ldb_attr_in_list(const char * const *attrs, const char *attr)



More information about the samba-cvs mailing list