You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2005/08/01 17:32:30 UTC
svn commit: r226820 - /httpd/httpd/trunk/modules/ldap/util_ldap_cache.c
Author: jorton
Date: Mon Aug 1 08:32:28 2005
New Revision: 226820
URL: http://svn.apache.org/viewcvs?rev=226820&view=rev
Log:
* modules/ldap/util_ldap_cache.c: Remove various casts-from-void *,
fix various minor style nits. No functional changes.
Modified:
httpd/httpd/trunk/modules/ldap/util_ldap_cache.c
Modified: httpd/httpd/trunk/modules/ldap/util_ldap_cache.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/ldap/util_ldap_cache.c?rev=226820&r1=226819&r2=226820&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/util_ldap_cache.c (original)
+++ httpd/httpd/trunk/modules/ldap/util_ldap_cache.c Mon Aug 1 08:32:28 2005
@@ -33,22 +33,22 @@
unsigned long util_ldap_url_node_hash(void *n)
{
- util_url_node_t *node = (util_url_node_t *)n;
+ util_url_node_t *node = n;
return util_ald_hash_string(1, node->url);
}
int util_ldap_url_node_compare(void *a, void *b)
{
- util_url_node_t *na = (util_url_node_t *)a;
- util_url_node_t *nb = (util_url_node_t *)b;
+ util_url_node_t *na = a;
+ util_url_node_t *nb = b;
- return(strcmp(na->url, nb->url) == 0);
+ return (strcmp(na->url, nb->url) == 0);
}
void *util_ldap_url_node_copy(util_ald_cache_t *cache, void *c)
{
- util_url_node_t *n = (util_url_node_t *)c;
- util_url_node_t *node = (util_url_node_t *)util_ald_alloc(cache, sizeof(util_url_node_t));
+ util_url_node_t *n = c;
+ util_url_node_t *node = util_ald_alloc(cache, sizeof *node);
if (node) {
if (!(node->url = util_ald_strdup(cache, n->url))) {
@@ -67,7 +67,7 @@
void util_ldap_url_node_free(util_ald_cache_t *cache, void *n)
{
- util_url_node_t *node = (util_url_node_t *)n;
+ util_url_node_t *node = n;
util_ald_free(cache, node->url);
util_ald_destroy_cache(node->search_cache);
@@ -78,7 +78,7 @@
void util_ldap_url_node_display(request_rec *r, util_ald_cache_t *cache, void *n)
{
- util_url_node_t *node = (util_url_node_t *)n;
+ util_url_node_t *node = n;
char date_str[APR_CTIME_LEN+1];
char *buf;
const char *type_str;
@@ -135,20 +135,22 @@
/* Cache functions for search nodes */
unsigned long util_ldap_search_node_hash(void *n)
{
- util_search_node_t *node = (util_search_node_t *)n;
- return util_ald_hash_string(1, ((util_search_node_t *)(node))->username);
+ util_search_node_t *node = n;
+ return util_ald_hash_string(1, node->username);
}
int util_ldap_search_node_compare(void *a, void *b)
{
- return(strcmp(((util_search_node_t *)a)->username,
- ((util_search_node_t *)b)->username) == 0);
+ util_search_node_t *na = a;
+ util_search_node_t *nb = b;
+
+ return (strcmp(na->username, nb->username) == 0);
}
void *util_ldap_search_node_copy(util_ald_cache_t *cache, void *c)
{
- util_search_node_t *node = (util_search_node_t *)c;
- util_search_node_t *newnode = util_ald_alloc(cache, sizeof(util_search_node_t));
+ util_search_node_t *node = c;
+ util_search_node_t *newnode = util_ald_alloc(cache, sizeof *newnode);
/* safety check */
if (newnode) {
@@ -199,8 +201,9 @@
void util_ldap_search_node_free(util_ald_cache_t *cache, void *n)
{
int i = 0;
- util_search_node_t *node = (util_search_node_t *)n;
+ util_search_node_t *node = n;
int k = node->numvals;
+
if (node->vals) {
for (;k;k--,i++) {
if (node->vals[i]) {
@@ -217,7 +220,7 @@
void util_ldap_search_node_display(request_rec *r, util_ald_cache_t *cache, void *n)
{
- util_search_node_t *node = (util_search_node_t *)n;
+ util_search_node_t *node = n;
char date_str[APR_CTIME_LEN+1];
char *buf;
@@ -240,14 +243,15 @@
unsigned long util_ldap_compare_node_hash(void *n)
{
- util_compare_node_t *node = (util_compare_node_t *)n;
+ util_compare_node_t *node = n;
return util_ald_hash_string(3, node->dn, node->attrib, node->value);
}
int util_ldap_compare_node_compare(void *a, void *b)
{
- util_compare_node_t *na = (util_compare_node_t *)a;
- util_compare_node_t *nb = (util_compare_node_t *)b;
+ util_compare_node_t *na = a;
+ util_compare_node_t *nb = b;
+
return (strcmp(na->dn, nb->dn) == 0 &&
strcmp(na->attrib, nb->attrib) == 0 &&
strcmp(na->value, nb->value) == 0);
@@ -255,8 +259,8 @@
void *util_ldap_compare_node_copy(util_ald_cache_t *cache, void *c)
{
- util_compare_node_t *n = (util_compare_node_t *)c;
- util_compare_node_t *node = (util_compare_node_t *)util_ald_alloc(cache, sizeof(util_compare_node_t));
+ util_compare_node_t *n = c;
+ util_compare_node_t *node = util_ald_alloc(cache, sizeof *node);
if (node) {
if (!(node->dn = util_ald_strdup(cache, n->dn)) ||
@@ -276,7 +280,7 @@
void util_ldap_compare_node_free(util_ald_cache_t *cache, void *n)
{
- util_compare_node_t *node = (util_compare_node_t *)n;
+ util_compare_node_t *node = n;
util_ald_free(cache, node->dn);
util_ald_free(cache, node->attrib);
util_ald_free(cache, node->value);
@@ -285,7 +289,7 @@
void util_ldap_compare_node_display(request_rec *r, util_ald_cache_t *cache, void *n)
{
- util_compare_node_t *node = (util_compare_node_t *)n;
+ util_compare_node_t *node = n;
char date_str[APR_CTIME_LEN+1];
char *buf, *cmp_result;
@@ -322,19 +326,23 @@
unsigned long util_ldap_dn_compare_node_hash(void *n)
{
- return util_ald_hash_string(1, ((util_dn_compare_node_t *)n)->reqdn);
+ util_dn_compare_node_t *node = n;
+ return util_ald_hash_string(1, node->reqdn);
}
int util_ldap_dn_compare_node_compare(void *a, void *b)
{
- return (strcmp(((util_dn_compare_node_t *)a)->reqdn,
- ((util_dn_compare_node_t *)b)->reqdn) == 0);
+ util_dn_compare_node_t *na = a;
+ util_dn_compare_node_t *nb = b;
+
+ return (strcmp(na->reqdn, nb->reqdn) == 0);
}
void *util_ldap_dn_compare_node_copy(util_ald_cache_t *cache, void *c)
{
- util_dn_compare_node_t *n = (util_dn_compare_node_t *)c;
- util_dn_compare_node_t *node = (util_dn_compare_node_t *)util_ald_alloc(cache, sizeof(util_dn_compare_node_t));
+ util_dn_compare_node_t *n = c;
+ util_dn_compare_node_t *node = util_ald_alloc(cache, sizeof *node);
+
if (node) {
if (!(node->reqdn = util_ald_strdup(cache, n->reqdn)) ||
!(node->dn = util_ald_strdup(cache, n->dn))) {
@@ -350,7 +358,7 @@
void util_ldap_dn_compare_node_free(util_ald_cache_t *cache, void *n)
{
- util_dn_compare_node_t *node = (util_dn_compare_node_t *)n;
+ util_dn_compare_node_t *node = n;
util_ald_free(cache, node->reqdn);
util_ald_free(cache, node->dn);
util_ald_free(cache, node);
@@ -358,7 +366,7 @@
void util_ldap_dn_compare_node_display(request_rec *r, util_ald_cache_t *cache, void *n)
{
- util_dn_compare_node_t *node = (util_dn_compare_node_t *)n;
+ util_dn_compare_node_t *node = n;
char *buf;
buf = apr_psprintf(r->pool,
@@ -376,7 +384,7 @@
/* ------------------------------------------------------------------ */
static apr_status_t util_ldap_cache_module_kill(void *data)
{
- util_ldap_state_t *st = (util_ldap_state_t *)data;
+ util_ldap_state_t *st = data;
util_ald_destroy_cache(st->util_ldap_cache);
#if APR_HAS_SHARED_MEMORY