svn commit: samba r16937 - in
branches/SAMBA_4_0/source/lib/ldb/ldb_tdb: .
abartlet at samba.org
abartlet at samba.org
Tue Jul 11 03:46:22 GMT 2006
Author: abartlet
Date: 2006-07-11 03:46:22 +0000 (Tue, 11 Jul 2006)
New Revision: 16937
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16937
Log:
Add const, to make it clear that it is invalid to talloc_free() the DN
at this point.
Andrew Bartlett
Modified:
branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c 2006-07-11 03:44:51 UTC (rev 16936)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c 2006-07-11 03:46:22 UTC (rev 16937)
@@ -762,7 +762,7 @@
static int ltdb_index_add1_new(struct ldb_context *ldb,
struct ldb_message *msg,
struct ldb_message_element *el,
- char *dn)
+ const char *dn)
{
struct ldb_message_element *el2;
@@ -784,7 +784,7 @@
return -1;
}
msg->elements[msg->num_elements].values[0].length = strlen(dn);
- msg->elements[msg->num_elements].values[0].data = (uint8_t *)dn;
+ msg->elements[msg->num_elements].values[0].data = discard_const_p(uint8_t, dn);
msg->elements[msg->num_elements].num_values = 1;
msg->num_elements++;
@@ -800,7 +800,7 @@
struct ldb_message *msg,
struct ldb_message_element *el,
int idx,
- char *dn)
+ const char *dn)
{
struct ldb_val *v2;
unsigned int i;
@@ -821,7 +821,7 @@
msg->elements[idx].values = v2;
msg->elements[idx].values[msg->elements[idx].num_values].length = strlen(dn);
- msg->elements[idx].values[msg->elements[idx].num_values].data = (uint8_t *)dn;
+ msg->elements[idx].values[msg->elements[idx].num_values].data = discard_const_p(uint8_t, dn);
msg->elements[idx].num_values++;
return 0;
@@ -830,7 +830,7 @@
/*
add an index entry for one message element
*/
-static int ltdb_index_add1(struct ldb_module *module, char *dn,
+static int ltdb_index_add1(struct ldb_module *module, const char *dn,
struct ldb_message_element *el, int v_idx)
{
struct ldb_context *ldb = module->ldb;
@@ -886,7 +886,7 @@
return ret;
}
-static int ltdb_index_add0(struct ldb_module *module, char *dn,
+static int ltdb_index_add0(struct ldb_module *module, const char *dn,
struct ldb_message_element *elements, int num_el)
{
struct ltdb_private *ltdb = module->private_data;
@@ -911,7 +911,6 @@
for (j = 0; j < elements[i].num_values; j++) {
ret = ltdb_index_add1(module, dn, &elements[i], j);
if (ret == -1) {
- talloc_free(dn);
return -1;
}
}
More information about the samba-cvs
mailing list