]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/attr.c
minor naming cleanup; improvements to DN mapping layer; major docs update
[openldap] / servers / slapd / attr.c
index 87bfb97a5bb85f12f2b922d702698db1172187df..8908a65da90cc9a986a329e442740e9d3b90a8da 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 
 void
 attr_free( Attribute *a )
 {
-       if ( a->a_nvals && a->a_nvals != a->a_vals )
+       if ( a->a_nvals && a->a_nvals != a->a_vals ) {
                ber_bvarray_free( a->a_nvals );
+       }
        ber_bvarray_free( a->a_vals );
        free( a );
 }
 
+#ifdef LDAP_COMP_MATCH
+void
+comp_tree_free( Attribute *a )
+{
+       Attribute *next;
+
+       for( ; a != NULL ; a = next ) {
+               next = a->a_next;
+               if ( component_destructor && a->a_comp_data ) {
+                       if ( a->a_comp_data->cd_mem_op )
+                               component_destructor( a->a_comp_data->cd_mem_op );
+                       free ( a->a_comp_data );
+               }
+       }
+}
+#endif
+
 void
 attrs_free( Attribute *a )
 {
@@ -109,6 +126,9 @@ attr_dup( Attribute *a )
        tmp->a_desc = a->a_desc;
        tmp->a_next = NULL;
        tmp->a_flags = 0;
+#ifdef LDAP_COMP_MATCH
+       tmp->a_comp_data = NULL;
+#endif
 
        return tmp;
 }
@@ -169,6 +189,9 @@ attr_merge(
                (*a)->a_nvals = NULL;
                (*a)->a_next = NULL;
                (*a)->a_flags = 0;
+#ifdef LDAP_COMP_MATCH
+               (*a)->a_comp_data = NULL;
+#endif
        }
 
        rc = value_add( &(*a)->a_vals, vals );
@@ -250,6 +273,9 @@ attr_merge_one(
                (*a)->a_nvals = NULL;
                (*a)->a_next = NULL;
                (*a)->a_flags = 0;
+#ifdef LDAP_COMP_MATCH
+               (*a)->a_comp_data = NULL;
+#endif
        }
 
        rc = value_add_one( &(*a)->a_vals, val );