From 762b86ff0deb072871081f2684f63778e36ad3ce Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 28 Nov 2006 17:47:41 +0000 Subject: r19935: always use discard_const_p() in lib/ldb/ metze (This used to be commit 4a5da57306ad8cce5522ee72349cb85b447e295c) --- source3/lib/ldb/common/attrib_handlers.c | 2 +- source3/lib/ldb/include/includes.h | 3 +-- source3/lib/ldb/ldb_ildap/ldb_ildap.c | 5 +++-- source3/lib/ldb/ldb_ldap/ldb_ldap.c | 2 +- source3/lib/ldb/modules/operational.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/lib/ldb') diff --git a/source3/lib/ldb/common/attrib_handlers.c b/source3/lib/ldb/common/attrib_handlers.c index a289f3c32a..2b699aeaa8 100644 --- a/source3/lib/ldb/common/attrib_handlers.c +++ b/source3/lib/ldb/common/attrib_handlers.c @@ -296,7 +296,7 @@ static int ldb_comparison_objectclass(struct ldb_context *ldb, void *mem_ctx, } for (i=0;subclasses[i];i++) { struct ldb_val vs; - vs.data = (uint8 *)discard_const(subclasses[i]); + vs.data = discard_const_p(uint8_t, subclasses[i]); vs.length = strlen(subclasses[i]); if (ldb_comparison_objectclass(ldb, mem_ctx, &vs, v2) == 0) { return 0; diff --git a/source3/lib/ldb/include/includes.h b/source3/lib/ldb/include/includes.h index ce0d40e101..7a2e112241 100644 --- a/source3/lib/ldb/include/includes.h +++ b/source3/lib/ldb/include/includes.h @@ -18,8 +18,7 @@ -#define discard_const(ptr) ((void *)((intptr_t)(ptr))) -#define discard_const_p(type, ptr) ((type *)discard_const(ptr)) +#define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr))) #include "replace.h" #include "system/filesys.h" diff --git a/source3/lib/ldb/ldb_ildap/ldb_ildap.c b/source3/lib/ldb/ldb_ildap/ldb_ildap.c index 51ae031cf9..87f38b5fc7 100644 --- a/source3/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source3/lib/ldb/ldb_ildap/ldb_ildap.c @@ -470,11 +470,12 @@ static int ildb_search(struct ldb_module *module, struct ldb_request *req) msg->r.SearchRequest.timelimit = 0; msg->r.SearchRequest.sizelimit = 0; msg->r.SearchRequest.attributesonly = 0; - msg->r.SearchRequest.tree = discard_const(req->op.search.tree); + msg->r.SearchRequest.tree = discard_const_p(struct ldb_parse_tree, req->op.search.tree); for (n = 0; req->op.search.attrs && req->op.search.attrs[n]; n++) /* noop */ ; msg->r.SearchRequest.num_attributes = n; - msg->r.SearchRequest.attributes = discard_const(req->op.search.attrs); + msg->r.SearchRequest.attributes = discard_const_p(char *, req->op.search.attrs), + msg->controls = req->controls; return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle)); diff --git a/source3/lib/ldb/ldb_ldap/ldb_ldap.c b/source3/lib/ldb/ldb_ldap/ldb_ldap.c index 6dc52b2484..c45fa108f2 100644 --- a/source3/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source3/lib/ldb/ldb_ldap/ldb_ldap.c @@ -274,7 +274,7 @@ static int lldb_search(struct ldb_module *module, struct ldb_request *req) expression = ldb_filter_from_tree( lldb_ac, - CONST_DISCARD(struct ldb_parse_tree *, req->op.search.tree)); + discard_const_p(struct ldb_parse_tree, req->op.search.tree)); if (expression == NULL) { return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source3/lib/ldb/modules/operational.c b/source3/lib/ldb/modules/operational.c index 555ae5e9f6..953cbd593e 100644 --- a/source3/lib/ldb/modules/operational.c +++ b/source3/lib/ldb/modules/operational.c @@ -244,7 +244,7 @@ static int operational_search(struct ldb_module *module, struct ldb_request *req searchable, but are stored using a different name in the backend */ for (i=0;iop.search.tree), + ldb_parse_tree_attr_replace(discard_const_p(struct ldb_parse_tree, req->op.search.tree), parse_tree_sub[i].attr, parse_tree_sub[i].replace); } -- cgit