mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
ITS#5747: Simplify previous fix. Just use the struct hack.
This commit is contained in:
parent
b464a790b8
commit
d55d5fadf9
@ -42,20 +42,11 @@
|
|||||||
* is no effect. If no attribute was configured, there is no effect.
|
* is no effect. If no attribute was configured, there is no effect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Use C99 flexible array member if supported, C89 "struct hack" otherwise. */
|
|
||||||
#define FLEXIBLE_STRUCT_SIZE(stype, mtype, mcount) \
|
|
||||||
(sizeof(stype) + sizeof(mtype) * ((mcount) - (0 FLEXIBLE_ARRAY_MEMBER)))
|
|
||||||
#if __STDC_VERSION__>=199901L || (defined __GNUC__ && !defined __STRICT_ANSI__)
|
|
||||||
#define FLEXIBLE_ARRAY_MEMBER
|
|
||||||
#else
|
|
||||||
#define FLEXIBLE_ARRAY_MEMBER +1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct collect_info {
|
typedef struct collect_info {
|
||||||
struct collect_info *ci_next;
|
struct collect_info *ci_next;
|
||||||
struct berval ci_dn;
|
struct berval ci_dn;
|
||||||
int ci_ad_num;
|
int ci_ad_num;
|
||||||
AttributeDescription *ci_ad[FLEXIBLE_ARRAY_MEMBER];
|
AttributeDescription *ci_ad[1];
|
||||||
} collect_info;
|
} collect_info;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -184,8 +175,8 @@ collect_cf( ConfigArgs *c )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate config info with room for attribute array */
|
/* allocate config info with room for attribute array */
|
||||||
ci = ch_malloc( FLEXIBLE_STRUCT_SIZE( collect_info,
|
ci = ch_malloc( sizeof( collect_info ) +
|
||||||
AttributeDescription *, count + 1 ));
|
sizeof( AttributeDescription * ) * count );
|
||||||
|
|
||||||
/* validate and normalize dn */
|
/* validate and normalize dn */
|
||||||
ber_str2bv( c->argv[1], 0, 0, &bv );
|
ber_str2bv( c->argv[1], 0, 0, &bv );
|
||||||
|
Loading…
Reference in New Issue
Block a user