From: Howard Chu Date: Fri, 9 Mar 2012 05:39:31 +0000 (-0800) Subject: ITS#7191 fix typo, more alignment tweaks X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=47e57a9c8f97d67ba44ac3cf6916f7fd7ef80f58;p=openldap ITS#7191 fix typo, more alignment tweaks --- diff --git a/servers/slapd/back-mdb/back-mdb.h b/servers/slapd/back-mdb/back-mdb.h index f69e0bec60..e4b6d7e2a8 100644 --- a/servers/slapd/back-mdb/back-mdb.h +++ b/servers/slapd/back-mdb/back-mdb.h @@ -170,6 +170,8 @@ typedef struct AttrList { #if defined(__i386) || defined(__x86_64) #define MISALIGNED_OK 1 +#else +#define ALIGNER (sizeof(size_t)-1) #endif typedef struct IndexRbody { diff --git a/servers/slapd/back-mdb/idl.c b/servers/slapd/back-mdb/idl.c index 009667f59a..35623ad624 100644 --- a/servers/slapd/back-mdb/idl.c +++ b/servers/slapd/back-mdb/idl.c @@ -414,7 +414,7 @@ mdb_idl_insert_keys( assert( id != NOID ); #ifndef MISALIGNED_OK - if (keys[0].bv_len & 0x03) + if (keys[0].bv_len & ALIGNER) kbuf[1] = 0; #endif for ( k=0; keys[k].bv_val; k++ ) { @@ -422,7 +422,7 @@ mdb_idl_insert_keys( * exists and if it's a range. */ #ifndef MISALIGNED_OK - if (keys[k].bv_len & 0x03) { + if (keys[k].bv_len & ALIGNER) { key.mv_size = sizeof(kbuf); key.mv_data = kbuf; memcpy(key.mv_data, keys[k].bv_val, keys[k].bv_len); @@ -563,7 +563,7 @@ mdb_idl_delete_keys( assert( id != NOID ); #ifndef MISALIGNED_OK - if (keys[0].bv_len & 0x03) + if (keys[0].bv_len & ALIGNER) kbuf[1] = 0; #endif for ( k=0; keys[k].bv_val; k++) { @@ -571,7 +571,7 @@ mdb_idl_delete_keys( * exists and if it's a range. */ #ifndef MISALIGNED_OK - if (keys[k].bv_len & 0x03) { + if (keys[k].bv_len & ALIGNER) { key.mv_size = sizeof(kbuf); key.mv_data = kbuf; memcpy(key.mv_data, keys[k].bv_val, keys[k].bv_len); diff --git a/servers/slapd/back-mdb/key.c b/servers/slapd/back-mdb/key.c index c7a05a3379..6d3e381269 100644 --- a/servers/slapd/back-mdb/key.c +++ b/servers/slapd/back-mdb/key.c @@ -39,14 +39,14 @@ mdb_key_read( { int rc; MDB_val key; -#ifndef MSIALIGNED_OK +#ifndef MISALIGNED_OK int kbuf[2]; #endif Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 ); #ifndef MISALIGNED_OK - if (k->bv_len & 0x03) { + if (k->bv_len & ALIGNER) { key.mv_size = sizeof(kbuf); key.mv_data = kbuf; kbuf[1] = 0;