Skip to content

Commit 8727aaf

Browse files
authored
SWIFT-784 Disable BSON_EXTRA_ALIGN (#451)
1 parent e130fc0 commit 8727aaf

File tree

5 files changed

+5
-20
lines changed

5 files changed

+5
-20
lines changed

Sources/CLibMongoC/include/CLibMongoC_bson-config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
/*
129129
* Define to 1 if you want extra aligned types in libbson
130130
*/
131-
#define BSON_EXTRA_ALIGN 1
131+
#define BSON_EXTRA_ALIGN 0
132132
#if BSON_EXTRA_ALIGN != 1
133133
# undef BSON_EXTRA_ALIGN
134134
#endif

Sources/MongoSwift/BSON/Document.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import CLibMongoC
22
import Foundation
33

4-
#if compiler(>=5.0)
5-
internal typealias BSONPointer = OpaquePointer
6-
internal typealias MutableBSONPointer = OpaquePointer
7-
#else
84
internal typealias BSONPointer = UnsafePointer<bson_t>
95
internal typealias MutableBSONPointer = UnsafeMutablePointer<bson_t>
10-
#endif
116

127
/// The storage backing a MongoSwift `Document`.
138
public class DocumentStorage {
@@ -55,11 +50,7 @@ public struct Document {
5550
extension Document {
5651
/// Read-only access to the storage's underlying bson_t.
5752
internal var _bson: BSONPointer {
58-
#if compiler(>=5.0)
59-
return self._storage._bson
60-
#else
61-
return UnsafePointer(self._storage._bson)
62-
#endif
53+
UnsafePointer(self._storage._bson)
6354
}
6455

6556
/**

Sources/MongoSwift/BSON/DocumentIterator.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import CLibMongoC
22
import Foundation
33

4-
#if compiler(>=5.0)
5-
internal typealias BSONIterPointer = OpaquePointer
6-
internal typealias MutableBSONIterPointer = OpaquePointer
7-
#else
84
internal typealias BSONIterPointer = UnsafePointer<bson_iter_t>
95
internal typealias MutableBSONIterPointer = UnsafeMutablePointer<bson_iter_t>
10-
#endif
116

127
/// An iterator over the values in a `Document`.
138
public class DocumentIterator: IteratorProtocol {

Sources/MongoSwift/ConnectionString.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,13 @@ internal class ConnectionString {
115115
internal var authMechanismProperties: Document? {
116116
var props = bson_t()
117117
return withUnsafeMutablePointer(to: &props) { propsPtr in
118-
let opaquePtr = OpaquePointer(propsPtr)
119-
guard mongoc_uri_get_mechanism_properties(self._uri, opaquePtr) else {
118+
guard mongoc_uri_get_mechanism_properties(self._uri, propsPtr) else {
120119
return nil
121120
}
122121
/// This copy should not be returned directly as its only guaranteed valid for as long as the
123122
/// `mongoc_uri_t`, as `props` was statically initialized from data stored in the URI and may contain
124123
/// pointers that will be invalidated once the URI is.
125-
let copy = Document(copying: opaquePtr)
124+
let copy = Document(copying: propsPtr)
126125

127126
return copy.mapValues { value in
128127
// mongoc returns boolean options e.g. CANONICALIZE_HOSTNAME as strings, but they are boolean values.

etc/generated_headers/bson-config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
/*
129129
* Define to 1 if you want extra aligned types in libbson
130130
*/
131-
#define BSON_EXTRA_ALIGN 1
131+
#define BSON_EXTRA_ALIGN 0
132132
#if BSON_EXTRA_ALIGN != 1
133133
# undef BSON_EXTRA_ALIGN
134134
#endif

0 commit comments

Comments
 (0)