[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: ad_cmp()

At 04:01 PM 2002-01-18, Howard Chu wrote:
>This is definitely a mistake, the macro should still have been usable for sorting and it isn't now.
>It looks like the only occurrences in slapd are using it for simple yes/no match, which is probably
>why it wasn't noticed.

I've modified ad_cmp() so that returns values usable for
ordering.  The order is not lexigraphical.  If lexigraphical
ordering is needed, I suggest adding an ad_strcmp() macro.


>  -- Howard Chu
>  Chief Architect, Symas Corp.       Director, Highland Sun
>  <http://www.symas.com/>http://www.symas.com               http://highlandsun.com/hyc 
>  Symas: Premier OpenSource Development and Support 
>-----Original Message----- 
>From: owner-openldap-devel@OpenLDAP.org [mailto:owner-openldap-devel@OpenLDAP.org]On Behalf Of Luke Howard 
>Sent: Saturday, January 19, 2002 1:29 AM 
>To: openldap-devel@OpenLDAP.org 
>Subject: ad_cmp()
>I note that the behaviour of ad_cmp() has changed recently, to return 1 if the strings are unequal lengths. Whilst this is obviously a good optimisation, it breaks anything that depends on the result being a lexicographical comparison of two attribute types. (We had used ad_cmp() to build an AVL tree in our backend.) 
>Just thought I'd point this out, as it took me a while to track down in our code. I haven't checked the rest of slapd to see whether it is used in this fashion. 
>-- Luke