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

casting is_entry_foo() to int



servers/slapd/proto-slap.h has several definitions

#define is_entry_foo(e)		\
    (((e)->e_ocflags & SLAP_OC__END) ? ((e)->e_ocflags & SLAP_OC_FOO) : \
    is_entry_objectclass((e), slap_schema.si_oc_foo, 1))

Is it OK if I cast ((e)->e_ocflags & SLAP_OC_FOO) to int?
That removes a lot of 'signed vs. unsigned' warnings.
The SLAPD_OC_<FOO> constants are all less than INT_MAX.

While I'm at it, I'd like to reformat the definitions to

#define is_entry_foo(e)		\
    (((e)->e_ocflags & SLAP_OC__END) \
     ? (int) ((e)->e_ocflags & SLAP_OC_FOO) \
     : is_entry_objectclass((e), slap_schema.si_oc_foo, 1))

to avoid lines longer than 80 chars.

-- 
Hallvard