From: Howard Chu Date: Fri, 17 Nov 2006 20:11:11 +0000 (+0000) Subject: Keep hardcoded schema together in lists X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~454 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f0f7324e0e75efc909696f5a3a5a0dfabc271e44;p=openldap Keep hardcoded schema together in lists --- diff --git a/servers/slapd/at.c b/servers/slapd/at.c index 7ab6eed84f..e02acf90a0 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -61,6 +61,9 @@ static Avlnode *attr_cache = NULL; static LDAP_STAILQ_HEAD(ATList, slap_attribute_type) attr_list = LDAP_STAILQ_HEAD_INITIALIZER(attr_list); +/* Last hardcoded attribute registered */ +static AttributeType *attr_sys_tail; + int at_oc_cache; static int @@ -525,6 +528,10 @@ at_insert( } } + if ( sat->sat_flags & SLAP_AT_HARDCODE ) { + prev = attr_sys_tail; + attr_sys_tail = sat; + } if ( prev ) { LDAP_STAILQ_INSERT_AFTER( &attr_list, prev, sat, sat_next ); } else { diff --git a/servers/slapd/oc.c b/servers/slapd/oc.c index a483922aa3..87ced2d7cb 100644 --- a/servers/slapd/oc.c +++ b/servers/slapd/oc.c @@ -134,6 +134,7 @@ static Avlnode *oc_index = NULL; static Avlnode *oc_cache = NULL; static LDAP_STAILQ_HEAD(OCList, slap_object_class) oc_list = LDAP_STAILQ_HEAD_INITIALIZER(oc_list); +static ObjectClass *oc_sys_tail; static int oc_index_cmp( @@ -669,7 +670,15 @@ oc_insert( names++; } } - LDAP_STAILQ_INSERT_TAIL( &oc_list, soc, soc_next ); + if ( soc->soc_flags & SLAP_OC_HARDCODE ) { + prev = oc_sys_tail; + oc_sys_tail = soc; + } + if ( prev ) { + LDAP_STAILQ_INSERT_AFTER( &oc_list, prev, soc, soc_next ); + } else { + LDAP_STAILQ_INSERT_TAIL( &oc_list, soc, soc_next ); + } return 0; } diff --git a/servers/slapd/oidm.c b/servers/slapd/oidm.c index 9d2cef857e..2fe6cc552c 100644 --- a/servers/slapd/oidm.c +++ b/servers/slapd/oidm.c @@ -29,6 +29,8 @@ static LDAP_STAILQ_HEAD(OidMacroList, slap_oid_macro) om_list = LDAP_STAILQ_HEAD_INITIALIZER(om_list); +static OidMacro *om_sys_tail; + /* Replace an OID Macro invocation with its full numeric OID. * If the macro is used with "macroname:suffix" append ".suffix" * to the expansion. @@ -98,7 +100,7 @@ parse_oidm( OidMacro **rom) { char *oid; - OidMacro *om = NULL; + OidMacro *om = NULL, *prev = NULL; struct berval bv; oid = oidm_find( c->argv[1] ); @@ -144,10 +146,16 @@ parse_oidm( } om->som_oid.bv_len = strlen( om->som_oid.bv_val ); - if ( !user ) + if ( !user ) { om->som_flags |= SLAP_OM_HARDCODE; + prev = om_sys_tail; + } - LDAP_STAILQ_INSERT_TAIL( &om_list, om, som_next ); + if ( prev ) { + LDAP_STAILQ_INSERT_AFTER( &om_list, prev, om, som_next ); + } else { + LDAP_STAILQ_INSERT_TAIL( &om_list, om, som_next ); + } if ( rom ) *rom = om; return 0; }