X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=servers%2Fslapd%2Fslapi%2Fslapi_ext.c;h=90b9db447bbb014ff6c112547f3b21bcf60c5553;hb=487d3966eea565e8768b5b7b06f1dca7181d467e;hp=cb1d66e0ec9c69a065edae4da5ad0de5e59c0744;hpb=dc0eacd40b625258355eea866d62188e5aa7ce3b;p=openldap
diff --git a/servers/slapd/slapi/slapi_ext.c b/servers/slapd/slapi/slapi_ext.c
index cb1d66e0ec..90b9db447b 100644
--- a/servers/slapd/slapi/slapi_ext.c
+++ b/servers/slapd/slapi/slapi_ext.c
@@ -1,7 +1,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software .
*
- * Copyright 2003-2005 The OpenLDAP Foundation.
+ * Copyright 2003-2012 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,10 +30,11 @@
#include
#include
+#ifdef LDAP_SLAPI
+
#include
#include
-#ifdef LDAP_SLAPI
/*
* Object extensions
*
@@ -65,7 +66,7 @@ static int get_extension_block(int objecttype, void *object, struct slapi_extens
*parent = NULL;
break;
case SLAPI_X_EXT_OPERATION:
- *eblock = ((Operation *)object)->o_extensions;
+ *eblock = ((Operation *)object)->o_hdr->oh_extensions;
*parent = ((Operation *)object)->o_conn;
break;
default:
@@ -130,11 +131,9 @@ static void free_extension(struct slapi_extension_block *eblock, int objecttype,
eblock->extensions[extensionhandle] = NULL;
}
}
-#endif /* LDAP_SLAPI */
void *slapi_get_object_extension(int objecttype, void *object, int extensionhandle)
{
-#ifdef LDAP_SLAPI
struct slapi_extension_block *eblock;
void *parent;
@@ -147,14 +146,10 @@ void *slapi_get_object_extension(int objecttype, void *object, int extensionhand
}
return NULL;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
}
void slapi_set_object_extension(int objecttype, void *object, int extensionhandle, void *extension)
{
-#ifdef LDAP_SLAPI
struct slapi_extension_block *eblock;
void *parent;
@@ -169,7 +164,6 @@ void slapi_set_object_extension(int objecttype, void *object, int extensionhandl
/* constructed by caller */
eblock->extensions[extensionhandle] = extension;
}
-#endif /* LDAP_SLAPI */
}
int slapi_register_object_extension(
@@ -180,7 +174,6 @@ int slapi_register_object_extension(
int *objecttype,
int *extensionhandle)
{
-#ifdef LDAP_SLAPI
int rc;
slapi_extension_t type;
struct slapi_registered_extension *re;
@@ -228,15 +221,11 @@ int slapi_register_object_extension(
ldap_pvt_thread_mutex_unlock( ®istered_extensions.mutex );
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int slapi_int_create_object_extensions(int objecttype, void *object)
{
-#ifdef LDAP_SLAPI
- int i, rc;
+ int i;
struct slapi_extension_block *eblock;
void **peblock;
void *parent;
@@ -247,7 +236,7 @@ int slapi_int_create_object_extensions(int objecttype, void *object)
parent = NULL;
break;
case SLAPI_X_EXT_OPERATION:
- peblock = &(((Operation *)object)->o_extensions);
+ peblock = &(((Operation *)object)->o_hdr->oh_extensions);
parent = ((Operation *)object)->o_conn;
break;
default:
@@ -281,15 +270,11 @@ int slapi_int_create_object_extensions(int objecttype, void *object)
*peblock = eblock;
return 0;
-#else
- return -1;
-#endif
}
int slapi_int_free_object_extensions(int objecttype, void *object)
{
-#ifdef LDAP_SLAPI
- int i, rc;
+ int i;
struct slapi_extension_block *eblock;
void **peblock;
void *parent;
@@ -300,7 +285,7 @@ int slapi_int_free_object_extensions(int objecttype, void *object)
parent = NULL;
break;
case SLAPI_X_EXT_OPERATION:
- peblock = &(((Operation *)object)->o_extensions);
+ peblock = &(((Operation *)object)->o_hdr->oh_extensions);
parent = ((Operation *)object)->o_conn;
break;
default:
@@ -321,16 +306,12 @@ int slapi_int_free_object_extensions(int objecttype, void *object)
slapi_ch_free( peblock );
return 0;
-#else
- return -1;
-#endif
}
/* for reusable object types */
int slapi_int_clear_object_extensions(int objecttype, void *object)
{
-#ifdef LDAP_SLAPI
- int i, rc;
+ int i;
struct slapi_extension_block *eblock;
void *parent;
@@ -352,14 +333,10 @@ int slapi_int_clear_object_extensions(int objecttype, void *object)
}
return 0;
-#else
- return -1;
-#endif
}
int slapi_int_init_object_extensions(void)
{
-#ifdef LDAP_SLAPI
memset( ®istered_extensions, 0, sizeof( registered_extensions ) );
if ( ldap_pvt_thread_mutex_init( ®istered_extensions.mutex ) != 0 ) {
@@ -367,7 +344,6 @@ int slapi_int_init_object_extensions(void)
}
return 0;
-#else
- return -1;
-#endif
}
+
+#endif /* LDAP_SLAPI */