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

struct berval comparison



I'd like to avoid any unnecessary str[case]cmp on berval->bv_val,
so I added three functions, ber_memcmp(), ber_cmp() and ber_casecmp()
that are meant to replace memcmp, strcmp and strcasecmp respectively
when bervals are involved.

However their behavior in my implementation differs from that of the
replaced functions, because what I basically want to detect is match
without affecting ordering issues, so their use should be careful.

the match is:

if the lengths differ, return l1-l2; otherwise return the comparison
on the values.  

1) is this acceptable, are there comments?
2) is the naming OK, any suggestions before I heavily modify the code?

Pierangelo.

-- 
Dr. Pierangelo Masarati               | voice: +39 02 2399 8309
Dip. Ing. Aerospaziale                | fax:   +39 02 2399 8334
Politecnico di Milano                 |
mailto:pierangelo.masarati@polimi.it
via La Masa 34, 20156 Milano, Italy   |
http://www.aero.polimi.it/~masarati