Skip to content

Commit a688d18

Browse files
committed
Clean up some spacing.
1 parent 6d556b6 commit a688d18

File tree

4 files changed

+66
-51
lines changed

4 files changed

+66
-51
lines changed

SQLite/Core/Connection.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ public enum TransactionMode : String {
5050
public protocol Connection {
5151

5252
/// Whether or not the database was opened in a read-only state.
53-
var readonly : Bool { get }
53+
var readonly: Bool { get }
5454

5555
/// The last rowid inserted into the database via this connection.
56-
var lastInsertRowid : Int64? { get }
56+
var lastInsertRowid: Int64? { get }
5757

5858
/// The last number of changes (inserts, updates, or deletes) made to the
5959
/// database via this connection.
60-
var changes : Int { get }
60+
var changes: Int { get }
6161

6262
/// The total number of changes (inserts, updates, or deletes) made to the
6363
/// database via this connection.
@@ -808,7 +808,7 @@ public final class DirectConnection : Connection, Equatable {
808808
throw error
809809
}
810810

811-
private var dispatcher : Dispatcher
811+
private var dispatcher: Dispatcher
812812

813813
}
814814

SQLite/Core/ConnectionPool.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ private let vfsName = "unix-excl"
3838
// WAL mode.
3939
public final class ConnectionPool {
4040

41-
private let location : DirectConnection.Location
41+
private let location: DirectConnection.Location
4242
private var availableReadConnections = [DirectConnection]()
4343
private var unavailableReadConnections = [DirectConnection]()
44-
private let lockQueue : dispatch_queue_t
45-
private var writeConnection : DirectConnection!
44+
private let lockQueue: dispatch_queue_t
45+
private var writeConnection: DirectConnection!
4646
private let connectionSemaphore = dispatch_semaphore_create(5)
4747

4848
public var foreignKeys : Bool {
@@ -82,8 +82,8 @@ public final class ConnectionPool {
8282
// to the pool when it goes out of scope
8383
private class BorrowedConnection : Connection, Equatable {
8484

85-
let pool : ConnectionPool
86-
let connection : DirectConnection
85+
let pool: ConnectionPool
86+
let connection: DirectConnection
8787

8888
init(pool: ConnectionPool, connection: DirectConnection) {
8989
self.pool = pool
@@ -100,10 +100,10 @@ public final class ConnectionPool {
100100
}
101101
}
102102

103-
var readonly : Bool { return connection.readonly }
104-
var lastInsertRowid : Int64? { return connection.lastInsertRowid }
105-
var changes : Int { return connection.changes }
106-
var totalChanges : Int { return connection.totalChanges }
103+
var readonly: Bool { return connection.readonly }
104+
var lastInsertRowid: Int64? { return connection.lastInsertRowid }
105+
var changes: Int { return connection.changes }
106+
var totalChanges: Int { return connection.totalChanges }
107107

108108
func execute(SQL: String) throws { return try connection.execute(SQL) }
109109
@warn_unused_result func prepare(statement: String, _ bindings: Binding?...) throws -> Statement { return try connection.prepare(statement, bindings) }
@@ -131,7 +131,7 @@ public final class ConnectionPool {
131131

132132
var writeConnectionInit = dispatch_once_t()
133133

134-
public var writable : DirectConnection {
134+
public var writable: DirectConnection {
135135

136136
dispatch_once(&writeConnectionInit) {
137137

@@ -153,17 +153,17 @@ public final class ConnectionPool {
153153
}
154154

155155
// Acquires a read only connection to the database
156-
public var readable : Connection {
156+
public var readable: Connection {
157157

158-
var borrowed : BorrowedConnection!
158+
var borrowed: BorrowedConnection!
159159

160160
dispatch_semaphore_wait(connectionSemaphore, DISPATCH_TIME_FOREVER)
161161
dispatch_sync(lockQueue) {
162162

163163
// Ensure database is open
164164
self.writable
165165

166-
let connection : DirectConnection
166+
let connection: DirectConnection
167167

168168
if let availableConnection = self.availableReadConnections.popLast() {
169169
connection = availableConnection

SQLite/Core/Dispatcher.swift

Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,71 @@
11
//
2-
// Dispatcher.swift
3-
// SQLite
2+
// SQLite.swift
3+
// https://github.com/stephencelis/SQLite.swift
4+
// Copyright © 2014-2015 Stephen Celis.
45
//
5-
// Created by Kevin Wooten on 11/28/15.
6-
// Copyright © 2015 stephencelis. All rights reserved.
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
723
//
824

925
import Foundation
1026

1127

1228
/// Block dispatch method
1329
public protocol Dispatcher {
14-
15-
/// Dispatches the provided block
16-
func dispatch(block: dispatch_block_t)
17-
30+
31+
/// Dispatches the provided block
32+
func dispatch(block: dispatch_block_t)
33+
1834
}
1935

2036

2137
/// Dispatches block immediately on current thread
2238
public final class ImmediateDispatcher : Dispatcher {
23-
24-
public func dispatch(block: dispatch_block_t) {
25-
block()
26-
}
27-
39+
40+
public func dispatch(block: dispatch_block_t) {
41+
block()
42+
}
43+
2844
}
2945

3046

3147
/// Synchronously dispatches block on a serial
3248
/// queue. Specifically allows reentrant calls
3349
public final class ReentrantDispatcher : Dispatcher {
34-
35-
static let queueKey = unsafeBitCast(ReentrantDispatcher.self, UnsafePointer<Void>.self)
36-
37-
let queue : dispatch_queue_t
38-
39-
let queueContext : UnsafeMutablePointer<Void>!
40-
41-
public init(_ name: String) {
42-
queue = dispatch_queue_create(name, DISPATCH_QUEUE_SERIAL)
43-
queueContext = unsafeBitCast(queue, UnsafeMutablePointer<Void>.self)
44-
dispatch_queue_set_specific(queue, ReentrantDispatcher.queueKey, queueContext, nil)
45-
}
46-
47-
public func dispatch(block: dispatch_block_t) {
48-
if dispatch_get_specific(ReentrantDispatcher.queueKey) == self.queueContext {
49-
block()
50-
} else {
51-
dispatch_sync(self.queue, block) // FIXME: rdar://problem/21389236
50+
51+
static let queueKey = unsafeBitCast(ReentrantDispatcher.self, UnsafePointer<Void>.self)
52+
53+
let queue : dispatch_queue_t
54+
55+
let queueContext : UnsafeMutablePointer<Void>
56+
57+
public init(_ name: String) {
58+
queue = dispatch_queue_create(name, DISPATCH_QUEUE_SERIAL)
59+
queueContext = unsafeBitCast(queue, UnsafeMutablePointer<Void>.self)
60+
dispatch_queue_set_specific(queue, ReentrantDispatcher.queueKey, queueContext, nil)
61+
}
62+
63+
public func dispatch(block: dispatch_block_t) {
64+
if dispatch_get_specific(ReentrantDispatcher.queueKey) == self.queueContext {
65+
block()
66+
} else {
67+
dispatch_sync(self.queue, block) // FIXME: rdar://problem/21389236
68+
}
5269
}
53-
}
54-
70+
5571
}

SQLite/Typed/Query.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,6 @@ public struct Row {
10511051
}
10521052

10531053
// FIXME: rdar://problem/18673897 // subscript<T>…
1054-
10551054
public subscript(column: Expression<Blob>) -> Blob {
10561055
return get(column)
10571056
}

0 commit comments

Comments
 (0)