#include "lutil_ldap.h"
#include "ldap_defaults.h"
#include "ldap_pvt.h"
+#include "lber_pvt.h"
#include "common.h"
}
if ( assertctl ) {
- char berbuf[LBER_ELEMENT_SIZEOF];
- BerElement *ber = (BerElement *)berbuf;
+ BerElementBuffer berbuf;
+ BerElement *ber = (BerElement *)&berbuf;
if( assertion == NULL || *assertion == '\0' ) {
fprintf( stderr, "Assertion=<empty>\n" );
#define LBER_OPT_SUCCESS (0)
#define LBER_OPT_ERROR (-1)
-#define LBER_ELEMENT_SIZEOF (256) /* must be >= sizeof(BerElement) */
-typedef union ber_buffer_u {
- char charbuf[LBER_ELEMENT_SIZEOF];
-
- /* force alignment */
- int intbuf;
- long longbuf;
- float floatbuf;
- double doublebuf;
- char* ptrbuf;
-} BerElementBuffer;
-
typedef struct berelement BerElement;
typedef struct sockbuf Sockbuf;
typedef struct seqorset Seqorset;
LDAP_BEGIN_DECL
+/* for allocating aligned buffers (on the stack) */
+#define LBER_ALIGN_BUFFER(uname,size) \
+ union LDAP_CONCAT(lber_,uname) { \
+ char buffer[size]; \
+ \
+ /* force alignment */ \
+ int ialign; \
+ long lalign; \
+ float falign; \
+ double dalign; \
+ char* palign; \
+ }
+
+#define LBER_ELEMENT_SIZEOF (256) /* must be >= sizeof(BerElement) */
+typedef LBER_ALIGN_BUFFER(berelement_u,LBER_ELEMENT_SIZEOF) BerElementBuffer;
+
typedef struct sockbuf_buf {
ber_len_t buf_size;
ber_len_t buf_ptr;