- avl_free(oc_index, ldap_memfree);
- while( !LDAP_SLIST_EMPTY(&oc_list) ) {
- o = LDAP_SLIST_FIRST(&oc_list);
- LDAP_SLIST_REMOVE_HEAD(&oc_list, soc_next);
+ while( !LDAP_STAILQ_EMPTY(&oc_list) ) {
+ o = LDAP_STAILQ_FIRST(&oc_list);
+ LDAP_STAILQ_REMOVE_HEAD(&oc_list, soc_next);
+
+ oc_delete_names( o );
+ }
+
+ avl_free( oc_index, oc_destroy_one );
+
+ while( !LDAP_STAILQ_EMPTY(&oc_undef_list) ) {
+ o = LDAP_STAILQ_FIRST(&oc_undef_list);
+ LDAP_STAILQ_REMOVE_HEAD(&oc_undef_list, soc_next);
+
+ ch_free( (ObjectClass *)o );
+ }
+}
+
+int
+oc_start( ObjectClass **oc )
+{
+ assert( oc != NULL );
+
+ *oc = LDAP_STAILQ_FIRST(&oc_list);
+
+ return (*oc != NULL);
+}
+
+int
+oc_next( ObjectClass **oc )
+{
+ assert( oc != NULL );
+
+#if 0 /* pedantic check: breaks when deleting an oc, don't use it. */
+ {
+ ObjectClass *tmp = NULL;
+
+ LDAP_STAILQ_FOREACH(tmp,&oc_list,soc_next) {
+ if ( tmp == *oc ) {
+ break;
+ }
+ }
+
+ assert( tmp != NULL );
+ }
+#endif
+
+ if ( *oc == NULL ) {
+ return 0;
+ }
+
+ *oc = LDAP_STAILQ_NEXT(*oc,soc_next);
+
+ return (*oc != NULL);
+}
+
+/*
+ * check whether the two ObjectClasses actually __are__ identical,
+ * or rather inconsistent
+ */
+static int
+oc_check_dup(
+ ObjectClass *soc,
+ ObjectClass *new_soc )
+{
+ if ( new_soc->soc_oid != NULL ) {
+ if ( soc->soc_oid == NULL ) {
+ return SLAP_SCHERR_CLASS_INCONSISTENT;
+ }
+
+ if ( strcmp( soc->soc_oid, new_soc->soc_oid ) != 0 ) {
+ return SLAP_SCHERR_CLASS_INCONSISTENT;
+ }
+
+ } else {
+ if ( soc->soc_oid != NULL ) {
+ return SLAP_SCHERR_CLASS_INCONSISTENT;
+ }
+ }
+
+ if ( new_soc->soc_names ) {
+ int i;