@@ -66,13 +66,13 @@ internal func osLog(
66
66
let preamble = message. interpolation. preamble
67
67
let argumentCount = message. interpolation. argumentCount
68
68
let bufferSize = message. bufferSize
69
+ let argumentClosures = message. interpolation. arguments. argumentClosures
70
+
69
71
let formatStringPointer = _getGlobalStringTablePointer ( formatString)
70
72
71
73
// Code that will execute at runtime.
72
74
guard logObject. isEnabled ( type: logLevel) else { return }
73
75
74
- let arguments = message. interpolation. arguments
75
-
76
76
// Allocate a byte buffer to store the arguments. The buffer could be stack
77
77
// allocated as it is local to this function and also its size is a
78
78
// compile-time constant.
@@ -84,7 +84,7 @@ internal func osLog(
84
84
var currentBufferPosition = bufferMemory
85
85
serialize ( preamble, at: & currentBufferPosition)
86
86
serialize ( argumentCount, at: & currentBufferPosition)
87
- arguments . serializeAt ( & currentBufferPosition, using : & stringStorageObjects)
87
+ argumentClosures . forEach { $0 ( & currentBufferPosition, & stringStorageObjects) }
88
88
89
89
___os_log_impl ( UnsafeMutableRawPointer ( mutating: #dsohandle) ,
90
90
logObject,
@@ -120,6 +120,7 @@ func _checkFormatStringAndBuffer(
120
120
let preamble = message. interpolation. preamble
121
121
let argumentCount = message. interpolation. argumentCount
122
122
let bufferSize = message. bufferSize
123
+ let argumentClosures = message. interpolation. arguments. argumentClosures
123
124
124
125
// Code that will execute at runtime.
125
126
let bufferMemory = UnsafeMutablePointer< UInt8> . allocate( capacity: bufferSize)
@@ -128,9 +129,7 @@ func _checkFormatStringAndBuffer(
128
129
var currentBufferPosition = bufferMemory
129
130
serialize ( preamble, at: & currentBufferPosition)
130
131
serialize ( argumentCount, at: & currentBufferPosition)
131
- message. interpolation. arguments. serializeAt (
132
- & currentBufferPosition,
133
- using: & stringStorageObjects)
132
+ argumentClosures. forEach { $0 ( & currentBufferPosition, & stringStorageObjects) }
134
133
135
134
assertion (
136
135
formatString,
0 commit comments