mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
use SLAP_PTRCMP
This commit is contained in:
parent
6bcbe9ad31
commit
629885a269
@ -29,7 +29,7 @@ ainfo_type_cmp(
|
||||
{
|
||||
const AttributeDescription *desc = v_desc;
|
||||
const AttrInfo *a = v_a;
|
||||
return (unsigned)desc - (unsigned)a->ai_desc;
|
||||
return SLAP_PTRCMP(desc, a->ai_desc);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -39,7 +39,7 @@ ainfo_cmp(
|
||||
)
|
||||
{
|
||||
const AttrInfo *a = v_a, *b = v_b;
|
||||
return (unsigned)a->ai_desc - (unsigned)b->ai_desc;
|
||||
return SLAP_PTRCMP(a->ai_desc, b->ai_desc);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -163,7 +163,7 @@ ldap_back_conn_cmp(
|
||||
/* For shared sessions, conn is NULL. Only explicitly
|
||||
* bound sessions will have non-NULL conn.
|
||||
*/
|
||||
return (unsigned)lc1->conn - (unsigned)lc2->conn;
|
||||
return SLAP_PTRCMP(lc1->conn, lc2->conn);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -29,7 +29,7 @@ ainfo_type_cmp(
|
||||
{
|
||||
const AttributeDescription *desc = v_desc;
|
||||
const AttrInfo *a = v_a;
|
||||
return (unsigned)desc - (unsigned)a->ai_desc;
|
||||
return SLAP_PTRCMP(desc, a->ai_desc);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -39,7 +39,7 @@ ainfo_cmp(
|
||||
)
|
||||
{
|
||||
const AttrInfo *a = v_a, *b = v_b;
|
||||
return (unsigned)a->ai_desc - (unsigned)b->ai_desc;
|
||||
return SLAP_PTRCMP(a->ai_desc, b->ai_desc);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -97,8 +97,7 @@ meta_back_conn_cmp(
|
||||
struct metaconn *lc1 = ( struct metaconn * )c1;
|
||||
struct metaconn *lc2 = ( struct metaconn * )c2;
|
||||
|
||||
return ( ( lc1->conn < lc2->conn ) ? -1 :
|
||||
( ( lc1->conn > lc2-> conn ) ? 1 : 0 ) );
|
||||
return SLAP_PTRCMP( lc1->conn, lc2->conn );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -29,7 +29,7 @@ static int
|
||||
backsql_cmp_oc( const void *v_m1, const void *v_m2 )
|
||||
{
|
||||
const backsql_oc_map_rec *m1 = v_m1, *m2 = v_m2;
|
||||
return ( m1->oc < m2->oc ? -1 : ( m1->oc > m2->oc ? 1 : 0 ) );
|
||||
return SLAP_PTRCMP( m1->oc, m2->oc );
|
||||
}
|
||||
|
||||
static int
|
||||
@ -46,7 +46,7 @@ static int
|
||||
backsql_cmp_attr( const void *v_m1, const void *v_m2 )
|
||||
{
|
||||
const backsql_at_map_rec *m1 = v_m1, *m2 = v_m2;
|
||||
return ( m1->ad < m2->ad ? -1 : ( m1->ad > m2->ad ? 1 : 0 ) );
|
||||
return SLAP_PTRCMP( m1->ad, m2->ad );
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -422,7 +422,7 @@ entry_free( Entry *e )
|
||||
int
|
||||
entry_cmp( Entry *e1, Entry *e2 )
|
||||
{
|
||||
return( e1 < e2 ? -1 : (e1 > e2 ? 1 : 0) );
|
||||
return SLAP_PTRCMP( e1, e2 );
|
||||
}
|
||||
|
||||
int
|
||||
@ -430,9 +430,8 @@ entry_dn_cmp( const void *v_e1, const void *v_e2 )
|
||||
{
|
||||
/* compare their normalized UPPERCASED dn's */
|
||||
const Entry *e1 = v_e1, *e2 = v_e2;
|
||||
int rc = e1->e_nname.bv_len - e2->e_nname.bv_len;
|
||||
if (rc) return rc;
|
||||
return( strcmp( e1->e_ndn, e2->e_ndn ) );
|
||||
|
||||
return ber_bvcmp( &e1->e_nname, &e2->e_nname );
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1023,6 +1023,9 @@ LDAP_SLAPD_F (int) value_add_one LDAP_P((
|
||||
BerVarray *vals,
|
||||
struct berval *addval ));
|
||||
|
||||
/* assumes (x) > (y) returns 1 if true, 0 otherwise */
|
||||
#define SLAP_PTRCMP(x, y) ((x) < (y) ? -1 : (x) > (y))
|
||||
|
||||
/*
|
||||
* Other...
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user